24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11. Example – Robbie Goes Shopping 158<br />

The Shopping Question<br />

To obtain the initial shopping list, we ask the user to choose some items<br />

from the range of goods available.<br />

It is convenient to group the goods under a single name which may then be<br />

referenced by a question.<br />

group goods<br />

bread, butter, coffee, ice_cream, crisps,<br />

salted_peanuts, beer, lemonade, washing_powder .<br />

The following question may then be written.<br />

question shopping<br />

What is on your shopping list today ? ;<br />

choose some of goods<br />

because I must know your choice to continue .<br />

The first line of the question is the actual text to be displayed when the<br />

question is asked.<br />

The second line indicates that the question will take the form of a multiplechoice<br />

menu containing all the items in the group goods.<br />

The third line contains the text to be displayed if the user enquires why the<br />

question is being asked.<br />

The Compatibility Rules<br />

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

Having obtained the initial shopping list from the user, we will use forward<br />

chaining rules to check the compatibility of the items on the initial shopping<br />

list to create the final shopping list.<br />

The set of goods needs to be differentiated further in the terms of the<br />

compatibility criteria, i.e. if there are snacks on the shopping list then there<br />

must also be a drink.<br />

For convenience we define the two groups for snacks and drinks.<br />

group snacks<br />

crisps, salted_peanuts .<br />

group drink<br />

lemonade, beer .<br />

We can now write the rules for the compatibility checks.<br />

We need a rule to ensure that if the shopping includes some snacks there is

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

Saved successfully!

Ooh no, something went wrong!