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.

7. Knowledge Specification Language 88<br />

Terminating The Engine<br />

<strong>flex</strong> toolkit<br />

Termination conditions may be set for a particular ruleset using the KSL<br />

keywords<br />

terminate when<br />

followed by some conditions. This provides an alternative way of stopping<br />

the <strong>flex</strong> program: without termination conditions the forward chaining<br />

engine stops when no more rules can be fired.<br />

Examples<br />

Selecting Rules<br />

ruleset example_set4<br />

contains all rules ;<br />

terminate when condition1 and condition2 .<br />

This specifies that the forward chaining engine will stop when both<br />

condition1 and condition2 are satisfied (even if there are still some<br />

rules which could be fired).<br />

ruleset pack_shopping<br />

contains pack_small_items, pack_large_items ;<br />

terminate when the shopping is empty .<br />

This specifies that the forward chaining engine will stop when the value of<br />

shopping becomes empty.<br />

Normally <strong>flex</strong> will consider each rule in the order specified in the ruleset.<br />

However, a number of alternative rule selection criteria may be applied<br />

instead, using the KSL keywords<br />

select rule using.<br />

The default rule selection is first come first served, which<br />

considers rules in the order in which they are given and fires the first rule<br />

whose conditions are satisfied.<br />

ruleset example_set5<br />

contains all rules ;<br />

select rule using first come first served .<br />

The rule selected for each cycle is the first rule in the agenda whose<br />

conditions are satisfied. This is the default for selecting rules and is<br />

equivalent to omitting any rule selection criteria.<br />

Rules may be selected using conflict resolution. In this case an<br />

attempt is always made to use the “best” rule according to the scoring<br />

system built into the rules. Each rule should have a score associated with it,<br />

and the conflict resolution system then fires the rule whose conditions are

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

Saved successfully!

Ooh no, something went wrong!