CLIPS , (from the English C Language Integrated Production System ) - software environment for the development of expert systems . The syntax and name was proposed by Charles Forgy in OPS ( Official Production System ). The first versions of CLIPS were developed since 1984 at Johnson Space Center , NASA (as an alternative to the then existing ART * Inference system ), until funding was suspended in the early 1990s , and NASA was forced to buy commercial products.
CLIPS is a production system . The output implementation uses the Rete algorithm .
The main idea is to present knowledge in the form of this form:
Rule 1:
IF A
(conditions 1 are satisfied)
THEN
(complete steps1)
Rule 2:
IF A
(conditions 2 are satisfied)
THEN
(follow steps 2)
...
Such a representation is close to human thinking and differs from programs written in traditional algorithmic languages, where actions are ordered and performed strictly adhering to the algorithm.
CLIPS is one of the most widely used tool environments for developing expert systems due to its speed, efficiency and free of charge. As a public domain , it is still being updated and maintained by its original author, Gary Riley.
CLIPS includes a complete object-oriented language COOL for writing expert systems. Although it is written in C , its interface is much closer to the LISP programming language. Extensions can be created in C, in addition, CLIPS can be integrated into C programs [1] .
CLIPS is designed to be used as forward chaining language and in its original version does not support backward chaining.
Like other expert systems, CLIPS deals with rules and facts.
Content
Facts
The information on the basis of which the expert system makes a logical conclusion is called facts . There are 2 kinds of facts in CLIPS: ordered and boilerplate . Template facts have a template defined by the deftemplate construct. Ordered do not have an explicit deftemplate construct, however it is implied. A template fact resembles a structure in C or a record in Pascal; fields are called slots and are declared by the slot construct. For example, the following template declares a template named cars and fields: model , color, and number .
(deftemplate cars
(slot model)
(slot color)
(slot number)
)
Facts are stored in working memory. New facts are put into working memory by the assert command. For example, the following command
(assert (cars))
will add an ordered fact cars to working memory.
The following command will place a factual fact with three attributes.
(assert
(cars
(model "Audi")
(color "Black")
(number "WY 2576")
)
)
CLIPS does not allow facts with the same slot values to be stored in the working memory, although, if necessary, this can be enabled by the corresponding setting.
Rules
Domain knowledge is presented in CLIPS as rules , which have the following structure:
(conditions) {synonyms: antecedents in logic,
left side - LHS in terms of CLIPS}
=>
(actions) {synonyms: consequents in logic,
right side - RHS in terms of CLIPS}
The left side of the rule is the condition for its operation, and the right side is the actions that must be performed if the conditions are met. Sign => special character separating LHS and RHS.
Rules are declared using the defrule command . Example rule:
(defrule search-black-audi
(cars (model "Audi") (color Black))
=>
(printout t "Have a black Audi!" crlf)
)
This rule is activated when a fact with attributes (model “Audi”) and (color Black) appears in the working memory.
Activation of a rule does not mean its implementation. Activating a rule is putting a rule in the rules worklist or agenda in CLIPS.
In order for the activated rules to be executed, you need to run the (run) command.
Inference Machine
The process of placing the rules in the worklist and their implementation is controlled by a logical inference machine (MLV). MLV responds to certain events:
| Event | Act |
|---|---|
| FACING FACTS IN WORKING MEMORY | 1) Comparison of facts with rules from the knowledge base 2) Match facts with rules from the rules worklist |
| DELETING FACTS FROM WORKING MEMORY | 1) Comparison of facts with rules from the knowledge base 2) Match facts with rules from the rules worklist |
| WHEN COMPARING, FOUND THE RULES RELATED TO THE FACTS FROM WORKING MEMORY | Putting the rules found in the rules worklist |
| NEW RULES ADDED TO WORK LIST OF RULES | rule worklist is sorted according to the selected conflict resolution strategy |
| WHEN COMPARING FACTS WITH A WORKING LIST OF RULES, INACTIVE RULES ARE DETECTED | Irrelevant rules (conditions do not satisfy the facts) are removed from the worklist |
| RUNNING TEAM (RUN) | The actions (right side) of the first rule in the worklist are performed. |
| WORK LIST OF RULES BECAME EMPTY | Worklist rules execution stops |
Conflict Resolution Strategies
A person can not always set complete conditions that would satisfy reality. There is a legend according to which Diogenes of Sinopsky, according to Plato’s definition “A man is an animal with two legs, devoid of feathers”, plucked a chicken and brought it to school, announcing: “Here is a Platonic man!” To which Plato was forced to add “... and with wide nails. " When rules appear in the knowledge base that satisfy the facts, but perform opposite actions, a conflict of rules arises. For example, there are two rules:
1. (If a person pushed another person - punish a person for hooliganism)
2. (If a person pushed another person who was driving a truck - reward the person for saving his life)
These two rules will conflict with each other. The first rule is more general and it is always activated if the second is activated. But the first rule should be executed first. CLIPS has several strategies for resolving such conflicts. But even if it is not possible to choose a suitable strategy for all cases, then you can specify the priorities of the rules. Rules with high priority will be executed first.
Various facts may make the rule applicable. The applicable rule is then allowed ( assert ). Facts and rules are created by a preliminary announcement, as shown in the example:
(deffacts trouble_ooting
(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))
)
CLIPS Versions
CLIPS descendants are the following languages and environments:
- Jess is a commercial CLIPS follower, available for free for academic use, rewritten in Java , and later developed in other directions. Supports reverse output.
- HaleyRules Eclipse is the HaleyRules rule language of Haley Systems. Supports reverse output. The project was closed after Oracle acquired Haley Systems in December 2009 in favor of Oracle Policy Automation [2] .
- FuzzyCLIPS - CLIPS with the addition of the concept of relevancy to the language. Doesn't support reverse output.
- EHSIS - Spanish CLIPS, developed in the Erabaki group of the Faculty of Informatics of the University of the Basque Country. Supports fuzzy logic like FuzzyCLIPS [3] .
- CLIPS / R2 is a new version from Production Systems Technologies, backward compatible with the standard CLIPS versions 6.x, but with the addition of the Rete II algorithm , support for reverse output, and transparent support for C language structures and C ++ classes.
Existing CLIPS versions for Windows (clipswin.exe) do not support Cyrillic (the console version of CLIPS clipsdos.exe only supports Cyrillic in UTF-8 format). It is the lack of full support for the Cyrillic alphabet that is the main reason for the weak distribution of CLIPS in Russia. At the same time, the open source CLIPS code can fix this situation. In particular, when compiling from source, it is possible to patch them by adding support for koi8-r or ansi1251 [4] .
The latest version is CLIPS 6.3, released March 17, 2015.
See also
- Prologue
- Refal
- Lisp
- Jess
- Cubicalc
- PowerSim
Notes
- ↑ On Windows, programs written in other languages can use the CLIPSWin32.DLL dynamic link library.
- ↑ Siebel Essentials: Bye bye Haley, hello OPA! Archived May 12, 2014.
- ↑ Translation error (inaccessible link)
- ↑ Instructions for connecting support for Russian encodings
Links
- Project page
- What is CLIPS - a project description at SourceForge
- CLIPS expert system - candidate for the core diagnostic system
- Usenet thread discussing the earliest CLIPS history
- RuleWorks Knowledge Based Systems - Programming Expert Systems Using Rules
- Managed C ++ .NET Framework CLIPS port
- a page with links on the topics of Clips and artificial intelligence in general (contains, among other things, Clips modes for Emacs)
- CLIPSEditor - editor for CLIPS
- graph at the end Haley / ART syntax lives on in open-source Java rules - Intersection diagram of various production systems
- What rule engine should I use? opinions on various production systems
Literature
- Joseph Jarratano, Gary Riley. “Expert Systems: Principles of Development and Programming” = Expert Systems: Principles and Programming. - M .: "Williams" , 2007. - 1152 p. - ISBN 978-5-8459-1156-8 .
- Chastikov A. P., Gavrilova T. A., Belov D. L. “Development of expert systems. CLIPS environment. ” - SPb. : “BHV-Petersburg” , 2003. - 608 p. - ISBN 5-94157-248-4 .