HT Tutorial Exercise 4 - Eating


This exercise involves altering the rules in file hts9.soar. Before you start, make a copy of the file -- for example by clicking on the filename just given, and using the Save As... facility of your browser -- and call it something like "myhts9.soar". (If you have difficulty locating the file in the directory structure with your editor, watch what file name your browser shows when you move the mouse over the "ht.s9" above.) If you are using Word as your editor you may wish to consult PST Mac help.

Note that comments in Soar outside of rules consist of a '#' placed where a command (like sp or watch) would otherwise be. Everthing from the # to the end of the line is ignored. (Within rules, the comment character is a semicolon ';'. )

Changing the initial state
Open file "myhts9.soar" (or whatever you have called it) in your editor, and examine the production rules that make up the eat and drink operators. Modify the last clause in ht*propose-space*ht from (^thirsty yes ^hungry yes) to ( ^thirsty yes ^hungry no)

by changing the production in the file, Copying it, Pasting it at the Soar prompt, and hitting return. This will reload the production, overwriting the previous version of the production. Now, when the model is run the drink operator could apply, but doesn't because the desired state has been found, that is, the desired state to be not 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.
For example, preferences s1 operator (or just preferences )
would be a typical version that you might type. Try several and read the documentation.

You can then run the problem on the four different initial states that are possible (yes yes; yes no; no yes; no no), examining for yourself the preferences the model has in terms of eating and drinking. You should look at the preferences for state S1, and another object, such as an operator.


Follow up questions
  1. Do productions map one-to-one onto operators? That is, does every production apply to an operator and only one operator?


  2. Do operators map one-to-one onto productions? That is, does every operator have a production and only one production?


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