CLIPS (C Language Integrated Production System)
CLIPS is a freely available expert system shell that has been implemented in C.
It provides a language for expressing rules and mainly uses forward chaining to derive conclusions from a set of facts and rules.
The notation used by CLIPS is very similar to that used by LISP. The following is an example of a rule specified using CLIPS:
(firstname ?r1 John)
(surname ?r1 Smith)
(haircolor ?r1 Red)
(assert (is-boss ?r1)))
?r1 is used to represent a variable, which in this case is a person.
Assert is used to add facts to the database, and in this case the rule is used to draw a conclusion from three facts about the person:
If the person has the first name John, has the surname Smith, and has red hair, then he is the boss.
This can be tried in the following way:
(assert (firstname x John))
(assert (surname x Smith))
(assert (haircolor x Red))
At this point, the command (facts) can be entered to see the facts that are contained in the database:
f-0 (firstname x John)
f-1 (surname x Smith)
f-2 (haircolor x Red)
f-3 (is-boss x)
So CLIPS has taken the three facts that were entered into the system and used the rule to draw a conclusion, which is that x is the boss.
Although this is a simple example, CLIPS, like other expert system shells, can be used to build extremely sophisticated and powerful tools.
For example, MYCIN is a well-known medical expert system that was developed at Stanford University in 1984.
MYCIN was designed to assist doctors to prescribe antimicrobial drugs for blood infections.
In this way, experts in antimicrobial drugs are able to provide their expertise to other doctors who are not so expert in that field. By asking the doctor a series of questions, MYCIN is able to recommend a course of treatment for the patient.
Importantly, MYCIN is also able to explain to the doctor which rules fired and therefore is able to explain why it produced the diagnosis and recommended treatment that it did.
MYCIN has proved successful: for example, it has been proven to be able to provide more accurate diagnoses of meningitis in patients than most doctors.
MYCIN was developed using LISP, and its rules are expressed as LISP expressions. The following is an example of the kind of rule used by MYCIN, translated into
IF the infection is primary-bacteria
AND the site of the culture is one of the sterile sites
AND the suspected portal of entry is the gastrointestinal tract
THEN there is suggestive evidence (0.7) that infection is bacteroid
The following is a very simple example of a CLIPS session where rules are defined to operate an elevator:
CLIPS> (defrule rule1
CLIPS> (defrule rule2
(assert (goto ?other_floor)))
CLIPS> (assert (elevator floor1))
==> f-0 (elevator floor1)
CLIPS> (assert (button floor3))
==> f-1 (button floor3)
==>f-2 (goto floor3)
The segments in bold are inputs by the knowledge engineer, and the plain text sections are CLIPS.
Note that ?floor_now is an example of a variable within CLIPS, which means that any object can match it for the rule to trigger and fire.
In our example, the first rule simply says: If the elevator is on a floor, and the button is pressed on the same floor, then open the door.
The second rule says: If the elevator is on one floor, and the button is pressed on a different floor, then go to that floor.
After the rules, two facts are inserted into the database. The first fact says that the elevator is on floor 1, and the second fact says that the button has been pressed on floor 3.
When the (run) command is issued to the system, it inserts a new fact into the database, which is a command to the elevator to go to floor 3.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.