You are on page 1of 37

:

CLIPS-

CLIPS (A Tool for Building Expert Systems)


. . 03/2010

, , 2011.


1. ..................................................................................................................................4
2. ............................................................................................6
2.1. ...............................................................................................6
2.2. ..........................................................................7
2.3. ................................................................................8
2.4. ..............................................................9
2.5. ..................................10
2.6. ..........................................................12
2.7. .........................................................13
2.8. .....................................15
2.9. ..................................................................................17
3. .........................................................21
3.1. ..........................................................................................24
4. CLIPS (C Language Integrated Production System)....................27
4.1. CLIPS-.....................................................................................27
5. ...........................................................................................................................31
6. ........................................................................................................................36
7. .....................................................................................................................37

1.

.



.
()
. :
,
(, , , ,
, ),
.

.
: , , ,
.

,
.

.

(Artificial Intelligence).
()
- .

.

. ,
- ,
. -
. "rule-based systems", .
" " (if - then)
.

.
.
.
.

.

.
, ,
: (DSS - decision
support system) (ES - expert system).
(DSS - decision support system)
,
, .
4

(ES - expert system)



.
,
.
, , , .
,
.
,

( ).

2.

1.
: , ,
.

.


, ,
.
.
(
) : ,
, .

2.1.
a
, ,
,
.
, ,

.
" " ,

.
-.
,
: , .
,
.

1.
1

,
, . , , , 2009


. ,
.
.
, ,
. .
,
. , , .

.
, ,
, .
, .
(,
.).

/ .
(, ,
, .).
, "" (shells).

.

2.2.

:

,
,
.
:
(knowledge base)

(inference engine)
.
:
,

.

.
.
.

,

.

2.

.

.

.

.

2.3.

. "" (
).
,
.

.
, .

.

.

,
.
:

-
, .
.
- ,
, ,
.
.

3.
,
.
,

.

,
,
.

, ,
. ,

.
, ( )
.

.
.

. ,
, .
,
.

2.4.
.
:

.

,
.
9

.
,
, .
, ,
, .
.
1.



,
,

( )
-
,


,
. , ,
, .

, ,
.
, ,
. ,
, ""
.

,
.
, ()
, .
.
.
( ).

2.5.
,
:

?
,

10

, : , , ,
, , .

,
. .
, .
, ,
.

.
.
, .

.

, .
, .

.
.
,
.


. .
:
0.00 - 0.25 - 0.50 -
0.75 - 1.00 -

.

.
. , .

.

.
.

.
,
.
.
, .

.

11

2.6.
:
?
.

,

, .

,
, .
, .
, .
.

,
. , , ,
.
. ,
.


.
.
.


,
.
,
.
.
,
. ,
, .
.

:
, , ,
.
. ,

. ,
.
( ).
.
.
.
. ,
, ,
.
12



. , ,
,
, ,
.
, .
,
.


.
:

.
,
, .

(/)
.

,
, , .

- ,
.

,
.

,
.

,
.
,
.

2.7.

() :
?

?

.
. ,
.

.
. ,
""
.
.
. ,
13

,
, ,
, .

.
( ),
,
. ,
,
.

. ,
.
.

, ,
. ,
, ,
.
,
.
,
.
.
, . ,
, .
.
, . ,

.
, . ,
,
. ,
.
,
.

.
, , .
, .
, ,
., ,
, 30
.

.
, .
""
.
,
. ,
.
14


. . ,
, "" . , ,
,
, .

. ,
.

y .
72% . ,
.
" ",
500 500
. ,
,
""
.

2.8.

, , ,
. ,

. ,
.
, . ?
, .
, :
,
,

,
,
.
:
,
,
,
,
,
,
,
.
:
,
,
,
,
.

15

,
,
. , ,
,
.
- ().

. ,
, ( )
.
2. -

?
/

()

,
. ,
. (
) , ,
. ,
(
). , , "".
, .
,
, ,
.
, , .
,
.
,
, ;
- , :
- , ,
.
, ,
.

16

2.9.
() :
,
,
,
,
,
.

