Gurugail Main/CLIPS
Main

CLIPS

CLIPS는 전문가 시스템을 구축하기 위한 언어이다. 따라서 전문가 시스템이 필요로하는 사실(fact), 규칙(rule)을 쉽게 정의할 수 있으며 그리고 추론 엔진이 자체적으로 내장되어 있는 프로그램 언어라 생각할 수 있다. CLIPS 를 이용하면 원하는 전문가 시스템을 비교적 쉽게 구축할 수 있다. CLIPS는 1985년 미국 NASA에서 개발을 시작해서 1990 대 중반까지 계속 개발되었다고 한다. CLIPS 언어의 처음 이름은 NASA's AI Language (NAIL)이었다고 한다.

CLIPS가 아마도 전문가 시스템 도구로는 가장 많이 사용되고 있을 것이다. 이유는 C 언어로 구성되어, 빠르고 효율적이고 게다가 무료이기 때문이다.

assert / run

사실을 지식 엔진에 추가하기 위한 명령이 assert 이다. 그리고 지식 엔진에게 실행을 요청하는 함수가 바로 (run)이다.

(assert (duck))

facts and rules

전문가 시스템의 구성 요소 중 가장 기본적인 요소가 사실(facts)와 규칙이다. 간단하게는 위 assert 함수를 이용해 사실을 추가할 수 있고, deffacts를 이용하여 한꺼번에 여러 개의 사실(facts)들을 정의할 수 있다. 요약하면, CLIPS에서 사실과 규칙은 아래와 같이 입력될 수 있다

(deffacts trouble_shooting
    (car_problem (name ignition_key) (status on))
    (car_problem (name engine) (status wont_start))
    (car_problem (name headlights) (status work))
 )
(defrule rule1
    (car_problem (name ignition_key) (status on))
    (car_problem (name engine) (status wont_start))
     =>
    (assert (car_problem (name starter) (status faulty))
)

variables

CLIPS도 타 언어와 유사하게 변수를 지정할 수 있다. 사실(facts)와는 다르게 변할 수 있는 값을 지정할 수 있다.

?<variable-name>
?x ?noun ?color
?sensor ?valve ?ducks-eaten

samples

아래는 CLIPS에서 제공하는 샘플 animal.clp 파일을 실행시켜 본 예제입니다. 동물을 판별해 주는 간단한 전문가 시스템 예제입니다.

CLIPS> (load "animal.clp")
Defining deftemplate: rule
Defining defrule: propagate-goal +j+j+j
Defining defrule: goal-satified =j+j+j+j
Defining defrule: remove-rule-no-match +j+j+j
Defining defrule: modify-rule-match =j+j+j
Defining defrule: rule-satisfied =j+j+j
Defining defrule: ask-question-no-legalvalues +j+j+j+j
Defining defrule: ask-question-legalvalues +j+j+j+j
Defining deffacts: knowledge-base
TRUE
CLIPS> (reset)
CLIPS> (run)
Does your animal have a backbone? (yes no) no
Does your animal live primarily in soil? (yes no) no
Is the animals body in segments? (yes no) no
Does your animal use many cells to digest it's food instead of a stomach? (yes no) no
Is your animal made up of more than one cell? (yes no) no
I think your animal is a protozoa
CLIPS> 

CLIPS 유사 언어(descendants)

JESS는 CLIPS의 자바 버전이다. 그 외 FuzzyCLIPS 가 있다.

참고