85-411/711 Cognitive Processes and Problem Solving Homework #3 Handed out: 9/12/00 Due: 9/19/00 A. Reading. Read the first three chapters of "Rule-based Programming with OPS5" by Cooper & Wogrin. Photocopies of the chapters are on reserve in Hunt library, and with Janet Hilf in BH339. You will find the assignment quite difficult without reading the chapters first. B. Starting up the simulation. 1. Copy the OPS5.sea file from the Homework #3 folder on the server to your local hard disk. 2. Extract the files from the archive by double-clicking on the OPS5.sea file. Hit return and it will automatically create the files. 3. Start-up OPS5 by double-clicking on the OPS5 program. 4. Now you are in the Lisp environment, in which the OPS5 program was developed. Always hit return after entering a statement in the listener. Remember to type the parentheses as well. All commands in Lisp are surrounded by parentheses. If your session goes awry, quit Lisp and begin again. If you continue to have problems, don't hesitate to come see me (BH455B) or send e-mail to (kenkwok@cmu.edu). 5. Load the move-pattern strategy rules. Choose the "Load" option in the "Eval" menu. In the dialog window, scroll the window until you can see the "move-pattern.ops" file. Double-click on "move-pattern.ops." C. Running the simulation. 1. Enter (ppwm) This command prints all the working memory elements (wme's). At this point, there should be only one: (start) 2. Enter (watch 0) This command will turn printing of production firings off. 3. Enter (run) 4. When asked how many disks, enter 3 The program will print each move it does. Follow these moves to make sure that they are legal and that they solve the puzzle. 5. Enter (remove-all) to remove all the wme's. 7. Enter (make start) to set the condition for a new run. You will need to enter these two statements every time you want to start a new run of the program. 8. Enter (run) and use 4 disks this time. Follow the moves for the four-disk puzzle. 9. Enter (remove-all) and (make start). 10. Enter (watch 1). This statement sets the debugging level. Now, whenever a production fires, OPS will print the production. To turn off this debugging, type (watch 0). (watch 2) will trace WMEs entered and removed from memory. 11. Enter (run), use 3 disks, and look at the productions fired. You can see the definition of the productions by opening the file "move-pattern.ops." In LISP, you can see the definition of a production by using the pprule command. For example, (pprule 'startup) will print the definition of the production "startup." Remember to put the apostrophe before the rule name. 12. Run the program a few more times (with 3 or 4 disks) until you understand how it works. Don't worry too much about the OPS-5 syntax. Just try to understand what each rule accomplishes and why it is needed. The comments in the "move-pattern.ops" file should help. D. Questions about the move-pattern simulation 1. OPS5 working memory elements really consist of items that we would consider to be in working memory as well as items that would be in external memory. For example, the "peg" statements represent the state of the world and can be thought of as external memory. Run the simulation on a 3-disk puzzle and allow 9 rules to fire: (run 9). Then enter (ppwm) to print the WMEs. Which WMEs represent items in psychological working memory? Which others are parts of external memory? 2. If a subject was interrupted at this point (after 9 rule firings), what would happen? Suppose the subject forgot whether he was on an even or an odd move. Simulate this by changing the move parity: Type (ppwm) and record the number of the move-parity WME. Type (remove n), where 'n' is the number of the move-parity WME. Type (make move-parity ^value odd) to set the parity to odd (it should have been even) Type (ppwm) to look at the results. Working memory should be the same, except that the parity is now different. Run ten rule firings from this point by typing (run 10). What happens? Restart the simulation and try this again, modifying different elements or interrupting after different numbers of rule firings. Discuss the kinds of errors produced. It is possible for the system to get into an "infinite loop." To stop it, hold down the command key (the one with the apple) and type the period. 3. Enter the following rule in the Listener window: (p startup (start) --> (make peg ^name A ^disk-list 3) (make peg ^name B ^disk-list 2) (make peg ^name C ^disk-list 1) (make smallest-moves-to ^position 0) (make move-parity ^value odd) (make set-smallest-order ^disk-parity 1)) NOTE: Be sure to type (remove-all) and (make start) after entering the new startup rule, but before moving on. This changes the rule STARTUP so that the problem uses three disks and starts with disk 3 on peg A, disk 2 on peg B and disk 1 on peg C. You can see this by typing (run 1) and then (ppwm). Why is it that the system canít solve the task? Change the STARTUP rule so that the program works (an acceptable answer does NOT involve changing the STARTUP rule back to its original state).