:
,
,
.
, ,
:
,
( ),
( ),
,
.
:
,
,
,
,
,
.
, ,
, .



, .

:
,
,
,
,
,
- .

, .
.
:
,
,
,
, ,
,

,
17

, ,
.

.

.
.
""
, .
, ,
.
, ,
, ,
, , ,
.

.
, "" ,
,
.

.

,
,
,
: .
, ,
.
:
, ,
,
.
:
- ,
,
,
.
, ,
.
,
, ,
, .
, ,
,
.
.
,
, : -
(--).
. ,
,
18

. ,
.
.


.



. . ,
,
.
,
, .

, ,
.

,

,
.
,
.
.
,
, .

, ,
, :
, ,
;
;

. ,
;
, ,
,
;

;
;
;
.

.

:
,
,
.

19

:
(1)
;
(2) .

- .
80%
.
:

,
,
,
.
.


, .
,
. , .
, :
/
.

. , ,
, ,
.
:

,
,
,
.

20

3.
()
. (
) 60- .

. 70-
.
.
:
XCON, XSEL CATS-1 : EMYCIN, EXPERT, METADENDRAL EURISKO.
.
3. (Roth, 1992)



X

()














EMYCIN



( )
LOOKS

ART

150 ,
3000 .
.
,
.
.

MYCIN
DART
INTERNIST
XCON
SYN
SYNCHEM
ISIS
MOLGEN
DENDRAL
PROSPECTOR
TEC
W
RADEX
PROCON



,

.
.
Godwin Wright :
1.

;
2.
(shell) (
XiPlus, EXSYS Professional, BEST Blackboard-based
Expert System Toolkit).

(, , 1995):
21

1.
2.
3.
4.

;
;
;

.
Turban Aronson (1998) :
1.

.
.
2.
( ),
( ) .
, ,
. .
: , ,
, ,
, ,
, , ,
, .
: , ,
, .
:
1. ,
2. ,
3. ,
4. ,
5. ,
6. ,
7. .
: , ,
, , , .
: 1. ,
2. ,
3. ,
4. ,
5. ,
6. ,
7. ,
8. .
: , , ,
, .
3. ()
. .
: ,
, , ,
, .
:
1. ,
2. ,
3. ,
22

4. ,
5. WHEN CHANGED I WHEN NEEDED ,
6. ,
7. .
4. .
: ,
, .
,
.
5.
.
. :
, .
6. .
.
7.
.


.
:
,
,
,
ES
,
ES ,
,
,
,
ES.
ES :
,
,
,
,
.
ES DSS :
,
,
,

.
ES DSS
, .
ES :
,
,
,
ES
.
23

3.1.

