HT Tutorial Exercise 4 - Eating


Before altering Soar code, if you are using Word as your editor you may wish to consult PST Mac help.

Note that Soar uses LISP-like comment characters. As you read code you may notice that single line comments are prefaced with semi-colons, and blocks of comments are prefaced with a sharp and bar and end with a bar and sharp. Such material is ignored by Soar.

Changing the initial state

Open the file ht.s7 in your editor, and examine the production rules that make up the eat and drink operators. (Its directory will appear in the link above.) Modify the last clause in ht*propose-space*ht from (<s> ^thirsty yes ^hungry yes) to (<s> ^thirsty yes ^hungry no)

by cutting the production and then pasting it at the Soar prompt, changing the initial state before hitting return. This will reload the production, overwriting the previous version. Now, when the model is run the drink operator could apply, but doesn't because the desired state has been found, that is, to not be hungry (this is also shown in Trace 4).

Examining preferences

There is a command that summarises the preferences for objects attached to the state.
preferences <state> context-object gives a listing of preferences.
preferences s1 operator
would be a typical version that you might type. You can then run the problem on the four different initial states (yes yes; yes no; no yes; no no) that are possible, examining for yourself the preferences the model has in terms of eating and drinking. You should try this for S1, and another object, such as an operator.

Follow up questions


Return to main page of: Introduction to Psychological Soar Tutorial
(or use the Back button to return to where you just were).
Program Listing
PST Soar Help