24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. Forward Chaining 33<br />

can give the rule a dynamic score.<br />

rule empty_master_into_slave<br />

if the master is not empty<br />

and<br />

the slave`s contents<br />

> the master`s spare_capacity<br />

then fill_from( master, slave )<br />

score master`s contents plus slave`s contents .<br />

As the contents of the two vessels change, so the weighting of this rule also<br />

changes. We could even give the system a sense of chance by using randomvalued<br />

scores.<br />

Attaching Explanations to Rules<br />

The final part of a production rule in <strong>flex</strong> involves the attachment of an<br />

optional explanation to rules. This is used to explain why a rule was fired.<br />

The explanation itself can either be some canned text or a pointer to a disk<br />

file accessed at run-time through a file browser.<br />

When explaining the rule either the canned text is displayed on screen or<br />

the user is allowed to browse through the file.<br />

rule 'check status'<br />

if the applicant`s job is officer<br />

and the applicant`s age is greater than 65<br />

then ask_for_grading<br />

because The job grading affects the pension .<br />

The above rule will cause the single line of text The job grading<br />

affects the pension to be displayed on the screen whenever an<br />

explanation is requested.<br />

The latter alternative allows for a more <strong>flex</strong>ible explanation facility. Indeed,<br />

the only purpose of the rule-based system might be as an intelligent link into<br />

the file browsing system. Such applications include the reviewing of<br />

technical manuals, especially medical journals.<br />

rule 'check status'<br />

if the applicant`s job is principal<br />

and the applicant`s age is greater than 65<br />

then check_principal_function<br />

browse file status .<br />

The Forward Chaining Engine<br />

The forward chaining engine is implemented as a Prolog program. The<br />

emphasis of the implementation is placed upon simplicity coupled with great<br />

<strong>flex</strong>ibility, rather than extracting the highest possible performance.<br />

<strong>flex</strong> toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!