. Javi C C++ .NET .
. RBS Rule
Based Systems BRMS Business Rule Management
System .
4.
(http://www.kbsc.com/rulebase.html)
/

Aion
Commercial
Mostly mainframe Computer Associates
Clever Path
BRMS
Acquire Software
Commercial
RBS
Attar
Commercial
XpertRule Builder
and Data Mining
RBS
CLIPS
Free
C Language
Interface Production System
Corticon
Commercial
Java RBS
using mostly Excel-like tables for
rules non-Rete
Drools
Free
Java RBS
dynamic rules object-oriented
system mostly rules in XML
Euler
Free
Java Rule System
Backward Chaining Kind of weird
but very academic
EXSYS Expert
Commercial
System Software &
Services
Fair-Isaac Blaze
Commercial
.NET and Java
High-end
Advisor
BRMS
Gensym
Commercial
Corporation Home
Page
The Haley
Commercial
C/C++ and Java
High-end (Paul Haley)
Enterprise CIA
ILOG Rules and
Commercial
C/C++, .NET and
High-end
Jrules
Java BRMS
InfoSapient
Free
Java RBS
Open Source
Jess: (Sandia Labs) Commercial/Fre Java Clips-sub-set (Author, Dr. Ernest Friedmane for Non
RBS
Hill)
Commercial
Use
Jena2
Free
Java RBS
Semantic Web Framework, from
HP Labs
Jlog
Free,
ProLog in Java
Open Source
System
JEOPS
Free:
Java RBS
(Author: Dr. Carlos Figueira
Filho)
JEOPS on
Free:
Java RBS
(Author: Carlos Figueira Filho)
SourceForge
Jlisa
Free,
CLIPS-Like, Java Open Source
RBS
JTP Java Theorem
Free,
Java RBS
Open Source
24

Prover
Mandarex
MindBox:
(Formerly Inference
Corporation)
OFBiz

Free
Commercial,

Java RBS
Non-Java BRMS

Backward Chaining, Open Source


High-End

Java RBS

Open Source

PegaRules

Open for
Business, Free,
Free and
Commercial
Versions
Commercial

Pellet

Free,

PST - Production
System
Technologies
OPSJ

Commercial,
Free for noncommercial use:

OpenRules

CLIPS/R2

XML-based nonRete RBS


PegaSystems
BRMS
OWL and OWL
DL RBS
Java RBS
Java using Rete
RBS
OPS in C/C++
Using Rete 2
Rete 2 for OPS
Resolution
Systems RBS
RBS in OWL for
Jess
possibly non-Rete
RBS
Java, CLIPS Subset RBS

OPS/R2
Resolution

Commercial

ROWL

Free

RuleCore

Commercial

Sandia Labs Jess

Commercial,
Free for
Government and
Academic Use,
Small fee for
non-commercial
use
Free
Hierarchial Task
Network
Free,
Semantic Web
Rules
Free,
Java RBS
Commercial

SHOP
Sweet Rules

use with Jena or OWL API, from


MindSwap
(Author: Dr. Charles Forgy)

Rule Core Systems, Sweden


includes source code, (Author:
Dr. Ernest Friedman-Hill)

University of Maryland
MIT

TyRuBa
Open Source
Teknowledge
Corporation
CLIPS - C Language Integrated Production
System. CLIPS
/ . CLIPS-:
: CLIPS
:
o :
;

25

o :

;
o : CLIPS
C, Java, Ada LISP.
: CLIPS C

(Windows XP, MacOS X, and Unix).
.
/: CLIPS
( ) (C,
Java, FORTRAN and ADA).
CLIPS-.
:
, , ,
.
/: CLIPS

,


.
: CLIPS
.
: CLIPS .

26

4. CLIPS (C Language Integrated


Production System)
CLIPS
NASA's Johnson Space Center
LISP .
1984. . Artificial Intelligence
Section . C ART,
Inference Corporation
. 1985.
. 6.3
.

4.1. CLIPS-
CLIPS- Windows .
:
File,
Edit,
Buffer,
Execution,
Browse,
Window,
Help.
File - :
New (Ctrl+N) .
Open... (Ctrl+O) Windows
.
Load... (Ctrl+L) Windows
(load "C: / CLIPSWIN / EXAMPLES / TEST.CLP")
Load Batch... Windows
.
Load Binary... Windows
Turn Dribble On... Windows
.
Close .
Save (Ctrl+S) ,
.
Save As...
.
Save Binary... CLIPS-
.
Revert
.
Page Setup... .
Print... (Ctrl+P) .
Exit .

27

Edit - :
Undo (Ctrl+Z)
Cut (Ctrl+X) .
Copy (Ctrl+C) .
Paste (Ctrl+V) .
Delete .
Select All .
Balance (Ctrl+B) .
Comment (Ctrl+;) Uncomment (Ctrl+U) .
Set Font... .

Buffer - :
Find (Ctrl+F)- .
Replace (Ctrl+H) .
Load Selection (Ctrl+K) .
Batch Selection (Ctrl+M) .
Load Buffer .

28

Execution - :
Reset (Ctrl+E) .
Run (Ctrl+R) .
Step (Ctrl+T) .
Watch... (Ctrl+W)
Options... .
Preferences... CLIPS Windows .
Clear CLIPS .

Browse - :
The Module Menu .
Defrule Manager...
.
Deffacts Manager...
.
Deftemplate Manager...
.
Deffunction Manager...
.
Defglobals Manager...
.
Defgeneric Manager...
.
Defclass Manager...
.
Definstances Manager...
.
Agenda Manager...

Window - :
Cascade
Tile Horizontally .
Tile Vertically .
Close All .
29

Show Status Windows , , ,


.
Hide Status Windows .
Tile Dialog & Status Windows
.
Clear Dialog Window .
Facts Window .
Agenda Window .
Instances Window .
Globals Window .
Focus Window .
Dialog Window .
Edit Windows .

Help - :
About CLIPS CLIPS-.
CLIPS Help .
Command complete... (Ctrl+J) .
Status Line .

30

5.

.
.
:
,
,
,
,


.
,
;
;
;

.

:

;
;
.
CLIPS-.
.
:
(deftemplate Patient (slot temperature)
(slot spots)
(slot rash)
(slot sore_throat)
(slot inneculated)
(slot fever))
(deffacts Initial
(Patient ))

:
(defrule GetTemperature
(declare (salience 500))
?p <- (Patient (temperature nil))
=>
(printout t "Unesite pacijentovu temperaturu: ")
(bind ?response (read))
(modify ?p (temperature ?response)))
(defrule GetSpots
(declare (salience 500))
31

?p <- (Patient (spots nil))


=>
(printout t "Da li pacijent ima crvene tacke (da ili ne): ")
(bind ?response (read))
(modify ?p (spots ?response)))
(defrule GetRash
(declare (salience 500))
?p <- (Patient (rash nil))
=>
(printout t "Da li pacijent ima crvenilo koze (da ili ne): ")
(bind ?response (read))
(modify ?p (rash ?response)))
(defrule GetSoreThroat
(declare (salience 500))
?p <- (Patient (sore_throat nil))
=>
(printout t "Da li pacijent ima upalu grla (da ili ne): ")
(bind ?response (read))
(modify ?p (sore_throat ?response)))

:
(defrule GetInneculated
(declare (salience 500))
?p <- (Patient (fever high) (spots da) (inneculated nil))
=>
(printout t "Da li je pacijent vakcinisan protiv malih boginja: (da ili
ne): ")
(bind ?response (read))
(modify ?p (inneculated ?response)))

:
(defrule Measles
(declare (salience 100))
(Patient (spots da) (inneculated ne) (fever high))
=>
(assert (diagnesis measles))
(printout t " male boginje" crlf))
; Pravila koja su vezana za dijagnozu u vezi malih boginja.
(defrule Allergy1
(declare (salience -100))
(and (Patient (spots da))
(not (diagnesis measles)))
=>
(assert (diagnesis allergy))
(printout t "Alergija je izazvala crvene tacke i nema malih boginja"
crlf))
32

(defrule Allergy2
(Patient (rash da))
=>
(assert (diagnesis allergy))
(printout t "Alergija je izazvala crvenilo koze" crlf))
(defrule Flu
(Patient (sore_throat da) (fever mild|high))
=>
(assert (diagnesis flu))
(printout t "Infekcija grla" crlf))

, :
(defrule Penicillin
(diagnesis measles)
=>
(assert (treatment pennicillin))
(printout t "Prepisati penicilin" crlf))
(defrule Allergy_pills
(diagnesis allergy)
=>
(assert (treatment allergy_shot))
(printout t "Prepisati injekcijsku terapiju" crlf))
(defrule Bed_rest
(diagnesis flu)
=>
(assert (treatment bed_rest))
(printout t "Prep lezanje u krevetu" crlf))
; Ukoliko ekspertni sistem nema ponudjenih dijagnoza
; daje se preporuka da se pacijent obrati ekspertu
(defrule None
(declare (salience -100))
(not (diagnesis ?))
=>
(printout t "Nije moguca dijagnoza - obratiti se lekaru specijalisti"
crlf))
CLIPS-
:
CLIPS (Quicksilver Beta 3/26/08)
CLIPS> (load "G:/FIM/EkspertniSistemi/Primer.txt")
Defining deftemplate: Patient
Defining deffacts: Initial
Defining defrule: GetTemperature +j+j
Defining defrule: GetSpots +j+j
33

Defining defrule: GetRash +j+j


Defining defrule: GetSoreThroat +j+j
Defining defrule: GetInneculated +j+j
Defining defrule: Fever1 +j+j
Defining defrule: Fever2 +j+j
Defining defrule: Fever3 +j+j
Defining defrule: Fever4 +j+j
Defining defrule: Measles +j+j
Defining defrule: Allergy1 +j+j+j
Defining defrule: Allergy2 +j+j
Defining defrule: Flu +j+j
Defining defrule: Penicillin +j+j
Defining defrule: Allergy_pills +j+j
Defining defrule: Bed_rest +j+j
Defining defrule: None +j+j
TRUE
CLIPS> (reset)
CLIPS> (run)
Unesite pacijentovu temperaturu: 38
Da li pacijent ima crvene tacke (da or ne): ne
Da li pacijent ima crvenilo koze (da or ne): ne
Da li pacijent ima upalu grla (da or ne): da
Utvrdjena visoka temperatura
Infekcija grla
Prepisati lezanje u krevetu
CLIPS> (reset)
CLIPS> (run)
Unesite pacijentovu temperaturu: 38
Da li pacijent ima crvene tacke (da or ne): da
Da li pacijent ima crvenilo koze (da or ne): ne
Da li pacijent ima upalu grla (da or ne): ne
Utvrdjena visoka temperatura
Da li je pacijen vakcinisan protiv malih boginja: (da or ne):
ne
Utvrdjene male boginje
Prepisati penicilin
CLIPS> (reset)
CLIPS> (run)
Unesite pacijentovu temperaturu: 39
Da li pacijent ima crvene tacke (da or ne): ne
Da li pacijent ima crvenilo koze (da or ne): da
Da li pacijent ima upalu grla (da or ne): ne
Alergija je izazvala crvenilo koze
Prepisati injekcijsku terapiju
Utvrdjena visoka temperatura
CLIPS> (reset)
CLIPS> (run)
Unesite pacijentovu temperaturu: 39
Da li pacijent ima crvene tacke (da or ne): ne
Da li pacijent ima crvenilo koze (da or ne): da
Da li pacijent ima upalu grla (da or ne): da
Alergija je izazvala crvenilo koze
34

Prepisati injekcijsku terapiju


Utvrdjena visoka temperatura
Infekcija grla
Prepisati lezanje u krevetu
CLIPS>
Unesite pacijentovu temperaturu: 36
Da li pacijent ima crvene tacke (da or ne): ne
Da li pacijent ima crvenilo koze (da or ne): ne
Da li pacijent ima upalu grla (da or ne): ne
Utvrdjena normalna temperatura
Nije moguca dijagnoza - obratiti se lekaru specijalisti
CLIPS>
CLIPSWin
Quicksilver Beta 3/26/08.
.
CLIPSWin
.

.
.

.
.

35

6.


( ,

).

.
.
, .

.
.

36

7.
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]

, . , , , 2009.
, . , , , 2007.
, . , , , Giarratano, J, CLIPS User Manual, 2007.
CLIPS, Reference Manual I, Basic Programming Guide, 2007.
CLIPS, Reference Manual II, Advanced Programming Guide, 2008.
CLIPS, Reference Manual III, Intrefaces Guide, 2007.
Third Conference on CLIPS Proceedings (Electronic Version), 1994.
http://www.cis.ysu.edu/~john/824/examples.html
http://clipsinterface.sourceforge.net/WebCLIPS/wchowto.htm
http://sourceforge.net/projects/clipsinterface/
http://www.cse.scitech.ac.uk/arc/CLIPS/clips_doc/index.html
http://www.wtec.org/loyola/kb/c1_s1.htm
http://www.kbsc.com/rulebase.html
http://iweb.tntech.edu/bhuguenard/ds6530/ClipsTutorial/CLIPS%20tutorial
%202.htm

37

You might also like