Home

The Soar User`s Manual Version 8.2

image

Contents

1. Timetags Acceptable preferences in w orking memory W orking Memory as a Graph Preference Memory 0 Pro duction Memory 0 Pro duction Names Do cumen tation string optional Pro duction t yp e optional Commen ts optional The condition side of pro ductions or LHS Conditions V ariables in pro ductions Predicates for v alues Disjunctions of v alues Conjunctions of v alues
2. The six op erators prop osed for the initial state of the blo c ks w orld eac h mo v e one blo c k to a new lo cation The problem space in the blo c ks w orld includes all op erators that mo v e blo c ks from one lo cation to another and all p ossible congurations of the three blo c ks An abstract view of pro duction memory The pro ductions are not related to one another A detailed illustration of Soar s decision cycle out of date A simplied v ersion of the Soar algorithm 0 A simplied illustration of a subgoal stac k A seman tic net illustration of four ob jects in w orking memory An example pro duction from the example blo c ks w orld task An example p ortion of the input link for the blo c ks w orld task An example p ortion of the output link for the blo c
3. W atc hing Pro ductions W atc hing w orking memory elemen ts W atc hing learning W atc hing other functions Conguring Soar s Run time P arameters explain backtraces indifferent selection learn max chunks max elaborations multi attributes o support mode save backtraces soar8 0 waitsnc File System I O Commands
4. command to file Directory F older functions chdir cd dirs popd pushd pwd topd 0 echo 0 log output strings destination rete net source Soar I O Commands add wme io Adding I O functions Deleting I O functions Listing I O functions remove wme Miscellaneous CONT
5. run sp 0 stop soar Examining Memory gds print internal symbols matches 00 Prin ting the matc h set 0 Prin ting partial matc hes for pro ductions 0 memories 0 preferences 0 print 0 Prin ting items in pro duction memory 0 Prin ting items in w orking memory 0 Prin ting the curren t subgoal stac k prod
6. Negated conditions Negated conjunctions of conditions Multi v alued attributes Acceptable preferences for op erators 0 0 A ttribute tests A ttribute path notation Structured v alue notation The action side of pro ductions or RHS V ariables in Actions Creating W orking Memory Elemen ts Remo ving W orking Memory Elemen ts 0 The syn tax of preferences 0 Shorthand notations for preference creation Righ thand side F unctions Stopping and pausing Soar T ext input and output Mathematical functions 0 Generating and manipulating sym b ols
7. Tcl functions as RHS actions Con trolling learning Impasses in W orking Memory and in Pro ductions Impasses in w orking memory T esting for impasses in pro ductions 0 Soar I O Input and Output in Soar 0 CONTENTS iii Ov erview of Soar I O Input and output in w orking memory Input and output in pro duction memory Learning Ch unk Creation Determining Conditions and Actions Determining a c h unk s actions T racing the creation and reference of w orking memory elemen ts Determining a c h unk s conditions 0 V ariablizing Iden tiers Ordering Condit
8. bottom block lt gt lt thing gt gt lt s gt operator lt o gt lt o gt name move block you can also use in line comments moving block lt thing gt destination lt thing gt When commen ting out conditions or actions b e sure that all paren theses remain balanced outside the commen t External commen ts Commen ts ma y also app ear in a le with Soar pro ductions outside the curly braces of the sp command Commen ts m ust either start a new line with a or start with In b oth cases the commen t runs to the end of the line imagine that this is part of a Soar program that contains Soar productions as well as some other code source blocks soar this is also a comment The condition side of pro ductions or LHS The condition side of a pro duction also called the left hand side or LHS of the pro duction is a pattern for matc hing one or more WMEs When all of the conditions of a pro duction matc h elemen ts in w orking memory the pro duction is said to b e instan tiated and is ready to p erform its action The follo wing subsections describ e the condition side of a pro duction including predi CHAPTER THE SYNT AX OF SO AR PR OGRAMS cates disjunctions co
9. CONFIGURING TRA CE INF ORMA TION AND DEBUGGING action eect on the Soar trace add filter add a lter to prin t wmes that meet the typ e and p attern criteria remove filter delete lters for prin ting wmes that matc h the typ e and p attern criteria list filter list the lters of this typ e curren tly in use do es not use p attern arg reset filter delete all lters of this typ e do es not use p attern arg The typ e argumen t is one of typ e eect on the Soar trace adds prin t info when WME is adde d removes prin t info when WME is r etr acte d both prin t info when WME is added or retracted The add filter and remove filter argumen ts also require a p attern to sp ecify whic h WMEs are of in terest The p attern tak es the form fid g fattribute g fvalue g where is a wildcard that matc hes an y string F or an y giv en p attern a w orking memory elemen t m ust matc h exactly for the watch command to prin t an y information Only constan ts and pre existing iden tiers are ma y b e sp ecied in the p attern This command is somewhat fragile Examples Users can watch an attribute of a particular ob ject as long as that ob ject already exists soar gt watch wmes a
10. In our blo c ks w orld example the second case holds and Soar can select one of the op erators at random Applying the op erator An op erator applies b y making c hanges to the state the sp ecic c hanges that are appropriate dep end on the op erator and the curren t state There are t w o primary approac hes to mo difying the state indirect and direct Indir e ct c hanges are used in Soar programs that in teract with an external en vironmen t The Soar program sends motor commands to the external en vironmen t and monitors the external en vironmen t for c hanges The c hanges are reected in an up dated state description garnered from sensors Soar ma y also mak e dir e ct c hanges to the state these corresp ond to Soar doing problem solving in its head Soar programs that do not in teract with an external en vironmen t can mak e only direct c hanges to the state In ternal and external problem solving should not b e view ed as m utually exclusiv e activities in Soar Soar programs that in teract with an external en vironmen t will generally ha v e op erators that mak e direct and indirect c hanges to the state The CHAPTER THE SO AR AR CHITECTURE motor command is represen ted as substructur
11. CHAPTER THE SYNT AX OF SO AR PR OGRAMS This pro duction tests that there is acceptable op erator that is trying to group blo c ks according to some attribute lt a gt and that blo c k lt t gt and lt t gt b oth ha v e this at tribute whatev er it is and ha v e the same v alue for the attribute Predicates in attributes Predicates ma y b e used with attributes as in sp blocks example production co ndit ions state operator lt o gt table lt t gt lt t gt lt gt type table gt whic h tests that the ob ject with its iden tier b ound to lt t gt m ust ha v e an attribute whose v alue is table but the name of this attribute is not type Disjunctions of attributes Disjunctions ma y also b e used with attributes as in sp blocks example production co ndit ions state operator lt o gt table lt t gt lt t gt lt lt type name gt gt table gt whic h tests that the ob ject with its iden tier b ound to lt t gt m ust ha v e either an attribute type whose v alue is table or an attribute name whose v alue is table Conjunctiv e tests for attributes Section illustrated the use of conjunctions for the v alues in conditions Con junctiv e tests ma
12. The sp command prin ts one asterisk for eac h pro duction successfully loaded in to pro duction memory and one p ound sign for eac h pro duction redened excised and loaded The prin ting of asterisks and p ound signs ma y b e turned o b y using the watch command this is describ ed in Section on 0 stop soar self reason string The stop soar command stops an y running Soar agen ts It sets a ag in the Soar k ernel so that Soar will stop running at a safe p oin t and return con trol to the user This op erates exactly as if the user had issued a con trol C SIGINT in terrupt to the Soar pro cess or Soar had issued a RHS interrupt action It causes all curren tly running Soar in terpreters to stop If the argumen t self is sp ecied only the Soar agen t that issued the command is in terrupted all other agen ts con tin ue running An optional r e ason string follo wing self will b e prin ted when Soar is stopp ed to indicate wh y it w as stopp ed If left blank no message will b e prin ted when Soar is stopp ed A common use of this command is as an action resulting from a button press on a Graphical User In terface GUI or as a monitor to b e executed at a sp ecic Soar
13. instan tiation that created it test augmen tations of the curren t op erator When pro ductions are matc hed all pro ductions that ha v e their conditions met re creating or remo ving w orking memory elemen ts Also w orking memory elemen ts and preferences that lose I supp ort are remo v ed from w orking memory Th us sev eral new w orking memory elemen ts and preferences ma y b e created and sev eral existing w orking memory elemen ts and preferences ma y b e remo v ed at the same time Of course all this do esn t happ en literally at the same time but the order of rings and retractions is unimp ortan t and happ ens in parallel from a functional p ersp ectiv e CHAPTER THE SO AR AR CHITECTURE Preference memory Selection Kno wledge The selection of the curren t op erator is determined b y the pr efer enc es in pr efer enc e memory Preferences are suggestions or imp erativ es ab out the curren t op erator or information ab out ho w suggested op erators compare to other op erators Preferences refer to op erators b y using the iden tier of a w orking memory elemen t that stands for the op erator After preferences ha v e b een created for a state the decision pro cedures ev aluates them t
14. the pro duction If the v ariable w ere the same the pro duction w ould create a link in to the structure of the input link rather than cop y the information The attributes x location and y location are assumed to b e v alues and not iden tiers so the same v ariable names ma y b e used to do the cop ying A pro duction that creates wmes on the output link for the blo c ks task migh t lo ok lik e this SO AR I O INPUT AND OUTPUT IN SO AR sp blocks world apply move b loc k se nd o utpu t c omma nd state lt s gt operator lt o gt io output link lt out gt lt o gt name move block moving block lt b gt destination lt b gt lt b gt x location lt x gt y location lt y gt lt b gt x location lt x gt y location lt y gt gt lt out gt move block lt b gt x destination lt x gt y destination lt y gt This pro duction w ould create substructure on the output link that the output func tion could in terpret as b eing a command to mo v e the blo c k to a new lo cation CHAPTER THE SYNT AX OF SO AR PR OGRAMS Chapter Learning Ch unking is Soar s learning mec hanism the sole learning mec hanism in Soar Ch unk ing creates pro ductions called chunks that summarize the pr
15. Eac h time an op erator is selected the curren t state is also prin ted so users can see what mo dications the previous op erator made to the state monitor action The monitor command manages the attac hmen t of Tcl scripts to sp ecic Soar ev en ts Soar ev en ts are imp ortan t ev en ts that o ccur in Soar throughout the execution cycle Scripts can b e attac hed to these Soar ev en ts so that they are in v ok ed ev ery time the Soar ev en t o ccurs These scripts can also b e remo v ed using the monitor command The status of attac hmen ts can also b e listed and tested If a new attac hmen t is created its id is returned as the result of this command This id is used when deleting a sp ecic script from an ev en t The monitor command is particularly useful when Soar m ust in teract with an external en vironmen t but this is considered an adv anced usage and is not within the scop e of this man ual A more detailed description of the use of the monitor command and sp ecic useful examples are giv en in the So ar A dvanc e d Applic ations Manual The monitor command m ust b e follo w ed b y a sp ecic action whic h m ust ha v e one of the follo wing forms add so ar event script
16. The all levels and bottom up ags are orthogonal to the on except only and off ags and so ma y b e used in com bination with them Recall from Chapter CHAPTER THE SO AR USER INTERF A CE that with b ottom up learning c h unks are learned only in states in whic h no subgoal has y et generated a c h unk In this mo de c h unks are learned only for the b ottom of the subgoal hierarc h y and not the in termediate lev els With exp erience the subgoals at the b ottom will b e replaced b y the c h unks allo wing higher lev el subgoals to b e c h unk ed Learning can b e turned on or o at an y p oin t during a run Example soar gt learn on soar gt learn Current learn settings on all levels max chunks n The max chunks command is used to limit the maxim um n um b er of c h unks that ma y b e created during a decision cycle The initial v alue of this v ariable is 0 allo w able settings are an y in teger greater than 0 The c h unking pro cess will end after max chunks c h unks ha v e b een created even if ther e ar e mor e r esults that have not b e en b acktr ac e d thr ough to cr e ate chunks and Soar will pro ceed to the next phase A w arning m
17. The sp ecic commands describ ed in this section are Summary gds prin t Prin t the WMEs in the goal dep endency set for eac h goal in ternal sym b ols Prin t information ab out the Soar sym b ol table matc hes Prin t information ab out the matc h set and partial matc hes memories Prin t memory usage for pro duction matc hes preferences Examine items in preference memory prin t Prin t items in w orking memory or pro duction memory pro duction nd Find pro ductions that con tain a giv en pattern default wme depth Set the lev el of detail used to prin t WME s wmes An alias for the prin t command prin ts items in w orking memory Of these commands print is the most often used and the most complex follo w ed b y matches and memories preferences is used to examine whic h candidate op era tors ha v e b een prop osed production find is esp ecially useful when the n um b er of pro ductions loaded is high gds print is useful for examining the goal dep endecy set when subgoals seem to b e disapp earing unexp ectedly default wme depth and wmes are b oth related to the print command internal symbols is not often used but is helpful when debugging Soar extensions or trying to l
18. When the v alue is an iden tier it refers to an ob ject in w orking memory that ma y ha v e additional substructure In seman tic net terms if a v alue is a constan t then it is a terminal no de with no links if it is an iden tier it is a non terminal no de W orking memory is a set whic h means that there can nev er b e t w o elemen ts in w orking memory at the same time that ha v e the same iden tier attribute v alue triple this is prev en ted b y the arc hitecture Ho w ev er it is allo w ed to ha v e m ultiple w orking memory elemen ts that ha v e the same iden tier and attribute but that eac h ha v e dieren t v alues When this happ ens w e sa y the attribute is a multi value d attribute whic h is often shortened to b e multi attribute An ob ject is in a sense dened b y its augmen tations and not b y its iden tier On subsequen t runs of the same Soar program there ma y b e an ob ject with exactly the same augmen tations but a dieren t iden tier and the program will still reason ab out the ob ject appropriately Iden tiers are in ternal mark ers for Soar so they can app ear in w orking memory but they nev er app ear in a pro duction There is no predened
19. consists of individual actions that can Add new elemen ts to w orking memory Remo v e elemen ts from w orking memory Create preferences P erform other actions When the conditions of a pro duction matc h w orking memory the pro duction is said to b e instan tiated and the pro duction will re during the next elab oration cycle Firing the pro duction in v olv es p erforming the actions using the same variable bindings that formed the instan tiation PR ODUCTION MEMOR Y V ariables in Actions V ariables can b e used in actions A v ariable that app eared in the condition side will b e replaced with the v alue that is w as b ound to in the condition A v ariable that app ears only in the action side will b e b ound to a new iden tier that b egins with the rst letter of that v ariable e g lt o gt migh t b e b ound to o This sym b ol is guaran teed to b e unique and it will b e used for all o ccurrences of the v ariable in the action side app earing in all w orking memory elemen ts and preferences that are created b y the pro duction action Creating W orking Memory Elemen ts An elemen t is created in w orking memory b y sp ecifying it as an action Multiple augmen
20. ecs dc wme change count all productions count wme addition count chunk production count wme removal count default production count wme count justification count wme avg count user production count wme max count If Soar has b een compiled with the NO TIMING STUFF not set then the follo wing statistics are also a v ailable with the system argumen t ms dc ms ec ms firing total time If Soar has b een compiled with the DETAILED TIMING STATS set to TRUE then the follo wing statistics are also a v ailable in the system mo dule chunking time match time ms wme change ownership time The standard distributions of Soar ha v e b een compiled to include all the ab o v e statis tics b y default Example soar gt stats Soar on ledoux ummu umich edu at Thu May 0 productions default user 0 chunks justifications Derived Phases Input DLP Pref W M Output Decision Totals Kernel 0 00 0 00 0 0 0 0 00 0 0 0 Detailed Timing Statistics Match 0 00 0 00 0 000 0 0 0 000 0 00 0 0 CHAPTER THE SO AR USER INTERF A CE Own ship 0 000 0 000 0 000 0 000 0 000 0 000 0 000 Chunking 0 000
21. id Add the script to the list of scripts to b e in v ok ed when the so ar event o ccurs during execution See b elo w for CONFIGURING TRA CE INF ORMA TION AND DEBUGGING a list of v alid Soar ev en t names If the id is giv en it is used to name the attac hmen t If no id is giv en then a unique id is generated and returned delete so ar event id Remo v e scripts attac hed to so ar event The so ar event m ust matc h a v alid Soar ev en t name see b elo w If id is giv en after a soar ev en t then only that particular attac hmen t is remo v ed Otherwise all attac hmen ts under so ar event are remo v ed list F or ev ery Soar ev en t list the attac hed scripts test T est the script attac hmen t pro cess b y attac hing a script to prin t a message to ev ery Soar ev en t clear Remo v e al l attac hed scripts from ev ery Soar ev en t Soar Ev en ts The monitor command utilizes the Soar callbac k system whic h can asso ciate Tcl or C functions with Soar ev en ts The p ermissable Soar ev en t names for use with monitor listed in the follo wing table CHAPTER THE SO AR USER INTERF A CE Ev en t name Description after init agent An agen t has just b een c
22. lt gt _ Other c haracters suc h as blank spaces can b e included b y surrounding the complete constan t name with v ertical bars This is a constant The v ertical bars aren t part of the name they re just notation A v ertical bar can b e included b y prefacing it with a bac kslash inside surrounding v ertical bars Odd symbol name Iden tiers should not b e confused with constan ts although they ma y lo ok the same iden tiers are generated b y the Soar arc hitecture at run time and will not necessarily b e the same for rep eated runs of the same program Constan ts are sp ecied in the Soar program and will b e the same for rep eated runs Ev en when a constan t lo oks lik e an iden tier it will not act lik e an iden tier in terms of matc hing A constan t is prin ted surrounded b y v ertical bars whenev er there is a p ossibilit y of confusing it with an iden tier G is a constan t while G is an iden tier T o a v oid p ossible confusion y ou should not use letter n um b er com binations as constan ts or for pro duction names Ob jects Recall from Section that all WME s that share an iden tier are collectiv ely called an obje ct in w orking memory The individual w
23. lt lt A B C gt gt Example Pro duction F or example the third condition of the follo wing pro duction con tains a disjunction that restricts the color of the table to red or blue sp blocks example production co ndit ions state operator lt o gt table lt t gt lt o gt name move block lt t gt type table color lt lt red blue gt gt gt PR ODUCTION MEMOR Y Note Disjunctions of complete conditions are not allo w ed in Soar Multiple similar pro ductions fulll this role Conjunctions of v alues A test for an iden tier attribute or v alue in a condition ma y include a conjunction of tests all of whic h m ust hold for there to b e a matc h Syn tactically conjuncts are con tained within curly braces i e f and g The follo w ing table sho ws some examples of legal and illegal conjunctiv e tests Legal conjunctions Illegal conjunctions f lt lt a gt gt lt b gt g f lt x gt lt lt a gt lt b gt g f lt x gt gt lt y gt g f gt gt lt b gt g f lt gt lt x gt lt y gt g f lt lt A B C gt gt lt x gt g f lt gt lt x gt gt lt y gt lt lt gt gt lt z gt g Because those examples are a bit dicult to in terpret let s go o
24. lt s gt ontop lt on gt lt on gt bottom object lt bo gt lt bo gt type table gt lt s gt nothing ontop table true When using negated conjunctions of conditions the pro duction has nested curly braces One set of curly braces delimits the pro duction while the other set delimits the conditions to b e conjunctiv ely negated If only the last condition lt bo gt type table w ere negated the pro duction w ould matc h only if the state had an on top relation and the on top relation had a b ottom ob ject but the b ottom ob ject w asn t a table Using the negated conjunction the pro duction will also matc h when the state has no on top augmen tation or when it has an on top augmen tation that do esn t ha v e a b ottom ob ject augmen tation The seman tics of negated conjunctions can b e though t of in terms of mathematical logic where the negation of A B C A B C can b e rewritten as A _ B _ C That is not A and B and C b ecomes not A or not B or not C Multi v alued attributes An ob ject in w orking memory ma y ha v e m ultiple augmen tations that sp ecify the same attribute with dieren t v alues these are called m ult
25. move block A T move block A C move block A B move block C A move block B C move block B T move block C T move block A C move block A T move block C B move block C T move block A T move block A B move block C A move block C T move block A T move block B T move block B T move block B C Figure The problem space in the blo c ks w orld includes all op erators that mo v e blo c ks from one lo cation to another and all p ossible congurations of the three blo c ks identier the group of WME s that share this iden tier are called an obje ct in w ork ing memory Eac h WME describ es a dieren t attribute of the ob ject for example its name or t yp e or lo cation eac h attribute has a value asso ciated with it for example the name is A the t yp e is blo c k and the p osition is on the table Therefore eac h WME is an iden tier attribute v alue triple and all WME s with the same iden tier are part of the same ob ject Ob jects in w orking memory are linke d to other ob jects The v alue of one WME ma y b e an iden tier of another ob ject F or example a WME migh t sa y that B is on top of T and an
26. omitting depth 0 will cause eac h WME to b e prin ted for ev ery ob ject they are part of if the default depth is omitting internal will cause the en tire ob ject to b e prin ted for eac h WME Example The default b eha vior of print is to prin t an ob ject Sp ecifying internal causes the individual WMEs and their timetags to b e prin ted soar gt print s S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state soar gt print internal s EXAMINING MEMOR Y S io I S ontop O 0 S ontop O S ontop O S operator O S operator O S operator O 0 S operator O S operator O S operator O S operator O S problem space blocks S superstate nil S thing T S thing B S thing B S thing B S type state Example The acceptable preferences for op erators that ma y app ear in w orking memory ma y b e prin ted b y follo wing the iden tier attribute v alue pattern with a plus sign When wildcards are used Soar prin ts
27. AX OF SO AR PR OGRAMS p osition of a w orking memory elemen t as w ell as to the sym b ols that o ccup y that p osition Sym b ols Soar distinguishes b et w een t w o t yp es of w orking memory sym b ols identiers and c onstants Iden tiers An iden tier is a unique sym b ol created at run time when a new ob ject is added to w orking memory The names of iden tiers are created b y Soar and consist of a single upp ercase letter follo w ed b y a string of digits suc h as G or O The Soar user in terface will also allo w users to sp ecify iden tiers using lo w ercase letters for example when using the print command But in ternally they are actually upp ercase letters Constan ts There are three t yp es of constan ts in tegers oating p oin t and sym b olic constan ts In teger constan ts n um b ers The range of v alues dep ends on the mac hine and implemen tation y ou re using but it is at least billion billion Floating p oin t constan ts n um b ers The range dep ends on the mac hine and implemen tation y ou re using Sym b olic constan ts These are sym b ols with arbitrary names A constan t can use an y com bination of letters digits or amp
28. Figure a conjunctiv e test is used for the thing attribute in the rst condition CHAPTER THE SYNT AX OF SO AR PR OGRAMS Negated conditions In addition to the p ositiv e tests for elemen ts in w orking memory conditions can also test for the absence of patterns A ne gate d c ondition will b e matc hed only if there do es not exist a w orking memory elemen t consisten t with its tests and v ariable bindings Th us it is a test for the absenc e of a w orking memory elemen t Syn tactically a negated condition is sp ecied b y preceding a condition with a dash i e F or example the follo wing condition tests the absence of a w orking memory elemen t of the ob ject b ound to lt p gt type father lt p gt type father A negation can b e used within an ob ject with man y attribute v alue pairs b y ha ving it precede a sp ecic attribute lt p gt name john type father spouse lt p gt In that example the condition w ould matc h if there is a w orking memory elemen t that matc hes lt p gt name john and another that matc hes lt p gt spouse lt p gt but is no w orking memory elemen t that matc hes lt p gt type father when p is b ound to
29. Load and ev aluate the con ten ts of a le The source command is used for nearly ev ery Soar program The directory func tions are imp ortan t to understand so that users can na vigate directories folders to load sa v e the les of in terest An y Soar application that includes a graphical in terface or other sim ulation en vironmen t will require the use of echo and output strings destinati on command to file fcmdg filename new existi ng The command to file command ev aluates a sp ecied Soar command and redirects the output of the command to the sp ecied le The le sp ecied ma y b e a new le an existing le to b e o v erwritten or an existing le to b e added to if neither new or existing is sp ecied the le will b e op ened as a new le o v erwriting the le if it already exists argumen t action cmd The command to b e ev aluated filename The name of the le to op en new Op en the named le o v erwriting it if it already exists default existing Op en the named le app ending to it if it already exists T o pro cess a m ultiple w ord Soar command using command to file the m ultiple w ord command and all its argumen ts m ust b e enclosed in either curly braces f and g or double qu
30. This matters for the excise task command c h unk sp ecies that this pro duction is a c h unk This matters for the explain backtraces command Multiple ags ma y b e used but not b oth of o support and i support Although y ou could force y our pro ductions to pro vide O supp ort or I supp ort b y using these commands regardless of the structure of the conditions and actions of the pro duction this is not prop er co ding st yle The o support and i support ags are included to help with debugging but should not b e used in a standard Soar program Example sp blocks create problem spa ce This creates the top level space state lt s gt superstate nil gt lt s gt name solve blocks world problem space lt p gt lt p gt name blocks world BASIC COMMANDS F OR R UNNING SO AR Notes The syn tax of the sp command is explained in Section and a grammar app ears in App endix Consult these t w o sections for additional details The syn tax of pro ductions c hanges when Tcl v ariables app ear in pro ductions This is describ ed briey in Section Since using Tcl in pro ductions is considered an adv anced usage consult the So ar A dvanc e d Applic ations Manual for more details
31. a eld of num spaces right num pattern prin t the giv en p attern righ t justied in a eld of num spaces id prin t the iden tier of the curren t ob ject v attr prin t the v alue s of attribute attr on the curren t ob ject If there is no attr on the curren t ob ject nothing is prin ted v path same as the ab o v e only follo w the giv en p ath to get the v alue s A p ath is a series of attribute names separated b y p erio ds suc h as fo o bar baz v prin t all v alues of all attributes for curren t ob ject o args same as v except that if the v alue is an iden tier it is prin ted using the appropriate ob ject format rather than just as O for example av args same as v except the prin ted v alue is preceded with attr to indicate the attribute name ao args a com bination of the ab o v e t w o ifdef pattern prin t the giv en p attern if and only if all escap e sequences inside it are meaningful or w ell dened F or example ifdef foo has value v foo will prin t nothing if there is no foo attribute on the curren t ob ject CONFIGURING TRA CE INF ORMA TION AND DEBUGGING The follo wing escap e sequences
32. actually selected Goals are either represen ted explicitly as substructure of the state with general rules that recognize when the goal is ac hiev ed or are implicitly represen ted in the Soar program b y goal sp ecic rules that test the state for sp ecic features and recognize AN O VER VIEW OF SO AR B1 B1 is a block B1 is named A B1 is clear B2 B2 is a block B2 is named B B2 is clear B3 B3 is a block B3 is named C B3 is clear T1 T1 is a table T1 is named table T1 is clear S1 S1 is a state S1 has a problem space blocks S1 has a thing B1 S1 has a thing B2 S1 has a thing B3 S1 has a thing T1 S1 has an ontop O1 S1 has an ontop O2 S1 has an ontop O3 S1 has no operator O1 has a top block B1 O1 has a bottom block T1 O1 O2 O2 has a top block B2 O2 has a bottom block T1 O3 O3 has a top block B3 O3 has a bottom block T1 An Abstract View of Working Memory Figure An abstract illustration of the initial state of the blo c ks w orld as w orking memory ob jects A t this stage of problem solving no op erators ha v e b een prop osed or selected when the goal is ac hiev ed The p oin t is that sometimes a description of the goal will b e a v ailable in the state for fo cusing the problem solving whereas other times it ma y not Although represen
33. an operator augmentation on a state THEN the preference gets O support ELSE the preference gets I support The main dierence in the alternativ e O supp ort sc heme is that O supp ort determi CONFIGURING SO AR S R UNTIME P ARAMETERS nation is based en tirely on the structure of the pro duction that creates the preference and is not based on w orking memory In the default sc heme O supp ort is based on whether the preference is link ed to the op erator or the state but this link age migh t b e created after the pro duction has red A few sp ecic details Op erator prop osal preferences alw a ys get I supp ort Searc h con trol preferences desirabilit y preferences for op erators alw a ys get I supp ort Changes to w orking memory resulting from op erator elab oration get O supp ort This is the most con ten tious c hange under the alternativ e sc heme Structures shared b et w een the op erator and the state are no longer sp ecial With the default sc heme there is some am biguit y o v er whether shared struc ture is considered to test the op erator Dierences and similarities b et w een the t w o sc hemes F or most normal O supp ort calculations things don t c hange the
34. at the conditions or only at the actions of pro ductions b y using the ags sho wn in the follo wing table ag Eect on pro ductions found lhs Matc h pattern only against the conditions lefthand side of pro ductions default rhs Matc h pattern only against the actions righ thand side of pro ductions chunks Lo ok only for c h unks that matc h the pattern nochunks Disregard c h unks when lo oking for the pattern showbindings Sho w the bindings asso ciated with a wildcard pattern Examples soar gt production find lt s gt operator lt o gt lt o gt name move block blocks world monitor move blo ck blocks world terminate mo ve b loc k blocks world apply move b lock re move old cle ar blocks world apply move b lock ad d ne w on top blocks world apply move b lock ad d ne w cl ear blocks world apply move b lock re move old ont op soar gt production find showbindings rhs lt state gt operator lt op gt lt op gt name move block blocks world propose move blo ck with bindings lt state gt gt lt s gt lt op gt gt lt o gt soar gt production find rhs lhs CHAPTER THE SO AR USER INTERF A CE lt s gt operator lt o gt lt o gt name move block blocks world select move bloc k i ndif fer
35. but also see the full WMEs watch settings soar gt watch productions off u print fullwmes Notes T o w atc h sp ecic name d pro ductions use the pwatch command In the future the print noprint argumen ts ma y b e mo died so that on off will also w ork and p erhaps the fullprint option will b e implemen ted as w ell So alw a ys c hec k the Soar on line help pages for the latest information W atc hing w orking memory elemen ts There are t w o dieren t w a ys to con trol the prin ting of w orking memory c hanges as Soar runs one is to set the lev el of detail prin ted for WMEs when w atc hing pro duc tions as describ ed in the previous section the other is to w atc h WMEs that matc h a giv en iden tier attribute v alue triplet The latter is done b y watching wmes option ally follo w ed b y on inc since off w ouldn t mak e sense here and sp ecifying an action to add remo v e list or reset the lters a typ e whic h sp ecies whether to apply the lter to wmes as they are either added or remo v ed or b oth and a p attern whic h describ es the iden tier attribute v alue triplet to w atc h Usage watch wmes action type pattern The four actions supp orted are
36. calculation will just b e simpler for b oth user and mac hine under the alternativ e sc heme Op erator prop osal op erator application state elab oration op erator selection all will come out the same if there are no usual shared structures in v olv ed Op erator elab oration is denitely dieren t save backtraces c omment this could use a p oin ter to an explanation of what a bac ktrace is The save backtraces v ariable is a toggle that con trols whether or not bac ktracing information from c h unks and justications is sa v ed The initial v alue of this v ariable is off it ma y also b e set to on When save backtraces is set to off bac ktracing information is not sa v ed and explanations of the c h unks and justications that are formed can not b e retriev ed When save backtraces is set to on bac ktracing information can b e retriev ed b y using the explain backtraces command describ ed on page Sa ving bac ktrac ing information ma y slo w do wn the execution of y our Soar program but it can b e a v ery useful to ol in understanding ho w c h unks are formed Example soar gt set save_backtraces off soar gt set save_backtraces on soar gt set save_backtraces on CHAPTER TH
37. duction prodname full prin t the full bac ktrace for the named pro duction The t w o most useful v arian ts are explain backtraces name and explain backtraces name n The rst v arian t prin ts a n um b ered list of all of the conditions for the named c h unk or justication and the gr ound whic h resulted in its inclusion in the c h unk justication A gr ound is a w orking memory elemen t whic h w as tested in the sup ergoal Often just kno wing whic h WME w as tested in the sup ergoal is enough to explain wh y the c h unk justication exists If not the second v arian t explain backtraces name n where n is the n um b er of the condition of in terest can b e used to further bac ktrace through that particular condition to nd out wh y it is included in the c h unk justication Additionally the user ma y wish to call explain backtraces chunkname full to see the full bac ktrace of the c h unk Example c omment this example needs to b e up dated for explain bac ktraces and sa v e bac ktraces and to Soar Note that the save backtraces v ariable m ust b e set to on prior to the impasse b eing resolv ed soar gt explain backtraces List of all explained chunks justifications Have explanation fo
38. een compiled with MEMORY POOL STATS set to TRUE whic h is the default setting for the Soar distribution Examples soar gt stats memory bytes total memory allocated bytes statistics overhead bytes for strings 0 bytes for hash tables bytes for various memory pools 0 bytes for miscellaneous other things Memory pool statistics Pool Name Used Items Free Items Item Size Total Bytes chunk condition 0 0 0 0 CHAPTER THE SO AR USER INTERF A CE io wme 0 0 0 output link 0 0 0 preference 0 0 wme slot instantiation 0 ms change right mem token 00 node varnames rete node 0 rete test alpha mem 0 saved test 0 not action 0 production 0 condition 0 complex test 0 float constant 0 0 0 int constant 0 sym constant 0 identifier 0 0 variable 0 0 dl cons 0 cons cell stats rete rtype qualifier The optional stats argumen t rete pro vides information ab out no de usage in the Rete net the large data structure used for ecien t matc hing in Soar T o restrict information to sp ecic mo dules an rtyp e and qualier ma y b e sp ecied The follo wing rtyp es are a v ailable funhashed memoryg memory funhashed mem p
39. es the structure of impasses An o v erview of ho w input and output app ear in w orking memory is presen ted in the fth section the full discussion of Soar I O found in The So ar A dvanc e d Applic ations Manual This c hapter assumes that y ou understand the op erating principles of Soar as pre sen ted in Chapter W orking Memory W orking memory con tains working memory elements WME s As describ ed in Section WME s can b e created b y the actions of pro ductions the ev aluation of preferences the Soar arc hitecture and via the input output system A WME is a list consisting of three sym b ols an identier an attribute and a value where the en tire WME is enclosed in paren theses and the attribute is preceded b y an up arro w A template for a w orking memory elemen t is identifier attribute value The iden tier is an in ternal sym b ol generated b y the Soar arc hitecture as it runs The attribute and v alue can b e either iden tiers or constan ts if they are iden tiers there are other w orking memory elemen ts that ha v e that iden tier in their rst p osition As the previous sen tences demonstrate iden tier is used to refer b oth to the rst CHAPTER THE SYNT
40. for the state being considered if one operator preferred after preference evaluation SelectNewOperator else could be no operator available or CreateNewSubstate unable to decide between more than one ApplicationPhase while some productions are waiting to fire or retract FireNewlyMatchedProductio ns RetractNewlyUnmatchedProd uct ions Figure A simplied v ersion of the Soar algorithm a prohibit preference These preferences represen t constrain ts on the legal selections that can b e made for a decision and if they conict no progress can b e made from the curren t situation and the impasse cannot b e resolv ed b y additional preferences No c hange impasse A no change impasse arises if a new op erator is not selected during the decision pro cedure There are t w o t yp es of no c hange impasses state no c hange and op erator no c hange State no c hange impasse A state no c hange impasse o ccurs when there are no acceptable or require preferences to suggest op erators for the curren t state or all the acceptable v alues ha v e also b een rejected The decision pro cedure cannot select a new op erator Op erator no c hange impasse An op erator no c hange impasse o ccurs when IMP
41. in the subgoal con tains a complete description of the cause of the impasse suc h as the op erators that could not b e decided among or that there w ere no op erators prop osed and the state that the impasse arose in F rom the p ersp ectiv e of the new state the latter is called the sup erstate Th us the sup erstate is part of the substructure of eac h state represen ted b y the Soar arc hitecture using the superstate attribute The initial state created in the 0th decision cycle con tains a superstate attribute with the v alue of nil the top lev el state has no sup erstate The kno wledge to resolv e the impasse ma y b e retriev ed b y an y t yp e of problem solving from searc hing to disco v er the implications of dieren t decisions to asking an outside agen t for advice There is no a priori restriction on the pro cessing except that it in v olv es applying op erators to states In the substate op erators can b e selected and applied as Soar attempts to solv e the subgoal The op erators prop osed for solving the subgoal ma y b e similar to the op erators in the sup erstate or they ma y b e en tirely dieren t While problem solving in the subgoal additional impasses ma y b e enc
42. input link block block block x location color y location x location color y location x location color y location 1 red 2 blue 3 yellow red blue yellow 0 0 1 0 2 0 3 0 0 1 0 2 0 0 0 Figure An example p ortion of the input link for the blo c ks w orld task program could ha v e as its output the lo cations of blo c ks on an xy plane The Soar input function could tak e the output from the vision program and create the follo wing w orking memory elemen ts on the input link all iden tiers are assigned at run time this is just an example of p ossible bindings S io I A I input link I A I block B I block B I block B B x location B y location 0 B color red B x location B y location 0 B color blue B x location B y location 0 B color yellow The A notation in the example is used to indicate the w orking memory elemen ts that are created b y the arc hitecture and not b y the input function This conguration of blo c ks corresp onds to all blo c ks on the table as illustrated in the initial state in Figure SO AR I O INPUT AND OUTPUT IN SO AR S1 type state superstate
43. lename con tains a sux of Z then the le is compressed automatically when it is sa v ed and uncompressed when it is loaded Compressed les ma y not b e p ortable to another platform if that platform do es not supp ort the same uncompress utilit y File compression in the rete net command is not a v ailable on Macin toshes source filename The source command is a core Tcl command whic h lo ads the le filename it op ens the le and sequen tially ev aluates an y commands included in the le as if they had b een directly en tered b y the user The filename can b e a simple lename in whic h case it is loaded from the curren t w orking directory or it can sp ecify the full pathname to access les lo cated in another directory Users should refer to Tcl do cumen tation for the format for sp ecifying a full pathname The source command is t ypically used to load a le that con tains pro ductions for a Soar program but les ma y con tain an y of the commands in this c hapter including the source command itself and often include core Tcl commands Example soar gt source blocks soar soar gt soar gt source blocks soar soar gt Notes If filename is a simple st
44. move block that mo v e blo c ks from one lo cation to another The details of this pro duction will b e describ ed in the follo wing sections Con v en tions for inden ting pro ductions Pro ductions in this man ual are formatted using con v en tions designed to impro v e their readabilit y These con v en tions are not part of the required syn tax First the name of the pro duction immediately follo ws the rst curly brac k et after the sp All conditions are aligned with the rst letter after the rst curly brace and attributes of an ob ject are all aligned The arro w is inden ted to align with the conditions and actions and the closing curly brace follo ws the last action CHAPTER THE SYNT AX OF SO AR PR OGRAMS Pro duction Names The name of the pro duction is an almost arbitrary constan t See Section for a description of constan ts By con v en tion the name describ es the role of the pro duction but functionally the name is just a lab el primarily for the use of the programmer A pro duction name should nev er b e a single letter follo w ed b y n um b ers whic h is the format of iden tiers The con v en tion for naming pro ductions is to separate imp ortan t elemen ts with
45. o ccurrences of the same iden tier are replaced with the same v ariable This can lead to an o v ersp ecic c h unk when t w o v ariables are forced to b e the same in the c h unk ev en though distinct v ariables in the original pro ductions just happ ened to matc h the same iden tier A c h unk s conditions are also constrained b y an y not equal lt gt tests for pairs of inden tiers used in the conditions of pro ductions that are included in the c h unk These tests are sa v ed in the pro duction traces and then added in to the c h unk Ordering Conditions Since the eciency of the Rete matc her dep ends hea vily up on the order of a pro duction s conditions the c h unking mec hanism attempts to write the c h unk s con ditions in the most fa v orable order A t eac h stage the condition ordering algorithm tries to determine whic h eligible condition if placed next will lead to the few est n um b er of partial instan tiations when the c h unk is matc hed A condition that matc hes an ob ject with a m ulti v alued attribute will lead to m ultiple partial instan tiations so it is generally more ecien t to place these conditions later in the ordering This is the same pro c
46. ob jects in w orking memory illustrated b y this gure are O isa apple color red inside O size small X 00 O isa ball color red inside O size big O isa box size large color orange contains O O X unit grams property mass In this example ob ject O and ob ject O are b oth link ed to ob ject O through O contains O and O contains O resp ectiv ely the contains attribute is a m ulti v alued attribute Lik ewise ob ject O is link ed to ob ject O through O 0 CHAPTER THE SYNT AX OF SO AR PR OGRAMS inside O and link ed to ob ject O through O inside O Ob ject X is link ed to ob ject O through O X 00 Links are transitiv e so that X is link ed to O b ecause O is link ed to O and X is link ed to O Ho w ev er since links are not symmetric O is not link ed to X Preference Memory Preferences are created b y pro duction rings and express the relativ e or absolute mer its for selecting an op erator for a state When preferences express an absolute rating they are iden tier attribute v alue preference quadruples when preferences express relativ e ratings they are iden tier attribute v alue preference v alue quin tuples F or example S o
47. on line help information and to create and delete Soar pro ductions The sp ecic commands describ ed in this section are Summary d Run the Soar program for one decision cycle e Run the Soar program for one elab oration cycle excise Delete Soar pro ductions from pro duction memory exit T erminate Soar and return to the op erating system BASIC COMMANDS F OR R UNNING SO AR help Pro vide formatted on line information ab out Soar commands init soar Reinitialize Soar so a program can b e rerun from scratc h quit Close log le terminate Soar and return user to the op erating system run Begin Soar s execution cycle sp Create a pro duction and add it to pro duction memory stop soar In terrupt a running Soar program These commands are all frequen tly used an ytime Soar is run d n The d alias is a shorthand for run d If a n umeric argumen t is sp ecied d will cause Soar to run for n decision cycles The default v alue of n is so that if no argumen t is sp ecied Soar will run decision cycle Example soar gt d run for decision cycles e n The e alias is a shorthand for run e If a n umeric argumen t is sp ecied e will cause Soar to run
48. op erating system It do es not accept an y argumen ts It closes an y op en log les and in v ok es an y system termination callbac ks that are registered see the monitor command Using quit instead of the Tcl exit command allo ws programs to in v ok e pro cedures prior to termination Once all callbac ks ha v e b een pro cessed quit in v ok es the Tcl exit command BASIC COMMANDS F OR R UNNING SO AR Example soar gt quit Exiting Soar run n forever unit self The run command starts the Soar execution cycle or con tin ues an y execution that w as temp orarily stopp ed The default b eha vior of run with no argumen ts is to cause Soar to execute un til it is halted or in terrupted b y an action of a pro duction or un til an external in terrupt is issued b y the user The run command can also sp ecify that Soar should run only for a sp ecic n um b er of Soar cycles or phases whic h ma y also b e prematurely stopp ed b y a pro duction action or a con trol C This is helpful for debugging sessions where users ma y w an t to pa y careful atten tion to the sp ecic pro ductions that are ring and retracting p erhaps in conjunction with c hanging the watch settings de
49. orking memory elemen ts that mak e up an ob ject are often called augmentations b ecause they augmen t the ob ject A template for an ob ject in w orking memory is W ORKING MEMOR Y identifier attribute value attribute value attribute value attribute n value n F or example if y ou run Soar with the example blo c ks w orld program describ ed in App endix after one elab oration cycle y ou can lo ok at the top lev el state b y using the print command soar gt print s S io I ontop O ontop O ontop O problem space blocks superstate nil thing B thing T thing B thing B type state The attributes of an ob ject are prin ted in alphab etical order to mak e it easier to nd a sp ecic attribute W orking memory is a set so that at an y time there are nev er duplicate v ersions of w orking memory elemen ts Ho w ev er it is p ossible for sev eral w orking memory elemen ts to share the same iden tier and attribute but ha v e dieren t v alues Suc h attributes are called m ulti v alued attributes or multi attributes F or example state S ab o v e has t w o attributes that are m ulti v alued thing and ontop Timetags When a w orking memory elemen t is created Soar
50. preference memory By default Soar will select the first of the m utually indieren t augmen tations and create the corresp onding elemen t in w orking memory First refers to a list in ternal to Soar the ordering of the augmen tations is arbitrary but deterministic so that if y ou run Soar rep eatedly first will alw a ys mak e the same decision Similarly last c ho oses the last of the tied ob jects from the in ternal list The options first and last are in con trast to random whic h also mak es an arbitrary decision but this will not generally b e the same decision for eac h rep eated run A fourth metho d for deciding among indieren t op erator prop osals curren tly w orks only on Unix systems when running without the Tcl Soar In terface This is b ecause a Wish or Tcl Console windo w is curren tly required The ask metho d prompts the user to mak e the decision This option should b e restored on all Soar platforms with the next release so it is do cumen ted here but users are alerted that it do esn t w ork as adv ertised for Soar If no argumen t is pro vided indifferent selection will displa y the curren t setting With an argumen t it sets indifferent selection to the giv en
51. screen should use echo rather than FILE SYSTEM I O COMMANDS the Tcl puts command The echo command gets redirected to the appropriate c hannel according to output strings destinatio n the puts command do es not see Section The argumen ts to b e ec ho ed bac k ma y b e enclosed in curly braces f and g to con trol in terw ord spacing for example but in most cases these delimiters are not needed Examples soar gt echo Test load number Test load number soar gt echo I want space I want space log new filename existing filename off query add string The log command allo ws users to sa v e all user in terface input and output to a le When Soar is logging to a le ev erything t yp ed b y the user and ev erything prin ted b y Soar is written to the le in addition to the screen With no argumen ts the log commands prin ts the curren t logging status op en or closed and the name of the le that is op en if logging is on The optional argumen ts are describ ed in the follo wing table log Action new filename Begin logging to the named le o v erwriting it if it already exists existing filename Begin logging to the named le app ending to it if it alrea
52. soar gt pwatch on blocks world terminate move bl ock soar gt pwatch blocks world terminate m ove blo ck soar gt run d 0 gt S S Initial state has a b and c on the table O O move block Moving Block c to b Firing blocks world terminate mo ve b lock CHAPTER THE SO AR USER INTERF A CE O O move block Moving Block c to a Retracting blocks world terminate mo ve b lock Firing blocks world terminate mo ve b lock O O move block stats system stat n memory resource n rete rtype qualifier The stats command pro vides statistical information ab out Soar s in ternal w orkings Users can obtain summary information on the whole system the Rete net or memory p o ols or can request single v alues for individual items Most users are in terested in the summary information for the system and migh t examine more detailed information only when debugging stats system stat With no argumen ts or if system is sp ecied the stats command lists a summary of run statistics including the follo wing V ersion The Soar v ersion n um b er hostname and date of the run Num b er of pro ductions The total n um b er of pro ductions loaded in the system including all
53. states that a v alue is a candidate for selection All v alues except those with require preferences m ust ha v e an acceptable preference in order to b e selected If there is only one v alue with an acceptable preference and none with a require preference that v alue will b e selected as long as it do es not also ha v e a reject or a prohibit preference Reject A reject preference states that the v alue is not a candidate for selection Better gt W orse lt A better or worse preference states for the t w o v alues in v olv ed that one v alue should not b e selected if the other v alue is a candidate Better and worse allo w for the creation of a partial ordering b et w een candidate v alues Better and worse are simple in v erses of eac h other so that A b etter than B is equiv alen t to B w orse than A Best gt A best preference states that the v alue ma y b e b etter than an y comp eting v alue unless there are other comp eting v alues that are also b est If a v alue is best and not rejected prohibited or worse than another it will b e selected o v er an y other v alue that is not also best or required If t w o suc h v alues are best then an y remain
54. the app earance of the output prin ted as Soar runs Unlik e the watch command whic h con trols what information is prin ted the format watch command con trols how this information is prin ted that is ho w it is formatted Generally this command is not used b y b eginners but it giv es great exibilit y for customizing the run time app earance of Soar Readers ma y wish to read through the section on the watch command on page b efore reading this section The formatting is con trolled b y a set of formatting rules eac h ha ving certain applica bilit y conditions and a format string When Soar w an ts to prin t something it lo oks for an applicable rule c ho osing the most sp ecic one if more than one is applicable and uses that format string to con trol the prin tout In general these conditions could b e made arbitrarily complicated and a whole Rete net could b e used to matc h the rules Ho w ev er w e ha v e opted for simplicit y here instead the conditions are v ery restricted so that the matc hing actually lo okup can b e done in constan t time CONFIGURING TRA CE INF ORMA TION AND DEBUGGING argumen t Eect on format w atc h stack applies to prin ting of con text stac
55. the decision cycle it is said to reac h an op erator impasse All impasses app ear as states in w orking memory where they can b e tested b y pro ductions This section describ es the structure of state ob jects in w orking memory Impasses in w orking memory There are four t yp es of impasses Belo w is a short description of the four t yp es of impasses This w as describ ed in more detail in Section on page tie when there is a collection of equally eligible op erators comp eting for the v alue of a particular attribute IMP ASSES IN W ORKING MEMOR Y AND IN PR ODUCTIONS c onict when t w o or more ob jects are b etter than eac h other and they are not dominated b y a third op erator c onstr aint failur e when there are conicting necessit y preferences no change when the prop osal phase runs to quiescence without suggesting a new op erator The list b elo w giv es the sev en augmen tations that the arc hitecture creates on the substate generated when an impasse is reac hed and the v alues that eac h augmen tation can con tain type state impasse Con tains the impasse t yp e tie conflict constraint failure or no change choices Either mult
56. the results of a c h unk learned earlier in the subgoal The user can observ e the bac ktracing pro cess b y setting setting bac ktracing on using the w atc h command watch backtracing on see Section on page This prin ts out a trace of the conditions as they are collected Certain pro ductions do not participate in bac ktracing If a pro duction creates only a reject preference or a desirabilit y preference better worse indifferent or parallel then neither the preference nor the ob jects that led to its creation will b e included in the c h unk The exception to this is that if the desirabilit y or reject preference is a r esult of a subgoal it will b e in the c h unk s actions Desirabilit y and reject preferences should b e used only as searc h con trol for c ho osing b et w een legal alternativ es and should not b e used to guaran tee the correctness of the problem solving The argumen t is that suc h preferences should aect only the eciency and not the c orr e ctness of problem solving and therefore are not necessary to pro duce the results Necessit y preferences require or prohibit should b e used to enforce the correctness of problem solving the pro ductions that create these preferences
57. the second blo c k b e clear Ho w ev er the action of placing the rst blo c k remo v es the fact that the second blo c k is clear so the condition will no longer b e satised Th us op erator application pro ductions do not retract their actions ev en if they no longer matc h w orking memory This is called O supp ort for op erator supp ort W orking memory elemen ts that participate in the application of op erators are main tained throughout the existence of the state in whic h the op erator is applied unless explicitly remo v e or if they b ecome unlink ed W orking memory elemen ts are re mo v ed b y a r eje ct action of a op erator application rule Whether a w orking memory elemen t receiv es O supp ort or I supp ort is determined b y the structure of the pro duction instan tiation that create the w orking memory elemen t O supp ort is giv en only to w orking memory elemen ts created b y op erator application pro ductions An op erator application pro duction tests the curren t op erator of a state and mo dies the state Th us a w orking memory elemen t receiv es O supp ort if it is for an aug men tation of the curren t state or substructure of the state and the conditions of the
58. the selection space These op erators will b e prin ted as an iden tier follo w ed b y in paren theses the string ev aluate ob ject and the prin ted represen tation of the ob ject b eing prin ted Notice that the second and third rules are more sp ecic than the rst and either will tak e precedence o v er the rst Also the third rule giv es a sp ecial format to b e used only on op erators with a certain name Users ma y nd this tec hnique useful in their o wn co de to get certain parameters prin ted on certain op erators but dieren t parameters prin ted on other op erators The follo wing formatting rules pro duce a Soar trace where instead of inden ting for states the lev el of subgoaling prefaces eac h state or op erator sym b ol format watch stack add s left dc sd S cs format watch stack add o left dc sd O co The follo wing formatting rule causes b oth the curren t state and curren t op erator to b e prin ted whenev er an op erator is selected There is a linefeed in the middle of the format string format watch stack add o right dc rsd S cs rsd O co This format can b e useful for w atc hing the eects of a series of op erator applications
59. the state where the impasse arose When an op erator IMP ASSES AND SUBST A TES impasse is resolv ed Soar has an opp ortunit y to learn and the substate and all its substructure is remo v ed from w orking memory Listed b elo w are p ossible approac hes for resolving sp ecic t yp es of impasses Tie impasse A tie impasse can b e resolv ed b y pro ductions that create prefer ences that prefer one option better best require eliminate alternativ es worse worst reject prohibit or mak e the all of the ob jects indieren t indifferent Conict impasse A conict impasse can b e resolv ed b y pro ductions that cre ate preferences to require one option require or eliminate the alternativ es reject prohibit Constrain t failure impasse A constrain t failure impasse cannot b e resolv ed b y additional preferences but ma y b e prev en ted b y c hanging pro ductions so that they create few er require or prohibit preferences State no c hange impasse A state no c hange impasse can b e resolv ed b y pro ductions that create acceptable or require preferences for op erators Op erator no c hange impasse An op erator no c hange impasse can b e resolv ed b y pro ductions that apply the op era
60. to the end of the n th elab oration cycle The default v alue of n is so that if no argumen t is sp ecied Soar will complete elab oration cycle Example soar gt e run for elaboration cycles Recall that an elab oration cycle is the sequence of rings and retractions follo w ed b y w orking memory c hanges whic h o ccur during the Prop ose and Apply phases The Input Decide and Output phases eac h coun t as one elab oration cycle for the purp oses of this command excise prod name all chunks d ef au lt us er ta sk The excise command remo v es pro ductions from pro duction memory A p ound sign is prin ted for ev ery pro duction excised The command m ust b e called with ei ther a sp ecic pro duction name or with a ag that indicates a particular group of pro ductions The optional ags are describ ed in the table b elo w 0 CHAPTER THE SO AR USER INTERF A CE argumen t pro ductions remo v ed pr o d name Excise only the named pro duction all Excise all pro ductions also do an init soar chunks Excise all c h unks and justications default Excise all default pro ductions task Excise all non default pro ductions user c h unks justs also do an init soar user Ex
61. v alue ar gument eect on selection first select the rst indieren t ob ject from Soar s in ternal list default last select the last indieren t ob ject from Soar s in ternal list random select randomly ask ask the user to c ho ose Example CONFIGURING SO AR S R UNTIME P ARAMETERS soar gt indifferent selection first soar gt indifferent selection random learn on off exce pt on ly list n all levels bottom up The learn command con trols the parameters for c h unking Soar s learning mec ha nism With no argumen ts this command prin ts out the curren t learning en vironmen t status If argumen ts are pro vided they will alter the learning en vironmen t as describ ed in the table b elo w learn eect on c h unking b eha vior on turn c h unking on default except c h unking is on exc ept as sp ecied b y RHS dont learn actions only c h unking is on only as sp ecied b y RHS force learn actions off turn c h unking o list prin ts listings of don t learn and force learn states all levels build pro ductions whenev er a subgoal returns a result default bottom up build pro ductions only for subgoals that ha v e not y et had an y subgoals with c h unks built The exce
62. v er the legal examples one b y one to understand what eac h is doing In the rst example the v alue m ust b e less than or equal to the v alue b ound to v ariable lt a gt and greater than or equal to the v alue b ound to v ariable lt b gt In the second example the v alue is b ound to the v ariable lt x gt whic h m ust also b e greater that the v alue b ound to v ariable lt y gt In the third example the v alue m ust not b e equal to the v alue b ound to v ariable lt x gt and should b e b ound to v ariable lt y gt Note the imp ortance of order when using conjunctions with predicates in the second example the predicate mo dies lt y gt but in the third example the predicate mo dies lt x gt In the fourth example the v alue m ust b e one of A B or C and the second conjunctiv e test binds the v alue to v ariable lt x gt In the fth example there are four conjunctiv e tests First the v alue m ust b e the same t yp e as the v alue b ound to v ariable lt x gt Second the v alue m ust b e greater than the v alue b ound to v ariable lt y gt Third the v alue m ust b e equal to or Finally the v alue should b e b ound to v ariable lt z gt In
63. vides a formal description of ho w o supp ort is determined App endix pro vides a detailed explanation of the preference resolution pro cess OTHER SO AR DOCUMENT A TION Additional Bac k Matter The app endices are follo w ed b y a brief bibliograph y and an index the last t w o pages of this man ual con tain a summary and index of the user in terface functions for quic k reference Not Describ ed in This Man ual Some of the more adv anced features of Soar are not describ ed in this man ual suc h as ho w to in terface with a sim ulator or ho w to create Soar applications using m ultiple in teracting agen ts Detailed discussion of these topics are in a separate do cumen t The So ar A dvanc e d Applic ations Manual see Section for more information Other Soar Do cumen tation In addition to this man ual there are other do cumen ts that y ou ma y w an t to obtain for more information ab out dieren t asp ects of Soar The Soar T utorial is written for no vice Soar users and guides the reader through sev eral example tasks and exercises The Soar Adv anced Applications Man ual is written for adv anced Soar users This guide describ es ho w to add input and output routines to Soar progr
64. will b e included in bac ktracing Giv en that results can b e created at an y p oin t during a subgoal it is p ossible for one result to b e relev an t to another result Whether or not the rst result is included in the c h unk for the second result dep ends on the links that w ere used to matc h the rst result in the subgoal If the elemen ts are link ed to the sup erstate they are included as conditions If the elemen ts are not link ed to the sup erstate then the result is traced through In some cases there ma y b e more than one set of links so it is p ossible for a result to b e b oth bac ktraced through and included as a condition V ARIABLIZING IDENTIFIERS V ariablizing Iden tiers Ch unks are constructed b y examining the traces whic h include w orking memory ele men ts and op erator preferences T o ac hiev e an y useful generalit y in c h unks iden tiers of actual ob jects m ust b e replaced b y v ariables when the c h unk is created otherwise c h unks will only ev er re when the exact same ob jects are matc hed Ho w ev er a constan t v alue is nev er v ariablized the actual v alue alw a ys app ears directly in the c h unk When a c h unk is built all
65. will b e included in the conditions of the c h unk CHAPTER LEARNING Chapter Soar and Tcl The Soar Application In terface This c hapter pro vides a brief in tro duction to the Soar Application In terface and ho w Soar in teracts with Tcl the T o ol Command Language It also discusses the graphical in terface that is bundled with Soar called the Tcl Soar In terface or TSI This c hapter is not in tended to b e a full discourse on Tcl or ho w to dev elop Soar sim ulation en vironmen ts The reader is referred to Pr actic al Pr o gr amming in Tcl and Tk b y Bren t W elc h and The So ar A dvanc e d Applic ations Manual for more detailed information CHAPTER SO AR AND TCL THE SO AR APPLICA TION INTERF A CE Chapter The Soar User In terface This c hapter describ es the set of user in terface commands for Soar A few core Tcl commands are also included in sections and for completeness All commands and examples are presen ted as if they are b eing en tered at the Soar command prompt but they could just as easily b e placed in a le and loaded in to Soar using the Tcl source command Mak e sure y ou ha v e read Chapter concerning the in tegration of Soar and Tcl This c hapter
66. Retractions blocks world select move bl ock ind iffe rent S operator O O name move block blocks world select move bl ock ind iffe rent S operator O O name move block blocks world select move bl ock ind iffe rent S operator O O name move block blocks world select move bl ock ind iffe rent S operator O O name move block blocks world select move bl ock ind iffe rent S operator O O name move block Prin ting partial matc hes for pro ductions In addition to prin ting the curren t matc h set the matches command can b e used to prin t information ab out partial matc hes for a named pro duction In this case the conditions of the pro duction are listed eac h preceded b y the n um b er of curren tly activ e matc hes for that condition If a condition is negated it is preceded b y a min us sign The p oin ter gt gt gt gt b efore a condition indicates that this is the rst condition that failed to matc h When prin ting partial matc hes the default action is to prin t only the coun ts of the n um b er of WME s that matc h and is a handy to ol for determining whic h condition failed to matc h for a pro duction that y ou though t
67. Soar and Tcl The Soar Arc hitecture An Ov erview of Soar Problem Solving F unctions in Soar An Example T ask The Blo c ks W orld Represen tation of States Op erators and Goals 0 Prop osing candidate op erators Comparing candidate op erators Preferences Selecting a single op erator Applying the op erator Making inferences ab out the state Problem Spaces W orking memory The Curren t Situation Pro ductions Long term Kno wledge The structure of a pro duction Arc hitectural roles of pro ductions 0 Pro du
68. a list of ALL available help topics type help all For help on a specific command type help followed by the command name soar gt help in Ambiguous Help topic input period internal symbols interp indifferent selection incr inds info init soar Notes Although w e v e tried to mak e the help command robust it ma y function dieren tly in dieren t op erating systems F or the most reliable and consisten t output from help alw a ys run Soar with the TSI If y ou ha v e problems accessing online help con tact y our lo cal Soar administrator or send email to soar help umic h edu init soar The init soar command re initializes Soar It empties w orking memory wiping out the subgoal stac k and resets all run time statistics The ring coun ts for all pro ductions is reset to zero The init soar command allo ws a Soar program that has b een halted to b e reset and start its execution from the b eginning init soar do es not remo v e an y pro ductions from pro duction memory to do this use the excise command Note ho w ev er that all justications will b e remo v ed b ecause they will no longer b e supp orted Example soar gt init soar quit The quit command terminates Soar and returns the user to the
69. a ys considered clear The blo c ks w orld task could also b e implemen ted using an external sim ulator as is done in the examples in The So ar Coloring Bo ok In this case the Soar program do es not up date all the on top and clear relations the up dated state description comes from the sim ulator Making inferences ab out the state Making monotonic inferences ab out the state is the other role that Soar long term kno wledge ma y fulll Suc h elab oration kno wledge can simplify the enco ding of op er ators b ecause en tailmen ts of a set of core features of a state do not ha v e to b e explicitly included in application of the op erator In Soar these inferences will b e automati cally retracted when the situation c hanges suc h as through op erator applications or c hanges in sensory data Our example blo c ks w orld task do es not use elab orations Ho w ev er k eeping trac k of whether a blo c k is clear or not could b e done with elab orations instead of op erator applications If it w ere implemen ted this w a y an elab orations w ould test for the absence of a blo c k that is on top of a particular blo c k if there is no suc h on top the blo c k is cle
70. applicabilit y conditions A remove op eration remo v es formats with the giv en applicabilit y conditions The com bination of class and name dene the applicabilit y conditions of the format i e whic h classes of items the format applies to The class m ust b e either s or o and indicates that the op eration applies to states or op erators resp ectiv ely The wildcard sym b ol ma y also b e used to indicate that the format applies to all classes of items If an object trace is b eing manipulated then an optional name ma y b e giv en indicating the format applies only to ob jects with that name If a stack trace is b eing manipulated then an optional name ma y b e giv en indicating the format applies only within problem spaces of that name The format string can b e an y sequence of c haracters surrounded b y curly braces Note that curly braces m ust b e used to delimit the format otherwise an y square brac k ets in the format string will b e in terpreted as a command to b e ev aluated b y Tcl A set of formatting con trols can b e used within the format string see the subsection F ormatting Con trols b elo w for more information Note that there can only b e one rule with giv en applica
71. assigns it a unique in teger timetag The timetag is a part of the w orking memory elemen t and therefore WME s are actually quadruples rather than triples Ho w ev er the timetags are not represen ted in w orking memory and cannot b e matc hed b y pro ductions The timetags are used to distinguish b et w een m ultiple o ccurrences of the same WME As preferences c hange and elemen ts are added and deleted from w orking memory it is p ossible for a WME to b e created remo v ed and created again The second creation of the WME whic h b ears the same iden tier attribute and v alue as the rst WME is dier ent and therefore is assigned a dieren t timetag This is imp ortan t b ecause a pro duction will re only once for a giv en instan tiation and the instan tiation is determined b y the timetags that matc h the pro duction and not b y the iden tier attribute v alue triples T o lo ok at the timetags of WMEs the wmes command can b e used soar gt wmes s S io I 0 S ontop O S ontop O S ontop O S problem space blocks S superstate nil S thing B S thing T CHAPTER THE SYNT AX OF SO AR PR OGRAMS S thing B S thing B S t
72. aster isks the imp ortan t elemen ts that tend to app ear in the name are The name of the task or goal e g blocks world The name of the arc hitectural function e g propose The name of the op erator or other ob ject at issue e g move block An y other relev an t details This name con v en tion enables one to ha v e a go o d idea of the function of a pro duction just b y examining its name This can help for example when y ou are w atc hing Soar run and lo oking at the sp ecic pro ductions that are ring and retracting Since Soar uses white space to delimit comp onen ts of a pro duction if whitespace inadv erten tly o ccurs in the pro duction name soar will complain that an op en paren thesis w as exp ected to start the rst condition Do cumen tation string optional A pro duction ma y con tain an optional do cumen tation string The syn tax for a do cu men tation string is that it is enclosed in double quotes and app ears after the name of the pro duction and b efore the rst condition and ma y carry o v er to m ultiple lines The do cumen tation string allo ws the inclusion of in ternal do cumen tation ab out the pro duction it will b e prin ted out when
73. augmen tations of the input link pro viding Soar with information ab out some o ccurrence external to Soar An output function resp onds to substructure of the CHAPTER THE SYNT AX OF SO AR PR OGRAMS output link pro duced b y pro duction rings and causes some o ccurrence external to Soar Input and output o ccur through the io attribute of the top lev el state exclusiv ely The substructure of the input link will remain in w orking memory un til the input function that created it remo v es it Th us w orking memory elemen ts pro duced b y an input function pro vide supp ort for condition matc hing in pro ductions as long as the input p ersists in w orking memory i e un til the input function sp ecically remo v es the elemen ts of the substructure Ho w ev er a pro duction that tests only a single elemen t on the input structure will result in instan tiations that re only once for eac h input elemen t that matc hes The instan tiation will not con tin ue to re for eac h matc hed input elemen t unless the elemen t is remo v ed and then added again Input and output in pro duction memory Pro ductions in v olv ed in input will test for sp ecic attributes and v alues on the input link while pro du
74. b e sp ecied Finally when w atc hing pro ductions users ma y set the lev el of detail to b e displa y ed for WMEs that are added or retracted as pro ductions re and retract ag eect on WME information nowmes don t prin t an y info ab out WMEs timetags prin t only the timetags for WMEs fullwmes prin t the full WMEs added or retracted as w atc hed pro ductions re and retract Detailed information ab out WMEs will b e prin ted only for pro ductions that are b eing w atc hed F or instance if no chunks are b eing w atc hed then no WME details for c h unks will b e prin ted So the full syn tax for ne tuning the w atc hing of pro ductions is Usage watch productions on off inc n f all chunks defaults ju stif ica tion s u serg n print noprint n nowmes timetags fullwmes CHAPTER THE SO AR USER INTERF A CE Examples T o w atc h all pro ductions phases and decisions soar gt watch productions T o w atc h all pro ductions phases and decisions but not default pro ductions soar gt watch productions inc defaults noprint T o w atc h only user pro ductions re and not aect other watch settings soar gt watch productions off u print T o do the same as ab o v e
75. created them con tin ues to matc h When the pro duction instan tiation no longer matc hes the sit uation has c hanged making the preference no longer relev an t Soar automatically remo v es the preferences in suc h cases These preferences are said to ha v e I supp ort for instan tiation supp ort Similarly state elab orations are simple inferences are v alid only so long as the pro duction matc hes W orking memory elemen ts created as state elab orations also ha v e I supp ort and remain in w orking memory only as long as the pro duction instan tiation that created them con tin ues to matc h w orking mem ory F or example the set of relev an t op erators c hange as the state c hanges so that the prop osal of op erators done with I supp orted preferences This w a y the op erator prop osals will b e retracted when they no longer apply to the curren t situation Ho w ev er the actions of pro ductions that apply an op erator either b y adding or remo ving elemen ts from w orking memory need to p ersist ev en after the op erator is no longer selected and op erator application pro duction instan tiation no longer matc hes F or example in placing a blo c k on another a condition is that
76. escap e causes the pattern in the brac k ets three spaces to b e prin ted curr ent substate depth times Finally the c haracters gt S should b e prin ted follo w ed b y the curren t state using whatev er ob ject format is appropriate The second example ab o v e is left as an exercise for the reader The follo wing ob ject formats are the built in defaults for Soar format watch object add id ifdef v name format watch object add s id ifdef v attribute v impasse format watch object add o evaluate object id evaluate object o object The rst command adds a rule that aects b oth states and op erators this rule prin ts an iden tier follo w ed b y its name in paren theses if a name is dened This rule will alw a ys apply unless a more sp ecic rule also holds for the same item The second command adds a rule that aects only the prin ting of state ob jects this rule tprin ts the state iden tier follo w ed b y in paren theses its attribute and impasse attributes if they are dened CHAPTER THE SO AR USER INTERF A CE The third command adds a rule that aects only the prin ting of op erator ob jects this rule handles sp ecically the evaluate object op erators in
77. execution cycle no longer ends after the decision phase as it did in Soar Therefore users who wish to examine memory or prin t the matc h set after the decision phase but b efor e an y rings or retractions m ust either step through the execution b y phases or set a monitor to generate a stop soar self after eac h decision phase See the sections on the stop soar page and monitor page commands and the So ar A dvanc e d Applic ations Manual for more information on stopping after the decision phase There are t w o predened aliases for the run command The d command alias will run Soar b y decision cycles see Section on page and the e command alias will run Soar b y elab oration cycles see Section on page Y ou ma y of course dene y our o wn aliases if y ou nd an incremen t that is particularly useful for y our debugging session See the alias command on page sp f production body g The sp command creates a new pro duction and loads it in to pro duction memory If the pro duction name is the same as an existing pro duction the old pro duction will b e o v erwritten excised This section pro vides only a brief o v erview of the sp command The syn tax of pro d
78. giv es examples of legal and illegal v ariable names Legal v ariables Illegal v ariables lt s gt lt gt lt gt lt lt variable gt variable gt lt abc gt lt a b gt Predicates for v alues A test for an iden tier attribute or v alue in a condition whether constan t or v ariable can b e mo died b y a preceding predicate There are six predicates that can b e used lt gt lt gt lt lt gt gt Predicate Seman tics of Predicate lt gt Not equal Matc hes an ything except the v alue immediately follo wing it lt gt Same t yp e Matc hes an y sym b ol that is the same t yp e iden tier in teger oating p oin t non n umeric constan t as the v alue immediately follo wing it lt Numerically less than the v alue immediately follo wing it lt Numerically less than or equal to the v alue immediately follo wing it gt Numerically greater than or equal to the v alue immediately follo wing it gt Numerically greater than the v alue immediately follo wing it The follo wing table sho ws examples of legal and illegal predicates CHAPTER THE SYNT AX OF SO AR PR OGRAMS Legal predicates Illegal predicates gt lt valuex gt gt gt lt valuey gt lt gt lt gt l
79. gt Ground S object dynamic N lt n gt clear yes Ground N clear yes lt s gt object dynamic lt n gt Ground S object dynamic N lt n gt clear yes Ground N clear yes lt s gt problem space lt p gt Ground S problem space P lt p gt default state copy no Ground P default state copy no lt p gt two level attributes object dynamic Ground P two level attributes object dynamic lt p gt name blocks world Ground P name blocks world lt p gt default operator copy no Ground P default operator copy no 0 lt s gt desired lt d gt Ground S desired D lt d gt ontop count Ground D ontop count lt n gt object static lt b gt Ground N object static B lt b gt type block Ground B type block lt d gt object dynamic lt d gt Ground D object dynamic D lt d gt object static lt b gt Ground D object static B lt d gt ontop lt b gt Ground D ontop B lt n gt object static lt b gt Ground N object static B lt d gt object dynamic lt gt lt d gt lt d gt Ground D object dynamic D lt d gt object static lt b gt Ground D object static B 0 lt s gt oper
80. has just ended wm changes Changes to w orking memory ha v e just completed create new context A new state has b een created on the goal stac k pop context stack A subgoal has nished production just added A pro ductions has just b een added to the agen t production just about A pro duction is just ab out to b e remo v ed to be excised from the agen t firing A pro duction instan tiation has just red retraction A pro duction instan tiation is just ab out to retract system parameter changed A system parameter has just b een c hanged system termination The Soar system is exiting Examples The follo wing command creates an attac hmen t whic h prin ts a message after ev ery Soar decision cycle monitor add after decision cycle puts Finished DC The next example creates an attac hmen t whic h calls the Tcl pro cedure DoSome thing presumably user dened after ev ery pro duction ring CONFIGURING TRA CE INF ORMA TION AND DEBUGGING monitor add firing DoSomething The next example creates an attac hmen t whic h pro cesses p ending X ev en ts after ev ery decision cycle This is often needed in long running Soar agen ts agen ts that run more than a few decision cycles at a time so that GUIs do not app ear fro
81. in this problem space it do es not explicitly generate all of the states examine them and then create a path Instead Soar is in a sp ecic state at a giv en time represen ted in w orking memory attempting to select an op erator that will mo v e it to a new state It uses whatev er kno wledge it has ab out selecting op erators giv en the curren t situation and if its kno wledge is sucien t it will mo v e to w ard its goal The same problem could b e recast in Soar as a planning problem where the goal is to dev elop a plan to solv e the problem instead of just solv ing the problem In that case a state in Soar w ould consist of a plan whic h in turn w ould ha v e represen tations of Blo c ks W orld states and op erators from the original space The op erators w ould p erform editing op erations on the plan suc h as adding new Blo c ks W orld op erators sim ulating those op erators etc In b oth form ulations of the problem Soar is still applying op erators to generate new states it is just that the states and op erators ha v e dieren t con ten t The follo wing sections describ e the memories and pro cesses of Soar w orking memory pro duction memory preference memory the d
82. input or b ecause of results the problem solving in the subgoal is inconsisten t and the state created in resp onse to the original impasse is remo v ed and a new state is created Problem solving will no w con tin ue from this new state The impasse is not resolv ed and Soar do es not learn in this situation The reason for regeneration is to guaran tee that the w orking memory elemen ts and preferences created in a substate are consisten t with higher lev el states As stated CHAPTER THE SO AR AR CHITECTURE ab o v e inconsistency can arise when a higher lev el state c hanges either as a result of c hanges in what is sensed in the external en vironmen t or from results pro duced in the subgoal The problem with inconsistency is that once inconsistency arises the problem b eing solv ed in the subgoal ma y no longer b e the problem that actually needs to b e solv ed Luc kily not all c hanges to a sup erstate lead to inconsistency In order to detect inconsistencies Soar main tains a dep endency set for ev ery sub goal substate The dep endency set consists of all w orking memory elemen ts that w ere tested in the conditions of pro ductions that created O supp orted w orking mem ory elemen ts t
83. is organized in to sections Basic Commands for Running Soar Examining Memory Conguring T race Information and Debugging Conguring Soar s Run Time P arameters File System I O Commands Soar I O commands Miscellaneous Commands Eac h section b egins with a summary description of the commands co v ered in that section including the role of the command and its imp ortance to the user Commands are then describ ed fully in alphab etical order Throughout this c hapter eac h function description includes a sp ecication of its syn tax and an example of its use F or a concise o v erview of the Soar in terface functions see the F unction Summary and Index on page This index is in tended to b e a quic k reference in to the commands describ ed in this c hapter CHAPTER THE SO AR USER INTERF A CE Notation The notation used to denote the syn tax for eac h user in terface command follo ws some general con v en tions The command name itself is giv en in a bold fon t Optional command argumen ts are enclosed within square brac k ets and A v ertical bar separates alternativ es Curly braces fg are used to group argumen ts when at least one argumen t from the set is required
84. ject and an output link attribute of the io ob ject The v alues of the input link and output link attributes are iden tiers whose augmen tations are the complete set of input and output w orking memory elemen ts resp ectiv ely Some Soar systems ma y b enet from ha ving m ultiple input and output links or that use names whic h are more descriptiv e of the input or output function suc h as vision input link text input link or motor output link In addition to pro viding the default io substructure the arc hitecture allo ws users to create m ultiple input and output links via pro ductions and I O functions An y iden tiers for io substructure created b y the user will b e assigned at run time and are not guaran teed to b e the same from run to run Therefore users should alw a ys emplo y v ariables when referring to input and output links in pro ductions Supp ose a blo c ks w orld task is implemen ted using a rob ot to mo v e actual blo c ks around with a camera creating input to Soar and a rob otic arm executing command outputs The camera image migh t b e analyzed b y a separate vision program this CHAPTER THE SYNT AX OF SO AR PR OGRAMS S1 type state superstate nil I6 B1 B2 B3 I9 io
85. matche d and it will r e whic h means that its actions are executed making c hanges to w orking memory Some pro ductions r etr act their actions when the conditions are no longer met this will b e discussed later The other function selecting the curren t op erator in v olv es making a decision once sucien t kno wledge has b een retriev ed This is p erformed b y Soar s de cision pr o c e dur e whic h is a xed pro cedure that in terprets pr efer enc es that ha v e b een created b y the retriev al functions The kno wledge retriev al and decision making functions com bine to form Soar s de cision cycle When the kno wledge to p erform the problem solving functions is not directly a v ailable in pro ductions Soar is unable to mak e progress and reac hes an imp asse There are three t yp es of p ossible impasses in Soar An op erator cannot b e selected b ecause none are prop osed An op erator cannot b e selected b ecause m ultiple op erators are prop osed and the comparisons are insucien t to determine whic h one should b e selected An op erator has b een selected but there is insucien t kno wledge to apply it In resp onse to an impasse the Soar arc hitecture creates a substate in
86. mean that the pro duction is using a very large amoun t of memory Example soar gt memories chunk Memory use for productions chunk chunk chunk 0 CHAPTER THE SO AR USER INTERF A CE preferences id attribute 0 n none names t im et ag s w me s The preferences command prin ts the curren t preferences for the sp ecied iden tier and attribute an optional third argumen t increases the lev el of detail If no argu men ts are sp ecied the id and attribute default to the curren t state and op erator resp ectiv ely This command is useful for examining whic h candidate op erators ha v e b een prop osed and what relationships if an y exist among them If a preference has O supp ort the string O will also b e prin ted The optional argumen ts to the preferences command are describ ed in the follo wing table The n umeric and named ags are redundan t one ma y use either a n um b er or a name to sp ecify the lev el of detail preferences Eect on output 0 none Prin t only the preferences themselv es default names Also prin t the names of the pro ductions that generated these preferences timetags Also prin t the timetags of the WME s that matc hed the
87. name build tower S problem space P P name top ps S object dynamic T S operator O O name build tower S problem space P 0 CHAPTER THE SO AR USER INTERF A CE P name top ps S object dynamic B S operator O O name build tower S problem space P P name top ps S object dynamic B S operator O O name build tower S problem space P P name top ps 0 S object dynamic B Matches for Right lt blockc gt name c lt tower gt middle block lt blockb gt lt blockb gt name b lt tower gt top block lt blocka gt lt blocka gt name a 0 complete matches Notes When prin ting partial matc h information some of the matc hes displa y ed b y this command ma y ha v e already red dep ending on when in the execution cycle this command is called T o c hec k for the matc hes that are ab out to re use the matches command without a named pro duction In Soar the execution cycle decision cycle is input prop ose decide apply output it no longer stops for user input after the decision phase when running b y decision cycles run d If a user wishes to prin t the matc h set immediately after the de
88. nil I6 io red blue yellow 0 0 1 0 2 0 3 0 0 1 0 2 output link O3 moving block B1 name move block x location y location 1 0 x destination y destinaion 2 1 Figure An example p ortion of the output link for the blo c ks w orld task Then during the Apply Phase of the execution cycle Soar pro ductions could resp ond to an op erator suc h as mo v e the red blo c k on top of the blue blo c k b y creating a structure on the output link suc h as S io I A I output link I A I name move block I moving block B I x destination I y destination B x location B y location 0 B color red The A notation is used to indicate the w orking memory elemen ts that are created b y the arc hitecture and not b y pro ductions An output function w ould lo ok for sp ecic structure in this output link and translate this in to the format required b y the external program that con trols the rob otic arm Mo v emen t b y the rob otic arm w ould lead to c hanges in the vision system whic h w ould later b e rep orted on the input link Input and output are view ed from Soar s p ersp ectiv e An input function adds or deletes
89. ob ject that is link ed to a sup erstate The results pro duced b y a single pro duction ring are the basis for creating the actions of a c h unk A new result can lead to other results b y linking a sup erstate to a WME in the substate This WME ma y in turn link other WMEs in the substate to the sup erstate making them results Therefore the creation of a single WME that is link ed to a sup erstate can lead to the creation of a large n um b er of results All of the newly created results b ecome the basis of the c h unk s actions T racing the creation and reference of w orking memory elemen ts Soar automatically main tains information on the creation of eac h w orking memory elemen t in ev ery state When a pro duction res a trace of the pro duction is sa v ed with the appropriate state A tr ac e is a list of the w orking memory elemen ts matc hed b y the pro duction s conditions together with the actions created b y the pro duction The appropriate state is the most recen tly created state i e the state lowest in the subgoal hierarc h y that o ccurs in the pro duction s matc hed w orking memory elemen ts Recall that when a subgoal is created the item augmen tation lists all v
90. off CHAPTER THE SO AR USER INTERF A CE justifications off WME detail level Working memory changes off Preferences generated by firings retractions off Learning noprint watch creation of chunks just Backtracing off Alias printing null Loading on soar gt watch phases off soar gt watch Current watch settings Decisions on Phases off Production firings retractions default productions on user productions on chunks on justifications on WME detail level Working memory changes off Preferences generated by firings retractions off Learning noprint watch creation of chunks just Backtracing off Alias printing null Loading on soar gt Notes In order to w atc h preferences or wmes users m ust also w atc h productions Pref erences and WMEs can b e watched only if the pro ductions that create them are watched So if only user pro ductions are b eing w atc hed then an y preference or wme activit y resulting from defaults and chunks will not b e prin ted Only when a on off switc h is sp ecied are the other curren t settings pre serv ed When using an inclusiv e or n umeric setting all lev els are turned o and only the appropriate settings are turned bac k on CONFIGU
91. particular typ es of pro ductions using one or more of the ags in the follo wing table pro d t yp e eect on prin ting b eha vior user prin t memory usage of user dened pro ductions default prin t memory usage of default pro ductions c h unks prin t memory usage of c h unks justications prin t memory usage of justications The memories command is used to nd the pro ductions that are using the most memory and therefore ma y b e taking the longest time to matc h this is only a heuristic By iden tifying these pro ductions y ou ma y b e able to rewrite y our program so that it will run more quic kly Note that memory usage is just a heuristic measure of the matc h time A pro duction migh t not use m uc h memory relativ e to others but ma y still b e time consuming to matc h and excising a pro duction that uses a large n um b er of tok ens ma y not sp eed up y our program b ecause the Rete matc her shares common structure among dieren t pro ductions As a rule of th um b n um b ers less than 00 mean that the pro duction is using a small amoun t of memory n um b ers ab o v e 000 mean that the pro duction is using a large amoun t of memory and n um b ers ab o v e 0 000
92. prin ts stack prin ts the curren t subgoal stac k operators prin t only the op erators states prin t only the states Examples soar gt print stack gt S S O O move block EXAMINING MEMOR Y production find f lhs rhs chunks noch un ks n show binding s fpattern g g The production find command is used to nd pro ductions in pro duction memory that include conditions or actions that matc h a giv en pattern The pattern giv en sp ec ies one or more condition elemen ts on the lefthand side of pro ductions or negated conditions or one or more actions on the righ thand side of pro ductions An y p attern that can app ear in pro ductions can b e used in the production find command In addition the asterisk sym b ol can b e used as a wildcard for an attribute or v alue It is imp ortan t to note that the whole p attern including the paren thesis m ust b e enclosed in curly braces for it to b e parsed prop erly The v ariable names used in a call to production find do not ha v e to matc h the v ariable names used in the pro ductions b eing retriev ed The production find command can also b e restricted to apply to only certain t yp es of pro ductions or to lo ok only
93. pro ductions that generated the preferences wmes Also prin t the WME s that matc hed the pro ductions Example soar gt preferences Preferences for S operator acceptables O0 move block O move block O move block reconsiders O move block unary indifferents O0 move block O move block O move block soar gt soar gt preferences s operator Preferences for S operator acceptables EXAMINING MEMOR Y 0 O0 move block From blocks world propose mo ve b lock O move block From blocks world propose mo ve b lock O move block From blocks world propose mo ve b lock reconsiders O move block From blocks world terminate move blo ck unary indifferents O0 move block From blocks world compare mo ve b lock ind iff eren t O move block From blocks world compare mo ve b lock ind iff eren t O move block From blocks world compare mo ve b lock ind iff eren t soar gt print internal name full filename n fprodname all chunks de fa ul ts n justifications us er g print depth n internal n fidentifier timetag pattern g print stack state oper at or The print command prin ts information ab out items in pro duction memory and w ork ing mem
94. relationship b et w een ob jects in w orking memory and real ob jects in the outside w orld Ob jects in w orking memory ma y refer to real ob jects suc h as block A a feature of an ob ject suc h as the color red a relation b et w een ob jects suc h as ontop classes of ob jects suc h as blocks etc The names of attributes and v alues ha v e no meaning to the Soar arc hitecture aside from a few WME s created b y the arc hitecture itself F or example Soar do esn t care whether the things in the blo c ks w orld are called blo c ks or cub es or c handeliers It is up to the Soar programmer to pic k suitable names and to use them consisten tly The elemen ts in w orking memory come from one of four sources The actions of pro ductions create most w orking memory elemen ts The actions of pro ductions m ust not create or mo dify the w orking memory elemen ts created b y the decision pro cedure or the I O system describ ed b elo w The decision pro cedure automatically creates some sp ecial state augmen tations t yp e sup erstate impasse when a state is created States are created during initialization the rst state or b ecause of an impasse a substate The decisi
95. should ha v e red A t lev els and EXAMINING MEMOR Y 0 or timetags and wmes argumen ts the matches command displa ys the WME s immediately after the rst condition that failed to matc h temp orarily in terrupting the prin ting of the pro duction conditions themselv es Examples soar gt run d 0 gt S S Initial state has A on B and B and C on the table The goal is to get A on B on C on the table O O build tower soar gt matches top goal terminate operato r bu ild tow er state lt g gt operator lt o gt lt o gt name build tower lt g gt problem space lt p gt lt p gt name top ps lt g gt object dynamic lt tower gt gt gt gt gt lt tower gt bottom block lt blockc gt lt blockc gt name c lt tower gt middle block lt blockb gt lt blockb gt name b lt tower gt top block lt blocka gt lt blocka gt name a 0 complete matches soar gt matches top goal terminate operato r bu ild tow er wmes state lt g gt operator lt o gt lt o gt name build tower lt g gt problem space lt p gt lt p gt name top ps lt g gt object dynamic lt tower gt gt gt gt gt lt tower gt bottom block lt blockc gt Matches For Left S operator O O
96. soar gt add wme I block on table W arning The add wme command ma y ha v e w eird side eects p ossibly ev en including system crashes when used outside its in tended role It should only b e in v ok ed during the Input Phase of Soar s execution cycle Also note that Soar s c h unking mec hanism can t bac ktrace through w orking memory elemen ts created via add wme io add input script id io add output script id io delete f input output g id io list f input outputg Recall from section that Soar I O is accomplished via input functions and out put functions whic h manipulate augmen tations of the top lev el io attribute Input functions are called at the start of ev ery execution cycle to add and remo v e w orking memory elemen ts on the io input link Output functions are pro cessed at the end of ev ery execution cycle in resp onse to c hanges made to the io output link Input and output functions are r e gister e d with Soar using the io command The io command allo ws users to add and delete input and output functions and list all curren tly registered functions SO AR I O COMMANDS Adding I O functions Deleting I O functions Listing I O functions The metho
97. soar gt max elaborations 0 soar gt max elaborations 0 multi attributes attribute n The multi attributes command is used b efore pro ductions are loaded to declare attributes that are m ulti attributes i e they will routinely ha v e m ultiple v alues The information pro vided b y this command is used b y the Rete matc her whic h reorders the conditions of pro ductions heuristically in an attempt to increase the sp eed of the matc hing pro cess The sp ecied attribute is the name of an attribute that ma y tak e on m ultiple v alues the optional n is an in teger greater than 0 indicating an upp er limit on the n um b er of exp ected v alues that will app ear for the attribute If n is not sp ecied the CHAPTER THE SO AR USER INTERF A CE v alue 0 is used for eac h declared m ulti attribute More informed v alues will tend to result in greater eciency This declaration is not required It also has no ee ct on the con ten ts of w orking memory Instead the multi attributes command is used only to increase the eciency of the matc her so that Soar can ha v e heuristic information ab out m ulti attributes a v ailable when it in ternally reorders pro duction conditions in the Rete net Wit
98. sp ecied Soar will b y default prin t the names of all pro ductions of that t yp e The ags name full can b e used to o v erride the defaults and prin t the en tire pro duction for all of the sp ecied t yp e or prin t only the name for named pro ductions whic h seems rather silly The ag filename mo dies the output of print to include the name of the le that stores the pro duction This is particularly useful when pro ductions are stored in m ultiple les that all get loaded when the program starts The ag internal is used to prin t pro ductions as they app ear in the Rete with the conditions in their reordered form Examples EXAMINING MEMOR Y 0 soar gt print filename blocks world compare move blo ck i ndif fere nt sourcefile blocks world soar sp blocks world compare move bl ock indi ffer ent state lt s gt operator lt o gt lt o gt name move block gt lt s gt operator lt o gt soar gt print u c omment need the info for the example Notes The ags internal name full and filename m ust b e sp ecied on the com mandline b efor e the pro duction name or t yp e Prin ting items in w orking memory Usage print depth n internal fide
99. tcl MakeANote lt o gt will pro duce the string MakeANote x whic h will then b e executed in the Tcl in terpreter This will call the Tcl pro cedure Mak eANote presumably dened b y the user with the single argumen t x The tcl RHS function returns its result as a sym b olic constan t so that Tcl results can b e used in functional comp ositions F or example the log of a n um b er lt x gt could b e prin ted this w a y sp gt write The log of lt x gt is tcl expr log lt x gt Con trolling learning Soar s learning mec hanism called Ch unking is describ ed in Chapter The follo wing t w o functions are pro vided as RHS actions to assist in dev elopmen t of Soar programs they are not in tended to corresp ond to an y theory of learning in Soar This functionalit y is pro vided as a dev elopmen t to ol so that learning ma y b e turned o in sp ecic problem spaces prev en ting otherwise buggy b eha vior The dont learn and force learn RHS actions are to b e used with sp ecic settings for the learn command see page Using the learn command learning ma y b e set to one of on off except or only learning m ust b e set to except for
100. the dont learn RHS action to ha v e an y eect and learning m ust b e set to only for the force learn RHS action to ha v e an y eect CHAPTER THE SYNT AX OF SO AR PR OGRAMS dont learn When learning is set to except b y default c h unks can b e formed in all states the dont learn RHS action will cause learning to b e turned o for the sp ecied state sp turn learning off state lt s gt feature feature feature gt dont learn lt s gt The dont learn RHS action applies when learn is set to except and has no eect when other settings for learn are used force learn When learning is set to only b y default c h unks are not formed in an y state the force learn RHS action will cause learning to b e turned on for the sp ecied state sp turn learning on state lt s gt feature feature feature gt force learn lt s gt The force learn RHS action applies when learn is set to only and has no eect when other settings for learn are used Impasses in W orking Memory and in Pro duc tions When the preferences in preference memory cannot b e resolv ed unam biguously Soar reac hes an impasse as describ ed in Section When Soar is unable to select a new op erator in
101. the ob ject for eac h item matc hed in this example six op erator preferences are matc hed in the same ob ject and no other op erator preferences exist soar gt print S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space bloc
102. the pro duction is prin ted using the print command Pro duction t yp e optional A pro duction ma y also include an optional pr o duction typ e whic h ma y sp ecify that the pro duction should b e considered a default pro duction default or a c h unk chunk or ma y sp ecify that a pro duction should b e giv en O supp ort o support or I supp ort i support Users are discouraged from using these t yp es These t yp es are describ ed in Section whic h b egins on P age PR ODUCTION MEMOR Y Commen ts optional Pro ductions ma y con tain commen ts whic h are not stored in Soar when the pro duction is loaded and are therefore not prin ted out b y the print command A commen t is b egun with a p ound sign c haracter and ends at the end of the line Th us ev erything follo wing the is not considered part of the pro duction and commen ts that run across m ultiple lines m ust eac h b egin with a F or example sp blocks world propose move bl ock state lt s gt problem space blocks thing lt thing gt lt gt lt thing gt lt thing gt ontop lt ontop gt lt thing gt type block clear yes lt thing gt clear yes lt ontop gt top block lt thing gt
103. the user is not in terested in an agen t s prin ted output In that case the prin ted output can b e discarded whic h results in faster pro cessing for the agen t as w ell Some Soar commands r eturn results and some print results If the user wishes to ha v e prin ted results returned so that they can b e sa v ed for later use i e sa v ed to a v ariable then this command can cause the prin ted output to b e app ended to the returned result The prin ting facilit y is implemen ted as a stac k so newly installed prin t redirections are in force un til p opp ed o the stac k This is done to allo w easy transien t redirection supp orting the restoration of prior prin ting con texts after completing a prin ting task Hence there are t w o primary functions push action and pop The pop function tak es no additional argumen ts as it serv es only to p op the prin t redirection stac k to re establish the prior prin ting con text The push action tak es one of the follo wing additional argumen ts push argumen ts eect append to result Instead of simply prin ting command output app end the output string to the result returned b y the command channel open fid Redirect prin ting to the op en c
104. these arc hitecturally dened attributes and their p ossible v al ues will help y ou to write pro ductions that test for the presence of sp ecic t yp es of impasses so that y ou can attempt to resolv e the impasse in a manner appropriate to y our program Man y of the default pro ductions in the demos defaults directory of the Soar distribution pro vide means for resolving certain t yp es of impasses Y ou ma y wish to mak e use of some of all of these pro ductions or merely use them as guides for writing y our o wn set of pro ductions to resp ond to impasses Examples The follo wing is an example of a substate that is created for a tie among three op erators S type state impasse tie choices multiple attribute operator superstate S item O O0 O quiescence t 0 CHAPTER THE SYNT AX OF SO AR PR OGRAMS The follo wing is an example of a substate that is created for a no c hange impasse to apply an op erator S type state impasse no change choices none attribute operator superstate S quiescence t S operator O T esting for impasses in pro ductions Since states app ear in w orking memory they ma y also b e tested for in the conditions of pro ductions There are n umerous examples o
105. they exist Chapter describ es the Soar user in terface ho w the user in teracts with Soar The user in terface commands are presen ted in b eginning in termediate and adv anced functionalit y to assist new users in iden tifying those commands that are exp ected to b e most useful to them The commands in the user in terface are listed in alphab etical order on the bac k co v er of the man ual for quic k reference Adv anced users will refer most often to Chapter ipping bac k to Chapters and to answ er sp ecic questions There are sev eral app endices included with this man ual App endix is a glossary of terminology used in this man ual App endix con tains an example Soar program for a simple v ersion of the blo c ks w orld This blo c ks w orld program is used as an example throughout the man ual App endix is an o v erview of example programs curren tly a v ailable pro vided with the Soar distribution with explanations of ho w to run them and p oin ters to other help sources a v ailable for no vices App endix describ es Soar s default kno wledge whic h can b e used or not with an y Soar task App endix pro vides a grammar for Soar pro ductions App endix pro
106. thi s PR ODUCTION MEMOR Y state lt s gt problem space blocks clear block lt block gt clear block lt gt lt block gt lt block gt ontop top block lt block gt ontop bottom block lt gt lt block gt lt block gt type block gt This is not advisable b ecause it corresp onds to a dieren t set of conditions than those in the original pro duction the top block and bottom block need not corresp ond to the same ontop relation T o c hec k this w e could prin t the original pro duction at the Soar prompt soar gt print blocks world propose mov e bl ock don t do thi s sp blocks world propose move bl ock dont do thi s state lt s gt problem space blocks thing lt thing gt thing lt gt lt thing gt lt thing gt ontop lt o gt ontop lt o gt lt thing gt clear yes lt thing gt clear yes type block lt o gt top block lt thing gt lt o gt bottom block lt gt lt thing gt lt b gt gt lt s gt operator lt o gt lt o gt name move block moving block lt thing gt destination lt thing gt Soar has expanded the pro duction in to the longer form and created t w o distinctiv e v ariables lt o gt and lt o gt to represen t the ontop attribu
107. this command then most w arnings are supressed but some aren t b ecause they are to o imp ortan t to b e ignored The w arnings that are prin ted apply to the syn tax of the pro ductions to notify the user when they are not in the correct syn tax When a lefthand side error is disco v ered suc h as conditions that are not link ed to a common state or impasse ob ject the pro duction is generally loaded in to pro duction memory an yw a y although this pro duction ma y nev er matc h or ma y seriously slo w do wn the matc hing pro cess Righ thand side errors suc h as preferences that are not link ed to the state usually result in the pro duction not b eing loaded CHAPTER THE SO AR USER INTERF A CE Example soar gt warnings off soar gt warnings off watch 0 watch none decisions phases productions n wmes preferences on off in c lu si ve watch productions all default user n chunks justificatio ns n f print nopri nt g nowmes time ta gs fu ll wm es watch wmes filter options watch learning print noprint fullprint watch aliases on off watch loading on off watch backtracing on off The watch command con trols the
108. this section can b e nested to an y depth F or all of the functions in this section missing or non n umeric argumen ts result in an error These sym b ols pro vide prex notation mathematical functions These sym b ols w ork similarly to C functions They will tak e either in teger or real n um b er argumen ts The rst three functions return an in teger when all argumen ts are in tegers and otherwise return a real n um b er and the last t w o functions alw a ys return a real n um b er The sym b ol is also a unary function whic h giv en a single argumen t returns the pro duct of the argumen t and sp gt lt s gt sum lt x gt lt y gt CHAPTER THE SYNT AX OF SO AR PR OGRAMS product sum lt v gt lt w gt lt x gt lt y gt big sum lt x gt lt y gt lt z gt 0 negative x lt x gt div mod These sym b ols pro vide prex notation binary mathematical func tions they eac h tak e t w o argumen ts These sym b ols w ork similarly to C func tions They will tak e only in teger argumen ts using reals results in an error and return an in teger div tak es t w o in tegers and returns their in teger quotien t mod returns their
109. time statistics w arnings T oggle whether or not w arnings are prin ted CHAPTER THE SO AR USER INTERF A CE w atc h Con trol the information prin ted as Soar runs Of these commands watch is the most often used and the most complex pwatch is related to watch but applies only to sp ecic named pro ductions firing counts and stats are useful for understanding ho w m uc h w ork Soar is doing Both format watch and chunk name format are less frequen tly used but they allo w for detailed con trol of Soar s output monitor is esp ecially useful when in teracting with an external en vironmen t but can b e used an ytime it is useful to alw a ys tak e a sp ecic action at a sp ecic p oin t in Soar s execution cycle The monitor command is discussed in more depth in the So ar A dvanc e d Applic ations Manual chunk name format short long n prefix prefix count n The c h unk name format command sp ecies the format to b e used when naming newly created c h unks ag Eect on c h unk name short Use the short format for naming c h unks long Use the long format for naming c h unks default prefix string If string is giv en use string as the prex for naming c h unks Otherwise
110. ting a goal explicitly has man y adv an tages some goals are dicult to explicitly represen t on the state The goal in our blo c ks w orld task is represen ted implicitly in the Soar program A single pro duction rule monitors the state for completion of the goal and halts Soar when the goal is ac hiev ed Prop osing candidate op erators As a rst step in selecting an op erator one or more candidate op erators are prop osed Op erators are prop osed b y rules that test features of the curren t state When the blo c ks w orld task is run the Soar program will prop ose six dieren t but similar op erators for the initial state as illustrated in Figure These op erators corresp ond to the six dieren t actions that are p ossible giv en the initial state CHAPTER THE SO AR AR CHITECTURE B1 B1 is a block B1 is named A B1 is clear B2 B2 is a block B2 is named B B2 is clear B3 B3 is a block B3 is named C B3 is clear T1 T1 is a table T1 is named table T1 is clear S1 O1 has a top block B1 O1 has a bottom block T1 O1 O2 O2 has a top block B2 O2 has a bottom block T1 O3 O3 has a top block B3 O3 has a bottom block T1 O7 O7 is named move block O7 has moving block B3 O7 has destination B2 O4 O5 O6 O8 O9 O7 S
111. um b er of the c h unk and c h unk n um b ers are examined during pro duction loading to allo w a starting c h unk n um b er to b e iden tied automatically impasse type is the impasse of the lo w est goal that whose result generated this c h unk Examples Default naming of c h unks uses the long form soar gt print c chunk d opnochange chunk d tie chunk d opnochange chunk d tie chunk d opnochange T o name c h unks according to the old pre Soar sc heme soar gt chunk name format short prefix chunk count 0 T o b egin naming a new sequence of c h unks of the form new chunkn where n starts with and is incremen ted b y for eac h new c h unk soar gt chunk name format short prefix new chunk T o b egin n um b ering a new sequence of c h unks at 000 soar gt chunk name format count 000 T o retriev e the next chunk num that will b e used to form a c h unk name soar gt chunk name format count firing counts n prodname s The firing counts command prin ts the n um b er of times eac h pro duction has red pro duction names are giv en from most frequen tly red to least frequen tly red With no argumen ts it lists al l pro ductions If an in teger argumen t n
112. whic h op erators can b e selected and applied to generate or delib erately retriev e the kno wledge that w as not directly a v ailable the goal in the substate is to resolv e the impasse F or example in a substate a Soar program ma y do a lo ok ahead searc h to compare candidate op erators if comparison kno wledge is not directly a v ailable Impasses and substates are describ ed in more detail in Section An Example T ask The Blo c ks W orld W e will use a task called the blo c ks w orld as an example throughout this man ual In the blo c ks w orld task the initial state has three blo c ks named A B and C on a table 0 CHAPTER THE SO AR AR CHITECTURE C Goal C Initial State A B B A Figure The initial state and goal of the blo c ks w orld task the op erators mo v e one blo c k at a time to another lo cation on top of another blo c k or on to the table and the goal is to build a to w er with A on top B in the middle and C on the b ottom The initial state and the goal are illustrated in Figure The Soar co de for this task is included in App endix it is also included with the Soar release along with other example programs in the le manual blo
113. y also b e used with attributes as in sp blocks example production co ndit ions state operator lt o gt table lt t gt lt t gt lt ta gt lt gt name table gt whic h tests that the ob ject with its iden tier b ound to lt t gt m ust ha v e an attribute whose v alue is table and the name of this attribute is not name and the name of this attribute whatev er it is is b ound to the v ariable lt ta gt PR ODUCTION MEMOR Y When attribute predicates or attribute disjunctions are used with m ulti v alued at tributes the pro duction is rewritten in ternally to use a conjunctiv e test for the at tribute the conjunctiv e test includes a v ariable used to bind to the attribute name Th us lt p gt type father lt gt name sue sally is in terpreted to mean lt p gt type father lt gt name lt a gt sue lt a gt sally A ttribute path notation Often v ariables app ear in the conditions of pro ductions only to link the v alue of one attribute with the iden tier of another attribute A ttribute path notation pro vides a shorthand so that these in termediate v ariables do not need to b e included Syn tactically path notation lists a sequence of attributes se
114. yp e Syn tactically eac h pro duction consists of the sym b ol sp follo w ed b y an op ening curly brace f the pro duction s name the do cumen tation string optional the pro duction PR ODUCTION MEMOR Y sp blocks world propose move bl ock state lt s gt problem space blocks thing lt thing gt lt gt lt thing gt lt thing gt ontop lt ontop gt lt thing gt type block clear yes lt thing gt clear yes lt ontop gt top block lt thing gt bottom block lt gt lt thing gt gt lt s gt operator lt o gt lt o gt name move block moving block lt thing gt destination lt thing gt Figure An example pro duction from the example blo c ks w orld task t yp e optional commen ts optional the pro duction s conditions the sym b ol gt literally dash dash greaterthan the pro duction s actions and a closing curly brace g Eac h elemen t of a pro duction is separated b y white space Inden tation and linefeeds are used b y con v en tion but are not necessary sp production name Documentation string type CONDITIONS gt ACTIONS An example pro duction named blocks world propose move b lock is sho wn in Figure This pro duction prop oses op erators named
115. 0 000 0 00 0 000 0 000 0 000 0 00 Other 0 00 0 00 0 0 0 0 00 0 0 0 Operand 0 000 0 00 0 000 0 00 0 000 0 000 0 0 Input fn 0 00 0 00 Outpt fn 0 00 0 00 Callbcks 0 00 0 000 0 00 0 00 0 00 0 0 0 0 Derived Totals 0 0 0 00 0 0 0 0 00 0 0 Values from single timers Kernel CPU Time 0 sec Total CPU Time 0 sec decision cycles msec dc elaboration cycles 0 ec s per dc msec ec p elaboration cycles 0 pe s per dc 000 msec pe production firings pf s per ec msec pf wme changes additions removals match time msec wm change WM size current 0 mean 0 maximum Time lt x gt statistics use the total kernel time from a single kernel timer Differences between this value and the derived total kernel time are expected See help for the stats command for more
116. 1 is a state S1 has a problem space blocks S1 has a thing B1 S1 has a thing B2 S1 has a thing B3 S1 has a thing T1 S1 has an ontop O1 S1 has an ontop O2 S1 has an ontop O3 S1 has operator O7 S1 has six proposed operators O4 is named move block O4 has moving block B2 O4 has destination B1 O5 is named move block O5 has moving block B3 O5 has destination B1 O6 is named move block O6 has moving block B1 O6 has destination B2 O8 is named move block O8 has moving block B1 O8 has destination B3 O9 is named move block O9 has moving block B2 O9 has destination B3 links from operators to blocks are omitted for simplicity An Abstract View of Working Memory Figure An abstract illustration of w orking memory in the blo c ks w orld after the rst op erator has b een selected C Initial State A B C B A move A on top of B C B A move A on top of C C A B move B on top of A C A B move B on top of C A C B move C on top of A A C B move C on top of B Figure The six op erators prop osed for the initial state of the blo c ks w orld eac h mo v e one blo c k to a new lo cation AN O VER VIEW OF SO AR Comparing candidate op erators Preferences The second step Soar tak es in selecting an op erator is to ev aluate or compare the candidate op
117. ASSES AND SUBST A TES either a new op erator is selected for the curren t state but no additional pro ductions matc h during the application phase or a new op erator is not selected during the next decision phase There can b e only one t yp e of impasse at a giv en lev el of subgoaling at a time Giv en the seman tics of the preferences it is p ossible to ha v e a tie or conict impasse and a constrain t failure impasse at the same time In these cases Soar detects only the constrain t failure impasse The impasse is detected during the selection of the op erator but happ ens b e c ause one of the other four problem solving functions w as incomplete Creating New States Soar handles these inconsistencies b y creating a new state in whic h the goal of the problem solving is to resolv e the impasse Th us in the substate op erators will b e selected and applied in an attempt either to disco v er whic h or the tied op erators should b e selected or to apply the selected op erator piece b y piece The substate is often called a sub go al b ecause it exists to resolv e the impasse but is sometimes called a substate b ecause the represen tation of the subgoal in Soar is as a state The initial state
118. Application Pro ductions re to apply the op erator op erator application The actions of these pro ductions will b e O supp orted Because of c hanges from op erator application pro ductions other pro ductions with I supp orted actions ma y also matc h or retract Just as during prop osal pro ductions re and retract in parallel un til quiescence Output Output commands are sen t to the external en vironmen t The cycles con tin ue un til the halt action is issued from the Soar program as the action of a pro duction or un til Soar is in terrupted b y the user During the pro cessing of these phases it is p ossible that the preferences that resulted in the selection of the curren t op erator could c hange Whenev er op erator preferences c hange the preferences are re ev aluated and if a dieren t op erator selection w ould b e made then the curren t op erator augmen tation of the state is immediately re mo v ed Ho w ev er a new op erator is not selected un til the next decision phase when all kno wledge has had a c hance to b e retriev ed Impasses and Substates When the decision pro cedure is applied to ev aluate preferences and determine the op erator augmen tation of the state it is p ossib
119. E SO AR USER INTERF A CE soar8 on off Signican t arc hitectural c hanges w ere made to Soar b et w een v ersion and v ersion The soar command allo ws users to rev ert to the Soar metho dology in order to run older Soar programs Both pro duction memory and w orking memory m ust b e empt y to toggle b et w een Soar mo de and Soar mo de The soar command with no argumen ts returns the curren t mo de the default is that soar is on This command ma y not b e a v ailable in future v ersions of Soar as main taining b oth arc hitectures in the same source co de is cum b ersome and ma y lead to problems as more c hanges are in tro duced soar eect on Soar on use the Soar metho dology default off use the Soar metho dology Users are referred to the R ele ase Notes for So ar for detailed information on the dierences b et w een the t w o arc hitectures 0 waitsnc on off In some systems esep cially those that mo del exp ert fully c h unk ed kno wledge a state no c hange ma y represen t a wait state rather than an impasse The waitsnc com mand allo ws users to an ticipate this situation and cause Soar to generate a w ait state whenev er a state no change impasse w o
120. ENTS v alias Dening command aliases 0 source default 0 predefined aliases 0 soarnews 0 The soar library soar tcl le unalias version vi CONTENTS List of Figures Soar is con tin ually trying to select and apply op erators The initial state and goal of the blo c ks w orld task 0 An abstract illustration of the initial state of the blo c ks w orld as w orking memory ob jects A t this stage of problem solving no op erators ha v e b een prop osed or selected An abstract illustration of w orking memory in the blo c ks w orld after the rst op erator has b een selected
121. Ev en t F or example a user ma y wish to examine an agen t s matc hes after the Soar Decision Phase In order to do this in Soar the user m ust register a monitor or callbac k to issue the stop soar self command for the after decision phase cycle ev en t Example soar gt monitor add stop soar self after decision phase after decision phase cyc le The ab o v e example sho ws ho w to stop Soar after the decision phase using stop soar self in a monitor to stop after the decision phase so that memory can b e examined Notes If the graphical in terface do esn t p erio dically do a Tcl up date command then it ma y not b e p ossible to in terrupt a Soar agen t from the command line CHAPTER THE SO AR USER INTERF A CE When using the TSI the stop soar command is redened b y the TSI to also pause the in terface itself Examining Memory This section describ es the commands used to insp ect pro duction memory w orking memory and preference memory to see what pro ductions will matc h and re in the next Prop ose or Apply phase and to examine the goal dep endency set These commands are particularly useful when running or debugging Soar as they let users see what Soar is thinking
122. RING SO AR S R UNTIME P ARAMETERS algorithms or metho dologies Users can congure Soar s learning mec hanism exam ine the bac ktracing information that supp orts c h unks and justications pro vide hin ts that could impro v e the eciency of the Rete matc her limit runa w a y c h unking and pro duction ring c ho ose an alternativ e algorithm for determining whether a w orking memory elemen t receiv es O supp ort and congure options for selecting b et w een m u tually indieren t op erators There is also a mo de for allo wing users to rev ert to Soar metho dology The sp ecic commands describ ed in this section are Summary explain bac ktraces Prin t information ab out c h unk and justication bac ktraces indieren t selection Con trols ho w indieren t selections are made learn Set the parameters for c h unking Soar s learning mec hanism max c h unks Limit the n um b er of c h unks created during a decision cycle max elab orations Limit the maxim um n um b er of elab oration cycles m ulti attributes Declare m ulti attributes so as to increase Rete matc h ing eciency o supp ort mo de Cho ose exp erimen tal v ariations of o supp ort sa v e bac ktraces Sa v e trace informatio
123. RING TRA CE INF ORMA TION AND DEBUGGING W atc hing Pro ductions By default the names of the pro ductions are prin ted as eac h pro duction res and retracts at watch lev els and higher Ho w ev er it ma y b e more helpful to w atc h only a sp ecic typ e of pro duction The tracing of rings and retractions of pro ductions can b e limited to only certain t yp es b y mo difying the watch productions on off inc command using the follo wing ags ag subset of pro ductions all applies to all pro ductions defaults applies to default pro ductions only user applies to user pro ductions only chunks applies to c h unks only justifications applies to justications only follo w ed b y either print or noprint And in the future users should b e able to sp ecify fullprint to get the full pro duction prin ted instead just the pro duction name Eac h typ e ma y also b e sp ecied with its unique rst letter for example d is equiv alen t to defaults Com binations ma y b e formed b y com bining letters suc h as cj to sp ecify c h unks and justications Note that substrings longer than the unique rst letter will not w ork in this con text either the rst letter only or the full string m ust
124. The Soar User s Man ual V ersion Edition John E Laird Clare Bates Congdon and Karen J Coulter Electrical Engineering and Computer Science Departmen t Univ ersit y of Mic higan Draft of June Dr aft Do not quote or distribute Err ors may b e r ep orte d to John E L air d lair d umich e du Cop yrigh t c J E Laird C B Congdon and K J Coulter Dev elopmen t of earlier v ersions of this man ual w ere supp orted under con tract N000 K 0 from the Adv anced Systems T ec hnology Oce of the Adv anced Researc h Pro jects Agency and the Na v al Researc h Lab oratory and con tract N00 C 0 from the Adv anced Systems T ec hnology Oce of the Adv anced Researc h Pro jects Agency and the Na v al Command and Ocean Surv eillance Cen ter RDT amp E division c omment Con ten ts List of Figures vii Preface ix In tro duction Using this Man ual Other Soar Do cumen tation Con tacting the Soar Group A Note on Dieren t Platforms and Op erating Systems A Note on
125. V ariable argumen ts suc h as a le name or an in teger are in an italic fon t for example filename The commandline prompt that is prin ted b y Soar is normally the agen t name follo w ed b y gt In the examples in this man ual w e use soar gt Some of the command sp ecications are to o long to t on one line In suc h cases a bac kslash n is used to con tin ue the command on the next line The bac kslash is not part of the command itself it is the Tcl syn tax for con tin uing a long command on m ultiple lines F ollo wing Tcl syn tax commen ts in the examples are preceded b y a and in line commen ts are preceded b y F or man y commands there is some exibilit y in the order in whic h the argumen ts ma y b e giv en See the online help for eac h command for more information W e ha v e not incorp orated this exible ordering in to the syn tax sp ecied for eac h command b ecause doing so complicates the sp ecication of the command When the order of argumen ts will aect the output pro duced b y a command the reader will b e alerted Basic Commands for Running Soar This section describ es the commands used to start run and stop a Soar program to in v ok e
126. a y t yp e q to scroll do wn through the man ual page hit the space bar Soar s help facilit y is able to do command completion so as long as a unique substring of the c ommand name is sp ecied Soar will nd and displa y the help page If the substring is not unique a message listing the p ossible c hoices is prin ted When called with usage and a c ommand name help will displa y only a brief de scription of the syn tax for that command Example soar gt help Commonly used Soar commands cd Change to another directory excise Remove productions from Soar s memory init soar Reinitialize Soar learn Turn learning on and off log Save a Soar session to a file matches Print info about the match set and partial matches preferences Display items in preference memory print Display productions or working memory elements pwd Display the current working directory quit Exit Soar run Run the Soar decision cycle soarnews Display information such as where to report bugs source Load a file into Soar sp Define a Soar production CHAPTER THE SO AR USER INTERF A CE version Display the version number of Soar watch Set the amount of information displayed as Soar runs wmes alias to display working memory elements For
127. alues that lead to the impasse Ch unking is complicated b y the fact that the item augmen tation of the substate is created b y the arc hitecture and not b y pro ductions Bac ktracing cannot determine the cause of these substate augmen tations in the same w a y as other w orking memory elemen ts T o o v ercome this Soar maps these augmen tations on to the acceptable preferences for the op erators in the item augmen tations Negated conditions Negated conditions are included in a trace in the follo wing w a y when a pro duction res its negated conditions are fully instan tiated with its v ariables appropriate v al ues This instan tiation is based on the w orking memory elemen ts that matc hed the pro duction s p ositiv e conditions If the v ariable is not used in an y p ositiv e conditions suc h as in a conjunctiv e negation a dumm y v ariable is used that will later b ecome a v ariable in a c h unk 0 CHAPTER LEARNING If the iden tier used to instan tiate a negated condition s iden tier eld is link ed to the sup erstate then the instan tiated negated condition is added to the trace as a negated condition In all other cases the negated condition is ignored b ecause the system cann
128. amoun t of information that is prin ted out as Soar runs The information con trolled b y this setting p ertains to Soar s in ternal state state and op erator decisions the pro ductions that re and retract and c hanges to w orking memory and preference memory The watch setting has no eect on output pro duced b y RHS write actions or RHS calls to Tcl functions With no argumen ts watch will prin t the information ab out the curren t watch set tings i e the v alues of eac h parameter The functionalit y of the watch command is quite o v erloaded and the syn tax is somewhat complex therefore the description will b e presen ted in the follo wing subsections basic w atc h settings w atc hing pro ductions w atc hing wmes w atc hing learning and w atc hing other functions Basic W atc h Settings The basic functionalit y of the watch command is to trace v arious levels of information ab out Soar s in ternal w orkings The higher the level the more information is prin ted as Soar runs A t the lo w est setting 0 none nothing is prin ted The lev els are cum ulativ e so that eac h successiv e lev el prin ts the information from the previous lev el as w ell as some additional information Th
129. ams ho w to run m ultiple Soar agen ts from a single Soar pro cess and ho w to extend Soar b y adding y our o wn user in terface functions sim ulators or graphical user in terfaces It also includes some discussion of the Tcl Soar In terface or TSI See the Soar Home P age http ai eecs umich edu so ar and Section for information ab out obtaining Soar do cumen tation Users who need to kno w more ab out Tcl should consult a Tcl reference man y of whic h are listed on the Tcl W eb Site http www scriptics com Con tacting the Soar Group The Soar pro ject supp orts sev eral in ternet mailing lists These include soar requests umich edu F or requests for copies of Soar soar doc isi edu F or requests for do cumen tation including this man ual soar bugs umich edu F or rep orting Soar bugs and for asking questions ab out Soar No vice lev el questions can b e sen t to this address CHAPTER INTR ODUCTION W e also main tain an electronic mailing list for researc hers activ ely in v olv ed in Soar re searc h If y ou w ould lik e to join this group send email to soar requests umich edu W orld Wide W eb sites There are man y institutions throughout the w orld w orking on Soar researc h
130. an in teger timetag e g or a p attern that will matc h against one or more elemen ts of w orking memory e g f operator g The syn tax of a p attern is exactly the id attribute v alue triplet that represen ts w orking memory elemen ts with the addition that wildcards can b e used in place of an y or 0 CHAPTER THE SO AR USER INTERF A CE all of the comp onen ts of the triplet It is imp ortan t to note that the whole triplet including the paren thesis m ust b e enclosed in curly braces for it to b e parsed prop erly If wildcards are included an ob ject will b e prin ted for eac h pattern matc h ev en if this results in the same ob ject b eing prin ted m ultiple times See Example Use of the optional internal ag will result in individual WMEs and their timetags b eing prin ted rather than ob jects Except for the addition of the timetags this is just a c hange in format of the same information Compare the output of the t w o commands in Example The optional depth ag causes the print command to follo w iden tier links in w orking memory to the depth sp ecied By default Soar uses a depth of whic h causes the prin t command to follo w eac h link of the
131. an in teger using the follo wing sp gt write int sqrt PR ODUCTION MEMOR Y float Con v erts a single sym b ol to a oating p oin t constan t This function exp ects either an in teger constan t sym b olic constan t or oating p oin t constan t The sym b olic constan t m ust b e a string whic h can b e in terpreted as a single oating p oin t n um b er This function essen tially op erates as a t yp e casting function F or example if y ou w an ted to prin t out an in teger expression as a oating p oin t n um b er y ou could do the follo wing sp gt write float 0 Generating and manipulating sym b ols A new sym b ol an iden tier is generated on the righ t hand side of a pro duction whenev er a previously un b ound v ariable is used This section describ es other w a ys of generating and manipulating sym b ols on the righ t hand side timestamp This function returns a sym b ol whose prin t name is a represen tation of the curren t date and time F or example sp gt write timestamp When this pro duction res it will prin t out a represen tation of the curren t date and time suc h as soar
132. and similarly there are n umerous pages on the w orld wide w eb concerning Soar The primary site is http ai eecs umich edu soar The page listed ab o v e pro vides links to information ab out sp ecic Soar researc h pro jects and researc hers as w ell as a F A Q list of frequen tly ask ed questions ab out Soar The online F A Q will usually con tain the most curren t information on Soar It is a v ailable at http www nottingham ac uk p ub soar not ting ham e so ar f aq h tml F or Those Without In ternet Access If y ou cannot reac h us on the in ternet please write to us at the follo wing address The Soar Group Articial In telligence Lab oratory Univ ersit y of Mic higan 0 Beal Av e Ann Arb or MI 0 0 USA A Note on Dieren t Platforms and Op erating Systems Soar runs on a wide v ariet y of computers including Unix and Lin ux mac hines P o w erPC Macin toshes and PCs running the Windo ws NT op erating system This man ual do cumen ts Soar generally although all references to les and directories use Unix format rather than Macin tosh or Windo ws folders A NOTE ON SO AR AND TCL A Note on Soar and Tcl Soar uses Tcl whic h is a simple in terpreted s
133. and is link ed to the sup erstate and through the sup erstate is link ed to the top lev el state The substructures of the op erator then b ecome results b ecause the op erator s iden tier is no w link ed to the sup erstate An indirect result is illustrated in Figure Justications Determination of supp ort for results Some results receiv e I supp ort while others receiv e O supp ort The t yp e of supp ort receiv ed b y a result is determined b y the function it pla ys in the sup erstate and not the function it pla y ed in the state in whic h it w as created F or example a result migh t b e created through op erator application in the state that created it ho w ev er it migh t only b e a state elab oration in the sup erstate The rst function w ould b e lead to O supp ort but the second w ould lead to I supp ort 0 CHAPTER THE SO AR AR CHITECTURE In order for the arc hitecture to determine whether a result receiv es I supp ort or O supp ort Soar m ust rst determine the function that the w orking memory elemen t or preference p erforms that is whether the result should b e considered an op erator application or not T o do this Soar creates a temp orary pro duction called a jus
134. and that test for the absence of sup erstate w orking memory elemen ts Negated conditions that test for the absence of w orking memory elemen ts that are lo cal to the substate are not included whic h can lead to o v ergeneralization in the justication see Section on page for details Remo v al of Substates Impasse Resolution Problem solving in substates is an imp ortan t part of what Soar do es and an op erator impasse do es not necessarily indicate a problem in the Soar program They are a w a y to decomp ose a complex problem in to smaller parts and they pro vide a con text for a program to delib erate ab out whic h op erator to select Op erator impasses are necessary for example for Soar to do an y learning ab out problem solving as will b e discussed in Chapter This section describ es ho w impasses ma y b e resolv ed during the execution of a Soar program ho w they ma y b e eliminated during execution without b eing resolv ed and some tips on ho w to mo dify a Soar program to prev en t a sp ecic impasse from o ccurring in the rst place Resolving Impasses An impasse is r esolve d when pro cessing in a subgoal creates results that lead to the selection of a new op erator at for
135. ar In this blo c ks w orld task the table alw a ys has ro om for another blo c k so it is represen ted as alw a ys b eing clear W ORKING MEMOR Y THE CURRENT SITUA TION Problem Spaces If w e w ere to construct a Soar system that w ork ed on a large n um b er of dieren t t yp es of problems w e w ould need to include large n um b ers of op erators in our Soar program F or a sp ecic problem and a particular stage in problem solving only a subset of all p ossible op erators are actually relev an t F or example if our goal is to c ount the blo c ks on the table op erators ha ving to do with mo ving blo c ks are probably not imp ortan t although they ma y still b e legal The op erators that are relev an t to curren t problem solving activit y dene the space of p ossible states that migh t b e considered in solving a problem that is they dene the pr oblem sp ac e Soar programs are implicitly organized in terms of problem spaces b ecause the con ditions for prop osing op erators will restrict an op erator to b e considered only when it is relev an t The complete problem space for the blo c ks w orld is sho w in Figure T ypically when Soar solv es a problem
136. are v alid only for stack formats format string Eect on output prin t a p ercen t sign cs prin t the curren t state using the dened format co prin t the curren t op erator using the dened format dc prin t the curren t decision cycle n um b er not meaningful in stac k traces pro duced b y the print stack command In these cases nothing is prin ted ec prin t the curren t elab oration cycle n um b er not meaningful in stac k traces pro duced b y the print stack command In these cases nothing is prin ted sd prin t the curren t substate depth where 0 is the top lev el state rsd pattern prin t the giv en p attern rep eating it substate depth times The pattern ma y con tain other escap e sequences Examples The follo wing stac k formats are the built in defaults in Soar and yield the watch trace seen when Soar is running format watch stack add s right dc rsd gt S cs format watch stack add o right dc rsd O co In the rst example ab o v e the format string right dc means prin t the curren t decision cycle n um b er righ t justied in a eld c haracters wide After that the format string sa ys to prin t a colon and a space The rsd
137. ate operator lt o gt table lt t gt lt o gt name move block gt In the example b elo w the pro duction tests the state for acceptable preferences for t w o dieren t op erators and also tests that these op erators mo v e dieren t blo c ks sp blocks example production co ndit ions state operator lt o gt lt o gt table lt t gt lt o gt name move block moving block lt m gt destination lt d gt lt o gt name move block moving block lt m gt lt gt lt m gt destination lt d gt gt 0 A ttribute tests The previous examples applied all of the dieren t test to the v alues of w orking memory elemen ts All of the tests that can b e used for v alues can also b e used for attributes and iden tiers except those including constan ts V ariables in attributes V ariables ma y b e used with attributes as in sp blocks example production co ndit ions state lt s gt operator lt o gt thing lt t gt lt gt lt t gt lt t gt operator lt o gt name group by attribute lt a gt moving block lt t gt destination lt t gt lt t gt type block lt a gt lt x gt lt t gt type block lt a gt lt x gt gt lt s gt operator lt o gt gt
138. ath of the directory that should b ecome the curren t w orking directory if no argumen t is giv en the HOME directory is used if it exists The command pwd prin ts the full pathname of the curren t w orking directory There is an alternativ e approac h to managing directories whic h in v olv es main taining a dir e ctory stack Using this approac h the top of the stac k is the curren t directory returned b y the topd command new directories are pushed on to the stac k with the pushd dirname command and when a directory is p opp ed o the stac k with popd the next directory in the stac k b ecomes the new curren t directory The dirs command lists the en tire stac k command action cd dirname c hanges the pro cess s curren t w orking directory chdir dirname c hanges the pro cess s curren t w orking directory pwd prin ts the curren t w orking directory This is the directory from whic h les will b e loaded dirs lists the agen t s directory stac k popd p op a directory o of the directory stac k and c hange to the directory no w at the top of the stac k pushd dirname push the curren t directory on to the directory stac k and c hange to the giv en directory topd lists th
139. ator lt o gt Ground S operator O lt o gt moving block lt b gt Ground O moving block B lt o gt destination lt b gt Ground O destination B lt d gt ontop lt b gt Ground D ontop B lt s gt object dynamic lt n gt Ground S object dynamic N lt n gt object static lt b gt Ground N object static B lt d gt object dynamic lt gt lt d gt lt gt lt d gt lt d gt Ground D object dynamic D lt d gt object static lt b gt Ground D object static B lt n gt ontop lt t gt Ground N ontop T CHAPTER THE SO AR USER INTERF A CE lt d gt ontop lt t gt Ground D ontop T soar gt explain backtraces chunk Explanation of why condition N clear yes was included in chunk Production justification matched N clear yes which caused production default selection select s ucce ss eval uati on beco mes bes t pr efer enc e to match E symbolic value success which caused A result to be generated soar gt indifferent selection first last ra nd om as k The indifferent selection command allo ws the user to set whic h option should b e used to select b et w een op erator prop osals that are m utually indieren t in
140. b ed in the Adv anced Soar User s Man ual This section is pro vided for the sak e of Soar users who will b e making use of a program that has already b een implemen ted or for those who w ould simply lik e to understand ho w I O is implemen ted in Soar A simple example of Soar I O using Tcl is pro vided in Section App endix SO AR I O INPUT AND OUTPUT IN SO AR Ov erview of Soar I O When Soar in teracts with an external en vironmen t it m ust mak e use of mec hanisms that allo w it to receiv e input from that en vironmen t and to eect c hanges in that en vironmen t An external en vironmen t ma y b e the real w orld or a sim ulation input is usually view ed as Soar s p erception and output is view ed as Soar s motor abilities Soar I O is accomplished via input functions and output functions Input functions are called at the start of ev ery execution cycle and add elemen ts directly to sp ecic input structures in w orking memory These c hanges to w orking memory ma y c hange the set of pro ductions that will re or retract Output functions are called at the end of ev ery execution cycle and are pro cessed in resp onse to c hanges to sp ecic output structures in w orking me
141. bilit y conditions in the system at a time If y ou try to add a second rule with iden tical conditions the rst one is remo v ed and replaced b y the second 0 CHAPTER THE SO AR USER INTERF A CE Also note that there can b e t w o rules with dieren t applicabilit y conditions that happ en to apply to the same ob ject F or example there could b e one rule with a name restriction that matc hes a certain ob ject and a second rule that has no name restriction and th us also matc hes the ob ject In this case Soar uses whic hev er rule has the most sp ecic conditions F or purp oses of this name restrictions are considered more sp ecic than t yp e restrictions F ormatting Con trols The format strings ha v e esc ap e se quenc es em b edded in them starting with a sign Soar expands the escap e sequences in to the appropriate pieces of text F or example the format string right dc means prin t the curren t decision cycle n um b er righ t justied in a eld c haracters wide format string Eect on output prin t a p ercen t sign prin t a left brac k et prin t a righ t brac k et nl prin t a newline left num pattern prin t the giv en p attern left justied in
142. c h unks built during problem solving and all default pro ductions Timing Information Migh t b e quite detailed dep ending on the ags set at compile time See App endix on page Decision Cycles The total n um b er of decision cycles in the run and the a v erage time p er decision cycle in milliseconds Elab oration cycles The total n um b er of elab oration cycles that w ere executed during the run the ev erage n um b er of elab oration cycles p er decision cycle and the a v erage time p er elab oration cycle in mil liseconds This is not the total n um b er of pro duction rings as pro ductions can re in parallel Pro duction Firings The total n um b er of pro ductions that w ere red W orking Memory Changes This is the total n um b er of c hanges to w orking memory This includes all additions and deletions from w orking memory Also prin ts the a v erage matc h time W orking Memory Size This giv es the curren t mean and maxim um n um b er of w orking memory elemen ts CONFIGURING TRA CE INF ORMA TION AND DEBUGGING The follo wing sp ecic argumen ts ma y follo w system to limit the output to the desired information dc count firings count ec count firings ec
143. ce of the conjunction of the v alues F or example lt p gt name john child oprah uma is the same as lt p gt name john lt p gt child oprah lt p gt child uma and the matc h is p ossible if either lt p gt child oprah or lt p gt child uma cannot b e found in w orking memory with the binding for lt p gt but not if b oth are presen t Acceptable preferences for op erators The only preferences that can app ear in w orking memory are acceptable preferences for op erators and therefore the only preferences that ma y app ear in the conditions of a pro duction are acceptable preferences for op erators PR ODUCTION MEMOR Y Acceptable preferences for op erators can b e matc hed in a condition b y testing for a follo wing the v alue This allo ws a pro duction to test the existence of a candidate op erator and its prop erties and p ossibly create a preference for it b efore it is selected In the example b elo w operator lt o gt matc hes the acceptable preference for the op erator augmen tation of the state This do es not test that op er ator lt o gt has b e en sele cte d as the curr ent op er ator sp blocks example production co ndit ions st
144. cise all user pro ductions c h unks justications and default pro ductions remain The excise command m ust b e called with at least one argumen t Note that the task and all argumen ts also cause Soar to do an init soar describ ed on page Example soar gt excise blocks world propose in itia l st ate soar gt excise all ini t so ar done Notes The excise command prin ts a p ound sign for eac h pro duction excised The prin ting of p ound signs ma y b e turned o b y using the watch command this is describ ed in Section exit The exit command terminates the Soar pro cess exit is actually a core Tcl command that terminates the pro cess that executed the exit command If an in teger v alue is supplied as the argumen t to exit then that b ecomes the exit status of the pro cess The exit command do es not in v ok e an y callbac ks or close op en log les b efore exiting therefore it is recommended that users terminate Soar b y using the quit command describ ed later in this section Example soar gt exit pro cess returned to op erating system BASIC COMMANDS F OR R UNNING SO AR help all command name usage c
145. cision phase and b efore the apply phase then the user m ust either run Soar b y phases run p or register a callbac k using the monitor command to pause Soar after the decision phase memories prodname n prodtype The memories command prin ts out the in ternal memory usage for full and partial matc hes of pro duction instan tiations with the pro ductions using the most memory EXAMINING MEMOR Y 0 prin ted rst Memory usage is recorded according to the tokens that are allo cated in the Rete net w ork for the giv en pro duction s This n um b er is a function of the n um b er of elemen ts in w orking memory that matc h eac h pro duction Therefore this command will not pro vide useful information at the b eginning of a Soar run when w orking memory is empt y and should b e called in the middle or at the end of a Soar run With no argumen ts the memories command prin ts memory usage for all pro duc tions If a pr o duction name is sp ecied memory usage will b e prin ted only for that pro duction if a p ositiv e in teger n is giv en only n pro ductions will b e prin ted the n pro ductions that use the most memory Output ma y b e restricted to prin t memory usage for
146. cks soar Y ou do not need to lo ok at the co de at this p oin t The op erators in this task mo v e a single blo c k from its curren t lo cation to a new lo cation eac h op erator is represen ted with the follo wing information the name of the blo c k b eing mo v ed the curren t lo cation of the blo c k the thing it is on top of the destination of the blo c k the thing it will b e on top of The goal in this task is to stac k the blo c ks so that C is on the table with blo c k B on blo c k C and blo c k A on top of blo c k B Represen tation of States Op erators and Goals The initial state in our blo c ks w orld task b efore an y op erators ha v e b een prop osed or selected is illustrated in Figure A state can ha v e only one op erator at a time and the op erator is represen ted as substructure of the state A state ma y also ha v e as substructure a n um b er of p otential op erators that are in consideration ho w ev er these suggested op erators should not b e confused with the curren t op erator Figure illustrates w orking memory after the rst op erator has b een selected There are six op erators prop osed and only one of these is
147. creation of a result Belo w is a description of three kno wn problems in c h unking Using searc h con trol to determine correctness Ov ergeneral c h unks can b e created if a result of problem solving in a subgoal is dep enden t on searc h con trol kno wledge Recall that desirabilit y preferences suc h as better best and worst are not included in the traces of problem solving used in c h unking Section on page In theory these preferences do not aect the v alidit y of searc h In practice ho w ev er a Soar program can b e written so that searc h con trol do es aect the correctness of searc h Here are t w o examples Some of the tests for correctness of a result are included in pro ductions that pre fer op erators that will pro duce correct results The system will w ork correctly only when those pro ductions are loaded An op erator is giv en a w orst preference indicating that it should b e used only when all other options ha v e b een exhausted Because of the seman tics of w orst this op erator will b e selected after all other op erators ho w ev er if this op erator then pro duces a result that is dep enden t on the op erator o ccurring after all others this fact w
148. ction Actions and P ersistence 0 Preference memory Selection Kno wledge Preference seman tics Soar s Execution Cycle Without Substates Impasses and Substates Impasse T yp es Creating New States Results Remo v al of Substates Impasse Resolution 0 Soar s Execution Cycle With Substates i ii CONTENTS Learning Input and Output The Syn tax of Soar Programs W orking Memory Sym b ols Ob jects
149. ctions during the next application phae If no O supp ored actions will b e created the decision pro cedure will immediately create an op erator no c hange impasse and then pro ceed to output input and so on In these cases the op erator no c hange is made in the same decision as the op erator selection There will b e cases where the op erator no c hange happ ens on the follo wing decisions suc h as when there are O supp orted pro ductions that will re but do not lead to a c hange in the selected op erator The second c hange when there are m ultiple substates is that at eac h phase Soar go es through the substates from oldest highest to new est lo w est completing an y necessary pro cessing at that lev el for that phase b efore doing an y pro cessing in the next substate When ring pro ductions for the prop osal or application phases Soar pro cesses the ring and retraction of rules starting from those matc hing the oldest substate to the new est Whenev er a pro duction res or retracts c hanges are made to w orking memory and preference memory p ossibly c hanging whic h pro ductions will matc h at the lo w er lev els pro ductions ring within a giv en lev el are red in parallel sim ula
150. ctions in v olv ed in output will create preferences for sp ecic attributes and v alues on the output link F or example a simplied pro duction that resp onds to the vision input for the blo c ks task migh t lo ok lik e this sp blocks world elaborate in put state lt s gt io input link lt in gt lt in gt block lt ib gt lt ib gt x location lt x gt y location lt y gt lt in gt block lt ib gt lt gt lt ib gt lt ib gt x location lt x gt y location lt y gt gt lt y gt gt lt s gt block lt b gt lt s gt block lt b gt lt b gt x location lt x gt y location lt y gt clear no lt b gt x location lt x gt y location lt y gt above lt b gt This pro duction copies t w o blo c ks and their lo cations directly to the top lev el state This is a generally a go o d idea when using input since the input function ma y c hange the information on the link b efore the Soar program has nished using it This pro duction also adds information ab out the relationship b et w een the t w o blo c ks The v ariables used for the blo c ks on the RHS of the pro duction are delib erately dieren t from the v ariable name used for the blo c k on the input link in the LHS of
151. ctions whic h are ab out to re or retract If there are m ultiple instan tiations of a pro duction the total n um b er of instan tiations of that pro duction is prin ted after the pro duction name unless timetags or wmes are sp ecied in whic h case eac h instan tiation is prin ted on a separate line When prin ting the matc h set the assertions and retractions argumen ts ma y b e sp ecied to restrict the output to prin t only the assertions or retractions Example soar gt matches Assertions blocks world select move bl ock ind iffe rent Retractions blocks world select move bl ock ind iffe rent soar gt matches Assertions blocks world select move bl ock ind iffe rent blocks world select move bl ock ind iffe rent Retractions blocks world select move bl ock ind iffe rent blocks world select move bl ock ind iffe rent blocks world select move bl ock ind iffe rent blocks world select move bl ock ind iffe rent 0 CHAPTER THE SO AR USER INTERF A CE blocks world select move bl ock ind iffe rent soar gt matches Assertions blocks world select move bl ock ind iffe rent S operator O O name move block blocks world select move bl ock ind iffe rent S operator O O name move block
152. d Note that the lt s gt argumen t is dieren t from the s argumen t and the lt o gt argumen t is dieren t from the o argumen t with and without the angle braces that signify a v ariable F or example with the angle braces op erator selections that tak e place in subgoals will not b e coun ted without the angle braces op erator selections are coun ted without regard to the lev el of subgoaling The units that refer to op erator v ariables lt o gt lt so gt and lt sso gt will not w ork unless a v alue is already in place for that op erator F or example when Soar is rst started none of these units will w ork b ecause there is no curren t op erator m uc h less a curren t sup erop erator or curren t sup ersup erop erator Examples run run until halted by a control C or a production action run d run for decision cycles run d run for decision cycles run run for decision cycles run p run for phase run lt o gt run for operator selections at this level of subgoaling BASIC COMMANDS F OR R UNNING SO AR Notes If Soar has b een stopp ed due to a halt action an init soar command m ust b e issued b efore Soar can b e restarted with the run command In Soar the
153. d b y Soar has the form of a single letter follo w ed b y an in teger whic h will mak e the sym b ol unique The carat sym b ol that precedes the attribute is optional Note that b ecause the id m ust already exist in w orking memory the WME that y ou are adding will b e attac hed directly or indirectly to the top lev el state Input functions should only add w orking memory elemen ts to the input link whic h is a structure on the top lev el io attribute As with other WME s an y WME added via CHAPTER THE SO AR USER INTERF A CE a call to add wme will automatically b e remo v ed from w orking memory once it is no longer attac hed to the top lev el state Example T ypically add wme will not b e in v ok ed from Soar s command line except p erhaps as a debugging aid but the syn tax is the same whether it is t yp ed at the user prompt or as part of an input function Note that prior to issuing this command the user m ust ha v e a v alid identifier suc h as the sym b ol I for the input link The metho d for obtaining the Soar input link and output link iden tiers is describ ed in the demo le demos soar io using tcl tc l and in The So ar A dvanc e d Applic ations Manual
154. d for obtaining the Soar input link and output link iden tiers is de scrib ed in the demo le demos soar io using tcl t cl and The So ar A dvanc e d Applic ations Manual remove wme n The remove wme command remo v es the w orking memory elemen t with the giv en timetag n whic h m ust b e a p ositiv e in teger matc hing the timetag of an existing w orking memory elemen t This command is pro vided primarily for use in Soar input functions although there is no programming enforcemen t add wme should only b e called from registered input functions to create w orking memory elemen ts on Soar s input link Although this command is able to remo v e an y w orking memory elemen t or preference including those automatically created b y the Soar arc hitecture and via the ev alua tion of preferences rec klessly remo ving w orking memory elemen ts is lik ely to ha v e w eird side eects including system crashes Example T ypically remove wme will not b e in v ok ed from Soar s command line except p erhaps as a debugging aid but the syn tax is the same whether the command is t yp ed at the user prompt or is part of an input function Note that prior to issuing this command the user m ust ha v e determ
155. dd filter both D speed or prin t WMEs that retract in a sp ecic state pro vided the state already exists soar gt watch wmes add filter removes S or w atc h an y relationship b et w een ob jects soar gt watch wmes add filter both ontop T o list all sp ecic WME ltering soar gt watch wmes list filter both T o remo v e all sp ecic WME ltering soar gt watch wmes reset filter both CHAPTER THE SO AR USER INTERF A CE W atc hing learning Usage watch learning print noprint fullpri nt As Soar is running it ma y create justications and c h unks whic h are added to pro duction memory The watch command allo ws users to monitor when c h unks and justications are cr e ate d b y sp ecifying one of the follo wing argumen ts to the watch learning command argumen t eect on the Soar trace print prin t the names of new c h unks and justications when created noprint prin t nothing ab out new c h unks or justications default fullprint prin t en tire c h unks and justications when created Curren tly these argumen ts aect b oth c h unks and justications equally There is no w a y to w atc h the creation of c h unks but not justications but that ma y c hange in the futu
156. ded for all users at a lo cal site and can b e recongured b y the lo cal Soar administrator This le is used to load lo cal aliases it also con tains the Tcl co de that implemen ts man y of the user in terface functions It is also the appropriate place for platform dep enden t co de Individual Soar users ha v e no con trol o v er this le unalias name definition off version The version command prin ts the v ersion n um b er of Soar This is useful information to kno w when asking for help or rep orting a bug Example soar gt version 0 TCL TK
157. dy exists off Close the curren t log le query Prin t the curren t log status add string Add the giv en string to the op en le Examples This initiates logging and places the record in fo o log soar gt log new foo log This app ends log data to an existing fo o log le soar gt log existing foo log This terminates logging and closes the op en log le CHAPTER THE SO AR USER INTERF A CE soar gt log off output strings destination pop push action The output strings destinati on command redirects the Soar text output stream This is useful for applications whic h need to c hange where prin ted results are placed Prin ted output is normally sen t to standard output Ho w ev er if a Graphical User In terface GUI is b eing used in place of the command line in ter preter as is the case with the Tcl Soar In terface then prin ted output should app ear in the GUI GUIs are comp osed of elemen ts called widgets and prin ted output w ould b e directed to a text widget or its c ommand pr o c e dur e Prin ted output is normally sen t to standard output Prin ted output can b e sen t to an y other op en le descriptor as w ell suc h as an op en le or pip e It is also p ossible that
158. e require id operator value prohibit id operator value reject id operator value gt value b etter id operator value lt value w orse id operator value gt b est id operator value lt w orst id operator value unary indieren t id operator value value binary indieren t The iden tier and v alue will alw a ys b e v ariables suc h as lt s gt operator lt o gt gt lt o gt The preference notation app ears similar to the predicate tests that app ear on the left hand side of pro ductions but has v ery dieren t meaning Predicates cannot b e used on the righ t hand side of a pro duction and y ou cannot restrict the bindings of v ariables on the righ t hand side of a pro duction Suc h restrictions can happ en only in the conditions Also notice that the sym b ol is optional when sp ecifying acceptable preferences in the actions of a pro duction although using this sym b ol will mak e the seman tics of y our pro ductions clearer in man y instances The sym b ol will alw a ys app ear when PR ODUCTION MEMOR Y y ou insp ect preference memory with the preferences command Pro ductions are nev er needed to delete pre
159. e are no examples of negated conditions for no w The order of the conditions of a pro duction do not matter to Soar except that the rst condition m ust directly test the state In ternally Soar will reorder the conditions so that the matc hing pro cess can b e more ecien t This is a mec hanical detail that need not concern most users Ho w ev er y ou ma y prin t y our pro ductions to the screen or sa v e them in a le if they are not in the order that y ou exp ected them to b e it is lik ely that the conditions ha v e b een reordered b y Soar V ariables in pro ductions and m ultiple instan tiations In the example pro duction ab o v e the names of the blo c ks are hardco ded that is they are named sp ecically In Soar pro ductions v ariables are used so that a 0 CHAPTER THE SO AR AR CHITECTURE pro duction can apply to a wider range of situations The v ariables are b ound to sp ecic sym b ols iden tiers attributes or v alues in w orking memory elemen ts b y Soar s matc hing pro cess A pro duction along with a sp ecic and consisten t set of v ariable bindings is called an instantiation A pro duction instan tiation is consisten t only if ev ery o ccurrence of a v ariab
160. e default setting for the watch level is or decisions The lev els are describ ed in the follo wing table CONFIGURING TRA CE INF ORMA TION AND DEBUGGING w atc h eect on the Soar trace 0 none prin t nothing ab out Soar s in ternals decisions prin t the state and op erator selected for eac h decision cycle the default w atc h lev el phases also prin t out the phases of the decision cycle as Soar executes productions also prin t the names of pro ductions as they re and retract including c h unks and justications wmes also trace the w orking memory elemen ts that are added and deleted as pro ductions re and retract preferences also prin t the preferences asserted and retracted when pro ductions re and retract The n umerical argumen ts 0 do not tak e an y argumen ts or mo diers They inclusiv ely turn on all lev els up to the n um b er sp ecied T o use n umerical argumen ts to turn o a lev el sp ecify a n um b er whic h is less than the lev el to b e turned o F or instance to turn o w atc hing of pro duc tions sp ecify watch or or 0 Numerical argumen ts are pro vided for shorthand con v enience F or more detailed con trol o v er the w atc h set
161. e made ab out the state state elab or ation AN O VER VIEW OF SO AR State elab orations indirectly aect op erator selection and application b y creating new descriptions of the curren t situation that can cue the selection and application of op erators These problem solving functions are the primitiv es for generating b eha vior in Soar F our of the functions require retrieving long term kno wledge that is relev an t to the curren t situation elab orating the state prop osing candidate op erators comparing the candidates and applying the op erator b y mo difying the state These functions are driv en b y the kno wledge enco ded in a Soar program Soar represen ts that kno wledge as pr o duction rules Pro duction rules are similar to if then statemen ts in con v en tional programming languages F or example a pro duction migh t sa y something lik e if there are t w o blo c ks on the table then suggest an op erator to mo v e one blo c k on top of the other blo c k The if part of the pro duction is called its c onditions and the then part of the pro duction is called its actions When the conditions are met in the curren t situation as dened b y w orking memory the pro duction is
162. e nt blocks world propose move blo ck default wme depth n The default wme depth command reects the default depth used when w orking memory elemen ts are prin ted using the print command or wmes alias The default v alue is When the command is issued with no argumen ts default wme depth returns the curren t v alue of the default depth When follo w ed b y an in teger v alue default wme depth sets the default depth to the sp ecied v alue This default depth can b e o v erridden on an y particular call to the print or wmes command b y explicitly using the depth ag e g print depth 0 args Recall that b y default the print command prin ts obje cts in w orking memory not just the individual w orking memory elemen t T o limit the output to individual w orking memory elemen ts the internal ag m ust also b e sp ecied in the print command Th us when the prin t depth is 0 b y default Soar prin ts the en tire ob ject whic h is the same b eha vior as when the prin t depth is But if internal is also sp ecied the a depth of 0 prin ts just the individual WME while a depth of prin ts all WMEs whic h share that same iden tier This is true when prin ting timetags iden tiers or WME patter
163. e of the state Also a Soar program ma y main tain an in ternal mo del of ho w it exp ects an external op erator will mo dify the w orld if so the op erator m ust up date the in ternal mo del whic h is substructure of the state When Soar is doing in ternal problem solving it m ust kno w ho w to mo dify the state descriptions appropriately when an op erator is b eing applied If it is solving the problem in an external en vironmen t it m ust kno w what p ossible motor commands it can issue in order to aect its en vironmen t The example blo c ks w orld task sho wn here do es not in teract with an external en vironmen t Therefore the Soar program directly mak es c hanges to the state when op erators are applied There are four c hanges that ma y need to b e made when a blo c k is mo v ed in our task The blo c k that is b eing mo v ed is no longer where it w as it is no longer on top of the same thing The blo c k that is b eing mo v ed is no w in a new lo cation it is on top of a new thing The place that the blo c k used to b e is no w clear The place that the blo c k is mo ving to is no longer clear unless it is the table whic h is alw
164. e top directory on the directory stac k A pro cess can ha v e at most one curren t directory lo cation This has implications for running Soar with more than one agen t If the curren t directory is c hanged for one agen t it is c hanged for al l agen ts This is a situation where using a directory stac k is particularly useful Eac h agen t has its o wn directory stac k whic h is not mo died when other agen ts pushd dirname popd or cd dirname to other lo cations The curr ent dir e ctory will b e mo died but the stac k will not b e So as long as agen ts main tain their o wn directory stac k using pushd popd topd and dirs it will alw a ys b e p ossible to ensure that the agen ts can set the prop er curren t directory b efore in v oking an y commands that read or write les echo nonewline args The echo command prin ts its argumen ts bac k to the curren t output stream whic h is normally stdout or the user in terface but can b e set to a v ariet y of c hannels By default a newline is prin ted after the ec ho ed argumen ts but if the optional nonewline argumen t is sp ecied rst no newline c haracter is prin ted Users w an ting to prin t v ariables and data to the
165. ecision pro cedure learning and input and output W orking memory The Curren t Situation Soar represen ts the curren t problem solving situation in its working memory Th us w orking memory holds the curren t state and op erator as w ell as an y substates and op erators generated b ecause of impasses and is Soar s short term kno wledge re ecting the curren t kno wledge of the w orld and the status in problem solving W orking memory con tains elemen ts called w orking memory elemen ts or WME s for short Eac h WME con tains a v ery small piece of information for example a WME migh t sa y that B is a blo c k Sev eral WME s collectiv ely ma y pro vide more infor mation ab out the same obje ct for example B is a blo c k B is named A B is on the table etc These WME s are related b ecause they are all con tributing to the description of something that is in ternally kno wn to Soar as B B is called an CHAPTER THE SO AR AR CHITECTURE move block C B A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C operators A B C states move block B A move block B T move block C T move block B A
166. ed to a state b ecause some other WME has b een remo v ed F or the most part the user is free to use an y attributes and v alues that are appropriate for the task Ho w ev er states ha v e sp ecial augmen tations that cannot b e directly created remo v ed or mo died b y rules These include the augmen tations created when a state is created and the state s op erator augmen tation that signies the curren t op erator and is created based on preferences The sp ecic attributes that Soar automatically creates are listed in Section Pro ductions ma y create an y other attributes for states Preferences are held in pr efer enc e memory where they cannot b e tested b y pro duc tions ho w ev er acceptable preferences are held in b oth preference memory and in w orking memory By making the acceptable preferences a v ailable in w orking mem ory the acceptable preferences can b e tested for in pro ductions allo wing the candi dates op erators to b e compared b efore they are selected Pro ductions Long term Kno wledge Soar represen ts long term kno wledge as pr o ductions that are stored in pr o duction memory illustrated in Figure Eac h pro duction has a set of conditions and a set of act
167. ed with attribute path notation in whic h case it amoun ts to a negated conjunction F or example the pro duction sp blocks negated conjunctio n e xamp le state lt s gt name top state lt s gt ontop lt on gt lt on gt bottom object lt bo gt lt bo gt type table gt lt s gt nothing ontop table true could b e rewritten as sp blocks negated conjunctio n e xamp le state lt s gt name top state ontop bottom object typ e table gt lt s gt nothing ontop table true Multi v alued attributes and attribute path notation A ttribute path notation ma y also b e used with m ulti v alued attributes suc h as sp blocks world propose move bl ock state lt s gt problem space blocks clear block lt block gt lt gt lt block gt lt block gt ontop lt ontop gt lt block gt type block lt ontop gt top block lt block gt bottom block lt gt lt block gt gt lt s gt operator lt o gt lt o gt name move block moving block lt block gt destination lt block gt Multi attributes and attribute path notation Note It w ould not b e advisable to write the pro duction in Figure using attribute path notation as follo ws sp blocks world propose move bl ock dont do
168. en tiers of the actions are not link ed to the state a w arning is prin ted when the pro duction is parsed and the pro duction is not stored in pro duction memory In the actions of the example pro duction sho wn in Figure the op erator preference is directly link ed to the state and the remaining actions are link ed indirectly via the op erator rst preference Although all of the attribute tests in the template ab o v e are follo w ed b y v alue tests it is p ossible to test for only the existence of an attribute and not test an y sp ecic v alue b y just including the attribute and no v alue Another exception to the ab o v e template is op erator preferences whic h ha v e the follo wing structure where a plus sign follo ws the v alue test state identifier test operator value test In the remainder of this section w e describ e the dieren t tests that can b e used for iden tiers attributes and v alues The simplest of these is a constan t where the constan t sp ecied in the attribute or v alue m ust matc h the same constan t in a w orking memory elemen t V ariables in pro ductions V ariables matc h against constan ts in w orking memory elemen ts in the iden tier at t
169. ences are considered 2 the preferences are evaluated 3 a new operator is selected OR a new state is created no more productions are eligible to fire or retract Decision Cycle Decision Phase d d d E E E p p p p Figure A detailed illustration of Soar s decision cycle out of date best or worst preferences they will tie unless additional preferences distinguish b et w een them Conict impasse A c onict impasse arises if at least t w o v alues ha v e conicting b etter or w orse preferences suc h as A is b etter than B and B is b etter than A for an op erator and neither one is rejected prohibited or required Constrain t failure impasse A c onstr aint failur e impasse arises if there is more than one required v alue for an op erator or if a v alue has b oth a require and CHAPTER THE SO AR AR CHITECTURE Soar while HALT not true Cycle Cycle InputPhase ProposalPhase DecisionPhase ApplicationPhase OutputPhase ProposalPhase while some I supported productions are waiting to fire or retract FireNewlyMatchedProductio ns RetractNewlyUnmatchedProd uct ions DecisionPhase for each state in the stack starting with the top level state until a new decision is reached EvaluateOperatorPreferenc es
170. erators In Soar this is done via rules that test the prop osed op erators the curren t state and then create pr efer enc es Preferences assert the relativ e or absolute merits of the candidate op erators F or example a preference ma y sa y that op erator A is a b etter c hoice than op erator B at this particular time or a preference ma y sa y that op erator A is the b est thing to do at this particular time Selecting a single op erator Soar attempts to select a single op erator based on the preferences a v ailable for the candidate op erators There are four dieren t situations that ma y arise The a v ailable preferences unam biguously prefer a single op erator The a v ailable preferences suggest m ultiple op erators and prefer a subset that can b e selected from randomly The a v ailable preferences suggest m ultiple op erators but neither case or ab o v e hold The a v ailable preferences do not suggest an y op erators In the rst case the preferred op erator is selected In the second case one of the subset is selected randomly In the third and fourth cases Soar has reac hed an impasse in problem solving and a new substate is created Impasses are discussed in Section
171. es The state has exactly one op erator O This state corresp onds to the illustration of w orking memory in Figure W ORKING MEMOR Y O43 X44 apple red small grams mass 200 box large orange ball red big isa color size contains color size isa inside size color isa unit property inside O53 O87 attributes name state values identifiers S1 Figure A seman tic net illustration of four ob jects in w orking memory W orking Memory as a Graph Not only is w orking memory a set it is also a graph structure where the iden tiers are no des attributes are links and constan ts are terminal no des W orking memory is not an arbitrary graph but a graph ro oted in the states Therefore all WMEs are linke d either directly or indirectly to a state The impact of this constrain t is that all WMEs created b y actions are link ed to WMEs tested in the conditions The link is one w a y from the iden tier to the v alue Less commonly the attribute of a WME ma y b e an iden tier Figure illustrates four ob jects in w orking memory the ob ject with iden tier X has b een link ed to the ob ject with iden tier O using the attribute as the link rather than the v alue The
172. ess that in ternally reorders the conditions in user dened pro ductions as men tioned briey in Section Inhibition of Ch unks When a c h unk is built it ma y b e able to matc h immediately with the same w orking memory elemen ts that participated in its creation If the pro duction s actions include preferences for new op erators the pro duction w ould immediately re and create a preference for a new op erator whic h duplicates the op erator preference that w as the original result of the subgoal T o prev en t this inhibition is used This means that eac h pro duction that is built during c h unking is considered to ha v e already red with the instan tiation of the exact set of w orking memory elemen ts used to create it This do es not prev en t a newly learned c h unk from matc hing other w orking memory elemen ts that are presen t and ring with those v alues CHAPTER LEARNING Problems that Ma y Arise with Ch unking One of the w eaknesses of Soar is that c h unking can create o v ergeneral pro ductions that apply in inappropriate situations or o v ersp ecic pro ductions that will nev er re These problems arise when c h unking cannot accurately summarize the pro cessing that led to the
173. essage is prin ted to notify the user that the limit has b een reac hed This limit is included in Soar to prev en t getting stuc k in an innite lo op during the c h unking pro cess This could conceiv ably happ en b ecause newly built c h unks ma y matc h immediately and are red immediately when this happ ens this can in turn lead to additional c h unks b eing formed etc If y ou see this w arning something is seriously wrong Soar is unable to guaran tee consistency of its in ternal structures Y ou should not con tin ue execution of the Soar program in this situation stop and determine whether y our program needs to build more c h unks or whether y ou v e disco v ered a bug in y our program or in Soar itself Example soar gt max chunks 0 soar gt max chunks 00 soar gt max chunks 00 CONFIGURING SO AR S R UNTIME P ARAMETERS max elaborations n c omment somewhere ma yb e app endix C i d lik e to see an example of hitting the limit The max elaborations command is used to limit the maxim um n um b er of elab ora tion cycles allo w ed during an elab oration phase The inital v alue of this v ariable is 00 allo w able settings are an y in teger greater than or equal to T
174. f the curren t phase and return to the user prompt This is similar to halt but do es not terminate the run The run ma y b e con tin ued b y issuing a run command from the user in terface The interrupt RHS function has the same eect as t yping ctrl c at the prompt except that there is more con trol b ecause it tak es eect exactly at the end of the phase that res the pro duction sp gt interrupt T ext input and output The functions write and accept are pro vided as pro duction actions to do simple input and output of text in Soar Soar applications that do extensiv e input and output of text should use I O in Soar or mak e use of Tcl or Tk functionalit y Adding I O and using Tcl and Tk functions are considered adv anced usage and are b ey ond the scop e of this man ual Consult the So ar A dvanc e d Applic ations Manual for instructions write This function writes its argumen ts to the standard output It do es not automatically insert blanks linefeeds or carriage returns F or example if lt o gt is b ound to then sp gt write lt o gt lt o gt lt o gt x lt o gt lt o gt prin ts x PR ODUCTION MEMOR Y Although write is pro
175. f this in the set of default pro ductions see Section or App endix for more information F or example the follo wing pro duction tests for a constrain t failure impasse on the top lev el state sp default top goal halt ope rat or f ailu re Halt if no operator can be selected for the top goal default state lt s gt superstate nil state lt ss gt impasse constraint failure superstate lt s gt gt write crlf No operator can be selected for top goal write crlf Soar must halt halt Soar I O Input and Output in Soar Man y Soar users will w an t their programs to in teract with a real or sim ulated en vi ronmen t F or example Soar programs could con trol a rob ot receiving sensory inputs and sending command outputs Soar programs migh t also in teract with sim ulated en vironmen ts suc h as a igh t sim ulator The mec hanisms b y whic h Soar receiv es inputs and sends outputs to an external pro cess is called So ar I O This section describ es ho w input and output are represen ted in w orking memory and in pro ductions The details of creating and registering the input and output functions for Soar are b ey ond the scop e of this man ual but they are fully descri
176. ferences b ecause preferences will b e re tracted when the pro duction no longer matc hes Preferences should nev er b e created b y op erator application rules and they should alw a ys b e created b y rules that will giv e only I supp ort to their actions Shorthand notations for preference creation There are a few shorthand notations allo w ed for the creation of op erator preferences on the righ t hand side of pro ductions Acceptable preferences do not need to b e sp ecied with a sym b ol lt s gt operator lt op gt is assumed to mean lt s gt operator lt op gt Am biguit y can easily arise when using a preference that can b e either binary or unary gt lt The default assumption is that if a v alue follo ws the preference then the preference is binary It will b e unary if a carat up arro w a closing paren thesis another preference or a comma follo ws it Belo w are four examples of legal although unrealistic actions that ha v e the same eect lt s gt operator lt o gt lt o gt lt o gt lt lt o gt lt o gt lt o gt lt s gt operator lt o gt lt o gt lt o gt lt lt o gt lt o gt lt o gt lt s gt operator lt o gt lt o gt lt o g
177. g tcl tc l giv es examples for doing I O in Soar using Tcl scripts The sp ecic commands describ ed in this section are Summary add wme Man ually add an elemen t to w orking memory io Register or cancel routines for managing Soar s input and output links remo v e wme Man ually remo v e an elemen t from w orking memory These commands are used only when Soar needs to in teract with an external en vi ronmen t add wme id attribute value The add wme command adds a new w orking memory elemen t directly to w orking memory b ypassing the usual ev aluation pro cesses of Soar This command is pro vided for use in Soar input functions although there is no programming enforcemen t add wme should only b e called from registered input functions to create w orking mem ory elemen ts on Soar s input link add wme returns the timetag of the new WME whic h can b e used later b y remove wme to remo v e the WME when it is no longer needed The id m ust b e an iden tier that already exists in w orking memory The attribute and value ma y b e an y sym b ols an asterisk indicates that Soar should create a new iden tier for the attribute or v alue see page An y sym b ol generate
178. gt run e make constant symbol This function returns a new constan t sym b ol guar an teed to b e dieren t from all sym b ols curren tly presen t in the system With no argumen ts it returns a sym b ol whose name starts with constant With one or more argumen ts it tak es those argumen t sym b ols concatenates them and uses that as the prex for the new sym b ol It ma y also app end a n um b er to the resulting sym b ol if a sym b ol with that prex as its name already exists sp gt lt s gt new symbol make constant symbol CHAPTER THE SYNT AX OF SO AR PR OGRAMS When this pro duction res it will create an augmen tation in w orking memory suc h as S new symbol constant The pro duction sp gt lt s gt new symbol make constant symbol lt s gt will create an augmen tation in w orking memory suc h as S new symbol S when it res The v ertical bars denote that the sym b ol is a constan t rather than an iden tier in this example the n um b er has b een app ended to the sym b ol S This can b e particularly useful when used in conjunction with the timestamp function b y using timestamp as an argumen t to make constant symbo
179. h no argumen ts the multi attributes command prin ts a listing of the curren tly declared m ulti attributes Example soar gt multi attributes thing soar gt multi attributes ontop Notes Note that multi attributes declarations m ust b e made b efor e pro ductions are loaded in to pro duction memory o support mode 0 The o support mode command is used to con trol the w a y that O supp ort is deter mined for preferences See Section for a discussion of the default sc heme The o support mode v alue m ust b e one of three v alues v alue eect 0 O supp ort w orks as describ ed earlier in this man ual O supp ort w orks as describ ed in this man ual but a message is prin ted whenev er the alternativ e sc heme w ould ha v e made a dierence in the Soar program The alternativ e O supp ort sc heme is used In the alternativ e sc heme O supp ort is determined according to the follo wing rules IF the preference is for an operator augmentation of a state THEN the preference gets I support ELSE IF the production creating the preference tests an operator augmentation on a state OR tests an acceptable preference for an operator augmentation on a state OR creates an additional acceptable preference for
180. hannel le or pip e denoted b y op en d discard Ignore prin ts similar to redirecting to dev n ull in the Bourne shell sh procedure proc name Redirect prin ting to the Tcl pro cedure named pr o c name Tk widgets are also pro cedures so this action can send output to widget pro cedures or an y other Tcl pro cedure text widget widname Redirect prin ting to the text widget named interp name widname in the curren t in terpreter If interp name is sp ecied then prin ting is redirected to the text widget named widname in the in terpreter named interp name FILE SYSTEM I O COMMANDS Example This example redirects prin ts to the text widget text soar gt output strings destination push text widget text This example causes all prin ting to b e supressed soar gt output strings destination push discard This example remo v es the most recen tly added prin t destina tion soar gt output strings destination pop Notes This command only aects the prin ting generated b y Soar commands suc h as write and echo It do es not aect prin ting done b y the Tcl commands suc h as puts rete net f save loadg filename The rete net command sa v es the curren t Rete net to a le or restores a Rete net pre vi
181. hat are directly or indirectly link ed to the substate Th us whenev er suc h an O supp orted w orking memory elemen t is created Soar records whic h w ork ing memory elemen ts that exist in a sup erstate w ere tested directly or indirectly in creating that w orking memory elemen t dep endency set Whenev er an y of the w ork ing memory elemen ts in the dep endency set of a substate c hange the substate is regenerated Note that the creation of I supp orted structures in a subgoal do es not increase the dep endency set nor do O supp orted results Th us only subgoals that in v olv e the creation of in ternal O supp ort w orking memory elemen ts risk regeneration and then only when the basis for the creation of those elemen ts c hanges Substate Remo v al Whenev er a substate is remo v ed all w orking memory elemen ts and preferences that w ere created in the substate that are not results are remo v ed from w orking memory In Figure 0 state S will b e remo v ed from w orking memory when the impasse that created it is resolv ed That is when sucien t preferences ha v e b een generated so that one of the op erators for state S can b e selected When state S is remo v ed op erator O and pr
182. he elab oration phase will end after max elaboration cycles ha v e completed even if ther e ar e mor e pr o ductions eligible to r e or r etr act and Soar will pro ceed to the next phase A w arning message is prin ted to notify the user that the limit has b een reac hed and Soar has mo v ed on to the next phase This limits the total n um b er of cycles of parallel pro duction ring but do es not limit the total n um b er of pro ductions that can re during elab oration This limit is included in Soar to prev en t getting stuc k in innite lo ops suc h as a pro duction that rep eatedly res in one elab oration cycle and retracts in the next if y ou see the w arning message it ma y b e a signal that y ou ha v e a bug y our co de Ho w ev er some Soar programs are designed to require a large n um b er of elab oration cycles so rather than a bug y ou ma y need to increase the v alue of max elaborations Regardless of the reason that y our program has hit the maxim um n um b er of elab ora tion cycles if y ou see the w arning message it means that y our program is not w orking as in tended Y ou should either x a bug or increase the limit Example soar gt max elaborations 00
183. he matches command prin ts a list of pro ductions that ha v e instan tiations in the matc h set i e those pro ductions that will retract or re in the next Prop ose or Apply phase It also will prin t partial matc h information for a single named pro duction The optional argumen ts to the matches command are describ ed in the follo wing table The n umeric and named ags are redundan t either the n um b er or name ma y b e used to sp ecify the lev el of detail EXAMINING MEMOR Y 0 matc hes Eect on output assertions Prin t matc h set information only ab out assertions retractions Prin t matc h set information only ab out retractions pr o dname Prin t information ab out partial matc hes for the named pro duction 0 names F or the matc h set prin t only the names of the pro ductions that are ab out to re or retract default 0 count F or named pro ductions prin t only partial matc h coun ts default timetags Also prin t the timetags of the WME s that matc h the pro ductions wmes Also prin t the WME s that matc h the pro ductions Prin ting the matc h set When prin ting the matc h set i e no pro duction name is sp ecied the default action prin ts only the names of the pro du
184. hell language to implemen t the Soar user in terface Tcl stands for T o ol Command Language and is pronounced tic kle Tcl w as originally written b y John Ousterhout It is a simple scripting language that allo ws a Soar user to write extensions to Soar without ha ving to recompile Soar Tcl also allo ws the addition of Tk pronounced tee KA Y a to olkit for writing graphical in terfaces More information on Tcl Tk is a v ailable at h ttp www scriptics com The addition of Tcl to Soar allo ws Soar users to add their o wn routines without the need to recompile all of Soar Tcl also mak es it easier for users to in terface Soar with external programs and sim ulators and mak es it p ossible for users to write simple sim ulators and simple programs to monitor problem solving in Soar Although from the Soar p ersp ectiv e w e ha v e added Tcl and Tk to Soar tec hnically sp eaking w e ha v e added Soar to Tcl This ma y seem to b e a p edan tic distinction but it has implications for all Soar users and not just those who w an t to write their o wn functions Most signican tly b ecause Soar is added to Tcl and not vice v ersa w e are restricted b y some Tcl syn tax and naming con v en ti
185. i v alued attributes or m ulti attributes for short T o shorten the sp ecication of a condition tests for m ulti v alued attributes can b e shortened so that the v alue tests are together F or example the condition 0 CHAPTER THE SYNT AX OF SO AR PR OGRAMS lt p gt type father child sally child sue could also b e written as lt p gt type father child sally sue Multi v alued attributes and v ariables When v ariables are used with m ulti v alued attributes remem b er that v ariable bind ings are not unique unless explicitly forced to b e so F or example to test that an ob ject has t w o v alues for attribute child the v ariables in follo wing condition can matc h to the same v alue lt p gt type father child lt c gt lt c gt T o do tests for m ulti v alued attributes with v ariables correctly conjunctiv e tests m ust b e used as in lt p gt type father child lt c gt lt gt lt c gt lt c gt The conjunctiv e test f lt gt lt c gt lt c gt g ensures that lt c gt will bind to a dieren t v alue than lt c gt binds to Negated conditions and m ulti v alued attributes A negation can also precede an attribute with m ultiple v alues In this case it tests for the absen
186. iden tier exactly one lev el A depth of will result in the ob ject b eing prin ted and also all ob jects whose iden tiers are v alues in the rst ob ject The default depth for Soar can b e c hanged through the default wme depth command describ ed on page but sp ecifying depth n in the print command will alw a ys o v erride the v alue set b y default wme depth In what seems lik e a sp ecial case but really isn t the output of print for depth 0 dep ends on whether or not the internal ag is also sp ecied If internal is not sp ecied Soar prin ts the ob ject and the depth ag has no eect on the output Ho w ev er if internal and depth 0 are b oth sp ecied then Soar will prin t only the matc hed WME Compare the output of the commands in Example T o prin t individual WMEs for a giv en argumen t iden tier or timetag or pattern use print depth 0 internal arg F or con v enience the wmes alias describ ed on page pro vides exactly that notation T o prin t a single cop y of al l elemen ts in w orking memory in their in ternal form i e as WMEs with timetags use soar gt print depth 0 internal OR soar gt wmes In the ab o v e print statemen t
187. ill not b e captured in the conditions of the c h unk In b oth of these cases part of the test for pro ducing a result is implicit in searc h con trol pro ductions This mo v e allo ws the explicit state test to b e simpler b ecause an y state to whic h the test is applied is guaran teed to satisfy some of the requiremen ts for success Ho w ev er c h unks created in suc h a problem space will b e o v ergeneral b ecause the implicit parts of the state test do not app ear as conditions Solution T o a v oid this problem necessit y preferences require and prohibit should b e used whenev er a con trol decision is b eing made that also incorp orates goal attainmen t kno wledge The necessit y preferences are included in the bac ktrace b y c h unking thereb y a v oiding o v ergeneralit y T esting for lo cal negated conditions Ov ergeneral c h unks can b e created when negated conditions test for the absence of a w orking memory elemen t that if it existed w ould b e lo cal to the substate Ch unking has no mec hanism for determining why a giv en w orking memory elemen t do es not exist and th us a condition that o ccurred in a pro duction in the subgoal is not included in the c h
188. imilar to justications in that they are b oth formed via the bac k tracing pro cess and b oth create a result in their actions Ho w ev er there are some imp ortan t distinctions Ch unks are pro ductions and are added to pro duction memory Justications do not app ear in pro duction memory Justications disapp ear as so on as the w orking memory elemen t or preference they pro vide supp ort for is remo v ed CHAPTER THE SO AR AR CHITECTURE Ch unks con tain v ariables so that they ma y matc h w orking memory in other situations justications are similar to an instan tiated c h unk Input and Output Man y Soar users will w an t their programs to in teract with a real or sim ulated en vi ronmen t F or example Soar programs ma y con trol a rob ot receiving sensory inputs and sending command outputs Soar programs ma y also in teract with sim ulated en vi ronmen ts suc h as a igh t sim ulator Input is view ed as Soar s p erception and output is view ed as Soar s motor abilities When Soar in teracts with an external en vironmen t it m ust mak e use of mec hanisms that allo w it to receiv e input from that en vironmen t and to eect c hanges in that en vironmen t the mec hani
189. in ts internal Prin t pro ductions in their in ternal form name Prin t only the name of the pro duction This is the default when a pro duction typ e is sp ecied full Prin t the full pro duction This is the default when a pro duction name is sp ecied filename Prin t the name of the le that con tains the pro duction Useful when man y les are sourced to load pro ductions prodname s prin ts the full named pro duction s all Prin t the names of all pro ductions If full is sp ecied rst prin t the full pro ductions chunks Prin t the names of all c h unks If full is sp ecied rst prin t the full pro ductions defaults Prin t the names of all default pro ductions If full is sp ecied rst prin t the full pro ductions justifications Prin t the names of all justications If full is sp ecied rst prin t the full pro ductions user Prin t the names of all user pro ductions If full is sp ecied rst prin t the full pro ductions c omment underline the unique c har substrings that are allo w ed The prin t command is used to prin t items in pro duction memory If a pro duction name is sp ecied Soar will b y default prin t the en tire pro duction If a pro duction typ e is
190. ined the timetag of the WME whic h is to b e remo v ed usually a WME that w as added with add wme The metho d for managing the Soar io structure is describ ed more fully in the demo le demos soar io using tcl tc l and in The So ar A dvanc e d Applic ations Manual soar gt remove wme W arning The remove wme command ma y ha v e w eird side eects p ossibly ev en including sys tem crashes when used outside its in tended role It should only b e in v ok ed during the Input Phase or Output Phase of Soar s execution cycle It should never b e in v ok ed from the action side of pro ductions remove wme ma y ha v e adv erse aects on c h unking Remo ving input w orking memory elemen ts or state op erator or impasse w orking memory elemen ts ma y ha v e w eird side eects including system crashes CHAPTER THE SO AR USER INTERF A CE Miscellaneous c omment this section still needs to b e rewritten The sp ecic commands describ ed in this section are Summary alias default rules predened aliases soarnews soar tcl le unalias v ariables v ersion alias name definition off The alias command displa ys and denes Soar aliases When called with no argu men ts it displa ys a list
191. information stats memory resource pool pool stat The optional stats argumen t memory pro vides information ab out memory usage and Soar s memory p o ols whic h are used to allo cate space for the v arious data structures used in Soar The follo wing sp ecic argumen ts ma y follo w stats memory to limit the output to the desired information hash table misc overhead pool pool statistic strings total CONFIGURING TRA CE INF ORMA TION AND DEBUGGING where pool statistic is either total or pool name aspect The a v ailable pool names are action fnode varnamesg falpha memg not fchunk conditiong foutput linkg fcomplex testg preference condition production fcons cellg frete nodeg fdl consg frete testg ffloat constantg fright memg identifier fsaved testg instantiation slot fint constantg fsym constantg fio wmeg token fms changeg variable fnegative tokeng wme Note that the t w o w ord p o ol names m ust b e enclosed in curly braces If no asp e ct is giv en then prin t all statistics ab out the giv en p o ol If giv en asp e ct m ust ha v e one of the follo wing forms used free item size total bytes The rst t w o asp e cts are a v ailable only if Soar has b
192. ing of the curren tly dened aliases when called with a sp ecic name it displa ys the alias curren tly dened for that name when called with a name and a denition it denes a new alias When called with a name and off it remo v es the named alias The name can b e one or more alphan umeric c haracters but m ust b egin with a letter The definition can b e an y Soar command including another alias and including an y n um b er of argumen ts to that command The denition ma y b e an arbitrarily complex single command If more complex m ulti command aliases are desired the the Tcl proc command can b e used to dene a new pro cedure see Chapter V ersion 0 c omment probably has the same curly braces double quotes tradeos as other commands but I m not certain KJC y ep Aliasing of a command ma y b e turned o b y using alias name off or unalias name The latter is pro vided for similarit y to the Unix aliasing capabilit y MISCELLANEOUS V ersion 0 c omment I m confused b y ho w this command is implemen ted probably due to Tclisms Seems to me that alias with no args should prin t a listing of all the aliases and their denitions just as in Unix But instead it just lists the na
193. ing preferences for those candidates worst SO AR S EXECUTION CYCLE WITHOUT SUBST A TES parallel indifferent will b e examined to determine the selection Note that if a v alue that is not rejected or prohibited is better than a best v alue the better v alue will b e selected This result is coun ter in tuitiv e but allo ws explicit kno wledge ab out the relativ e w orth of t w o v alues to dominate kno wledge of only a single v alue A require preference should b e used when a v alue must b e selected for the goal to b e ac hiev ed W orst lt A worst preference states that the v alue should b e selected only if there are no alternativ es It allo ws for a simple t yp e of default sp ecication The seman tics of the worst preference are similar to those for the best preference Indieren t An indifferent preference states that there is p ositiv e kno wledge that it do es not matter whic h v alue is selected This ma y b e a binary preference to sa y that t w o v alues are m utually indieren t or a unary preference to sa y that a single v alue is as go o d or as bad a c hoice as other exp ected alternativ es When indifferent preferences are used to signal that it do es not mat
194. ions Inhibition of Ch unks Problems that Ma y Arise with Ch unking Using searc h con trol to determine correctness T esting for lo cal negated conditions T esting for the substate Soar and Tcl The Soar Application In terface The Soar User In terface Basic Commands for Running Soar d n e n excise exit 0 help init soar quit
195. ions If the conditions of a pro duction matc h w orking memory the pro duction r es and the actions are p erformed The structure of a pro duction In the simplest form of a pro duction conditions and actions refer directly to the presence or absence of ob jects in w orking memory F or example a pro duction migh t sa y PR ODUCTIONS LONG TERM KNO WLEDGE condition1 maybe some more conditions production name C A C A C A C A C A C A C A C A C A C A C A C A C A C A C A C A C A C A C A action1 Maybe some more actions An Abstract View of Production Memory Figure An abstract view of pro duction memory The pro ductions are not related to one another CONDITIONS block A is clear block B is clear ACTIONS suggest an operator to move block A ontop of block B This is not the literal syn tax of pro ductions but a simplication The actual syn tax is presen ted in Chapter The conditions of a pro duction ma y also sp ecify the absenc e of patterns in w orking memory F or example the conditions could also sp ecify that blo c k A is not red or there are no red blo c ks on the table But since these are not needed for our example pro duction ther
196. ions together determine the conditions for the c h unk In order for the c h unk to apply at the appropriate time its conditions m ust test exactly those w orking memory elemen ts that w ere necessary to pro duce the results of the subgoal Soar computes a c h unk s conditions based on the pro ductions that re in the subgoal b eginning with the results of the subgoal and then b acktr acing through the pro ductions that created eac h result It recursiv ely bac ktraces through the w orking memory elemen ts that matc hed the conditions of the pro ductions nding F or some tasks b ottom up c h unking facilitates mo delling p o w er la w sp eedups although its long term theoretical status is problematic DETERMINING CONDITIONS AND A CTIONS the actions that led to the WME s creation etc un til conditions are found that test elemen ts that are link ed to a sup erstate Determining a c h unk s actions A c h unk s actions are built from the results of a subgoal A r esult is an y w orking memory elemen t created in the substate that is link ed to a sup erstate A w orking memory elemen t is link ed if its iden tier is either the v alue of a sup erstate WME or the v alue of an augmen tation for an
197. iple for tie and conict impasses constraint failure for constrain t failure impasses or none for no c hange impasses superstate Con tains the iden tier of the state in whic h the impasse arose attribute F or m ulti c hoice and constrain t failure impasses this con tains operator F or no c hange impasses this con tains the attribute of the last decision with a v alue state or operator item F or m ulti c hoice and constrain t failure impasses this con tains all v alues in v olv ed in the tie conict or constrain t failure If the set of items that tie or conict c hanges during the impasse the arc hitecture remo v es or adds the appropriate item augmen tations without terminating the existing impasse quiescence States are the only ob jects with quiescence t whic h is an explicit statemen t that quiescence exhaustion of the elab oration cycle w as reac hed in the sup erstate If problem solving in the subgoal is con tingen t on quiescence ha ving b een reac hed the substate should test this ag The side eect is that no c h unk will b e built if it dep ended on that test See Section on page for details This attribute can b e ignored when learning is turned o Kno wing the names of
198. is giv en only the top n pro ductions are listed If n is zero 0 only the pro ductions that ha v en t red at all are listed If one or more CHAPTER THE SO AR USER INTERF A CE pro duction names are giv en as argumen ts only ring coun ts for these pro ductions are prin ted Note that ring coun ts are reset b y a call to init soar Example soar gt firing counts 0 default generic elabora te add attr ibu te t o du pli cate blocks world propose op era tor move bl ock blocks world monitor st ate rel atio n o ntop default generic elabora te stat e ad d d upli cate to sta te blocks world reject mov e b lock twi ce default generic elabora te stat e du pli cate id for att ribu te blocks world monitor ti ed oper ator s m ove bloc k default selection propo se oper ator ev alua te o bje ct default selection elabo rat e st ate wit h wa it t rue not all objects evaluated default selection selec t o pera tor eva luat e ob jec t in diff ere nt soar gt firing counts blocks world propose op era tor move bl ock blocks world propose op era tor move bl ock format watch stack obje ct n add remov e o s name fformat g The format watch command allo ws users to customize
199. ject they are part of Examples The rst example prin ts all WMEs for the ob ject a soar gt wmes a 0 A name a A type block This example prin ts the WME with the timetag 0 soar gt wmes 0 0 A name a This example will prin t one cop y of eac h elemen t of w orking memory soar gt wmes Conguring T race Information and Debugging This section describ es the commands used primarily for debugging or to congure the trace output prin ted b y Soar as it runs Users ma y sp ecify the format and con ten t of the run time trace output ask that they b e alerted when sp ecic pro ductions re and retract sp ecify certain actions b e tak en at v arious p oin ts in the execution cycle or request details on Soar s p erformance The sp ecic commands describ ed in this section are Summary c h unk name format Sp ecify format of the name to use for new c h unks ring coun ts Prin t the n um b er of times pro ductions ha v e red format w atc h Change the trace output that s prin ted as Soar runs monitor Manage attac hmen t of Tcl scripts to Soar ev en ts p w atc h T race rings and retractions of sp ecic pro ductions stats Prin t information on Soar s run
200. k trace default object applies to prin ting of ob jects add add a new format p ossibly replacing an old format remove remo v e an existing format s restrict to states only o restrict to op er ator only do not restrict b y typ e name for stack restrict to name d problem spaces for object restrict to ob jects with name name format sequence of format masks to apply All calls to format watch should tak e either stack or object as an argumen t to sp ecify whether the rule applies to stac k formats or ob ject formats Stac k formats con trol ho w Soar prin ts its con text stac k selections in watch and print stack output Ob ject formats con trol ho w Soar prin ts an ob ject e g a certain op erator problem space etc If no t yp e is giv en then stack is assumed With no additional argumen ts format watch prin ts the curren t formatting settings for either stac ks or ob jects as sp ecied An y additional argumen ts are considered an action whic h add or delete a formatting rule The optional action tak es the form operation class name format The op er ation m ust b e either add or remove An add op eration adds new for mats replacing an y existing ones with iden tical
201. ks superstate nil thing T CHAPTER THE SO AR USER INTERF A CE thing B thing B thing B type state S io I ontop O ontop O ontop O operator O operator O operator O operator O operator O operator O operator O problem space blocks superstate nil thing T thing B thing B thing B type state soar gt Example When a timetag is sp ecied as the argumen t to print Soar prin ts the ob ject that includes the WME with that timetag soar gt print 0 O destination B moving block B name move block The output when depth 0 is sp ecied still prin ts the ob ject unless the internal is also sp ecied soar gt print depth 0 0 O destination B moving block B name move block soar gt print depth 0 internal 0 0 O name move block Prin ting the curren t subgoal stac k print can b e used to prin t the curren t subgoal stac k b y sp ecifying the stack ar gumen t By default this includes b oth states and op erators The stac k listing can b e restricted b y adding the states and operator restrictions Sp ecifying b oth options is equiv alen t to the default The predened alias ps is the same as prin t stac k Usage print stack operators states argumen t
202. ks w orld task vii viii LIST OF FIGURES PREF A CE ix Preface Soar is an in tegrated arc hitecture for kno wledge based problem solving learning and in teraction with external en vironmen ts The authors of this man ual assume a ba sic understanding of articial in telligence and or information pro cessing psyc hology F or further bac kground on Soar w e recommend The So ar Pap ers R e adings on In te gr ate d Intel ligenc e Rosen blo om Laird and New ell and Unie d The ories of Co gnition New ell 0 This man ual is sp ecic to V ersion of Soar whic h is signican tly dieren t from previous v ersions of Soar Ac kno wledgemen ts Sp ecial thanks to Erik Altmann and Rob ert Do oren b os who help ed author previous v ersions of the man ual whic h made this v ersion considerably easier to create and to Gary P elton and Scott Human who con tributed text for previous v ersions of the man ual W e w ould also lik e to thank Karl Sc h w am b for extensiv e commen ts and tec hnical advice and the Soar group for their patien t supp ort x PREF A CE Chapter In tro duction Soar has b een dev elop ed to b e an arc hitecture for constructing general in telligen t s
203. l For Goal S P default operator copy no P default state copy yes S desired D 0 S problem space P S superstate S S choices multiple S operator O S operator O S operator O For Goal S No GDS for this goal soar gt Notes This command is quite inecien t and can b e v ery slo w internal symbols The internal symbols command prin ts information ab out the Soar sym b ol table Suc h information is t ypically only useful for users attempting to debug Soar b y lo cating memory leaks or examining I O structure Example soar gt internal symbols Symbolic Constants 00 CHAPTER THE SO AR USER INTERF A CE operator accept evaluate object problem space sqrt interrupt mod goal io additional symbols deleted for brevity Integer Constants Floating Point Constants Identifiers Variables lt o gt lt sso gt lt to gt lt ss gt lt ts gt lt so gt lt sss gt lt s gt soar gt matches assertions re tr ac ti on s 0 n names timeta gs wm es matches prodname 0 count ti me ta gs wm es T
204. l y ou can get a new sym b ol that is guaran teed to b e unique F or example sp gt lt s gt new symbol make constant symbol timestamp When this pro duction res it will create an augmen tation in w orking memory suc h as S new symbol capitalize symbol Giv en a sym b ol this function returns a new sym b ol with the rst c haracter capitalized This function is pro vided primarily for text output for example to allo w the rst w ord in a sen tence to b e capitalized capitalize symbol foo PR ODUCTION MEMOR Y Tcl functions as RHS actions An y Tcl command including the Soar In terface commands describ ed in Chapter can b e issued on the righ thand side of pro ductions through the tcl RHS function There are no safet y nets with this function and users are w arned that they can get themselv es in to trouble if not careful Users should never use the tcl RHS function to in v ok e add wme remove wme or sp tcl Concatenates eac h of its argumen ts in to a string whic h is then sen t to the agen t s Tcl in terpreter for ev aluation It do es not automatically insert spaces b et w een argumen ts If lt o gt is b ound to x then sp gt
205. le is b ound to the same v alue Since the same pro duction ma y matc h m ultiple times eac h with dieren t v ariable bindings sev eral instan tiations of the same pro duction ma y matc h at the same time and therefore re at the same time If blo c ks A and B are clear the rst pro duction without v ariables will suggest one op erator Ho w ev er if a pro duction w as created that used v ariables to test the names this second pro duction will b e instan tiated t wice and therefore suggest two op erators one op erator to mo v e blo c k A on top of blo c k B and a second op erator to mo v e blo c k B on top of blo c k A Because the iden tiers of ob jects are determined at run time literal iden tiers cannot app ear in pro ductions Since iden tiers o ccur in ev ery w orking memory elemen t v ariables m ust b e used to test for iden tiers and m ultiple o ccurrences of the same v ariable is used to link conditions together Just as the elemen ts of w orking memory m ust b e link ed to a state in w orking memory so m ust the ob jects referred to in a pro duction s conditions That is one condition m ust test a state ob ject and all other conditions m ust test that same state o
206. le that the preferences are either incomplete or inconsisten t The preferences can b e incomplete in that no acceptable op erators are suggested or that there are insucien t preferences to distinguish among acceptable op erators The preferences can b e inconsisten t if for instance op erator A is preferred to op erator B and op erator B is preferred to op erator A Since preferences are generated indep enden tly from dieren t pro duction instan tiations there is no guaran tee that they will b e consisten t Impasse T yp es There are four t yp es of impasses that can arise from the preference sc heme Tie impasse A tie impasse arises if the preferences do not distinguish b et w een t w o or more op erators with acceptable preferences If t w o op erators b oth ha v e IMP ASSES AND SUBST A TES D D D Elaboration Phase Decision Phase Decision 1 Quiescence Decision 2 Decision 3 Elaboration Cycle Elaboration Phase Preference Phase Working Memory Phase 1 all non operator preferences are considered 2 the preferences are evaluated 3 elements are added and deleted from working memory newly instantiated productions fire AND productions that are no longer instantiated are retracted Quiescence Decision Phase 1 all operator prefer
207. mec hanism c h unking All decisions are made through the com bination of relev an t kno wledge at run time In Soar ev ery decision is based on the curren t in terpretation of sensory data and an y relev an t kno wledge retriev ed from p ermanen t memory Decisions are nev er precompiled in to unin terruptible sequences CHAPTER INTR ODUCTION Using this Man ual W e exp ect that no vice Soar users will read the man ual in the order it is presen ted p erhaps skipping Chapter Chapter and Chapter describ e Soar from dieren t p ersp ectiv es Chapter describ es the Soar arc hitecture but a v oids issues of syn tax while Chapter describ es the syn tax of Soar including the sp ecic conditions and actions allo w ed in Soar pro ductions Chapter describ es c h unking Soar s learning mec hanism Not all users will mak e use of c h unking but it is imp ortan t to kno w that this capabilit y exists Chapter briey describ es adv anced features of Soar suc h as using input and out put to in terface with a real or sim ulated w orld writing Tcl Tk routines and running Soar with m ultiple agen ts Again not all users will mak e use of these capabilities but it is imp ortan t to kno w that
208. mer refers to the system describ ed in this man ual common to all users and the latter refers to kno wledge added to the arc hitecture A Soar program con tains the kno wledge to b e used for solving a sp ecic task or set of tasks including information ab out ho w to select and apply op erators to transform the states of the problem and a means of recognizing that the goal has b een ac hiev ed Problem Solving F unctions in Soar All of Soar s long term kno wledge is organized around the functions of op erator selec tion and application These functions are comp osed of four distinct t yp es of kno wl edge Kno wledge to select an op erator Op er ator Pr op osal Kno wledge that an op erator is appropriate for the curren t situation Op er ator Comp arison Kno wledge to compare candidate op erators Op er ator Sele ction Kno wledge to select a single op erator based on the comparisons Kno wledge to apply an op erator Op er ator Applic ation Kno wledge of ho w a sp ecic op erator mo dies the state In addition there is a fth t yp e of kno wledge in Soar that is indirectly connected to b oth op erator selection and application Kno wledge of monotonic inferences that can b
209. mes of aliases that ha v e b een dened When I lo ok at the actual denitions I suddenly understand It s w a y more complicated than what I t yp ed But I don t understand wh y this is necessary Wh y can t it just b e sa v ed as a string the w a y I though t Unix do es it Example soar gt alias r run d alias r run d soar gt r r Moving Block b to c O O move block Moving Block b to a 0 O O move block Moving Block c to b O O move block soar gt alias alias ea ec et exit fc i l m p ps q r r s w wmes soar gt alias r alias r r if args run d else eval run d args V ersion 0 c omment I m fairly certain that this c hange is what brok e the abilit y to use m ultiple commands with an alias e g y ou used to b e able to dene an alias lik e run d prin t s I can ev al run d and ev al run d prin t s I m guessing this other approac h has to do with some sort of eciency concern but I w onder if the tradeo is w orth it Not b eing able to dene m ulti command aliases and not b eing able to prin t a simple denition of an alias KJC I don t think it s on the list for either I d lik e t
210. ministrator If y ou can run Soar y ou should alw a ys b e able to source the default pro ductions with the longer command source soar library default soar predefined aliases soarnews V ersion 0 c omment this command should probably b e c hanged to prin t ev en more info for example where to get do cumen tation and ho w to join soar group up date example output for nal release The soarnews command prin ts information ab out the curren t release MISCELLANEOUS Example soar gt soarnews News for Soar version 0 TCL TK Bugs and questions should be sent to soar bugs cs cmu edu The current bug list may be obtained by sending mail to soarhack cs cmu edu with the Subject line bug list This software is in the public domain and is made available AS IS Carnegie Mellon University The University of Michigan and The University of Southern California Information Sciences Institute make no warranties about the software or its performance implied or otherwise Type help for information on various topics Type quit to exit Use ctrl c to stop a Soar run Type soarnews for news Type version for complete version information soar gt The soar library soar tcl le The soar library soar tcl le is loa
211. mory An output function is called only if c hanges ha v e b een made to the output link structures in w orking memory The structures for manipulating input and output in Soar are link ed to a predened attribute of the top lev el state called the io attribute The io attribute has sub structure to represen t sensor inputs from the en vironmen t called input links b ecause these are represen ted in w orking memory Soar pro ductions can matc h against input links to resp ond to an external situation Lik ewise the io attribute has substruc ture to represen t motor commands called output links F unctions that execute motor commands in the en vironmen t use the v alues on the output links to determine when and ho w they should execute an action Generally input functions create and remo v e elemen ts on the input link to up date Soar s p erception of the en vironmen t Output functions resp ond to v alues of w orking memory elemen ts that app ear on Soar s output link strucure Input and output in w orking memory All input and output is represen ted in w orking memory as substructure of the io attribute of the top lev el state By default the arc hitecture creates an input link attribute of the io ob
212. n determining the conditions of a c h unk then no c h unk will b e built for the curren tly considered action This is recursiv e so that if an un c h unk ed result is relev an t to a second result no c h unk will b e built for the second result This do es not prev en t the creation of a c h unk that w ould include quiescence t as a condition Learning has b een temp orarily turned o via a call to the dont learn pro duc tion action describ ed on page in Section This capabilit y is pro vided for debugging and system dev elopmen t and it is not part of the theory of Soar If a result is to b e c h unk ed Soar builds the c h unk as so on as the r esult is cr e ate d rather than w aiting un til subgoal termination Determining Conditions and Actions Ch unking is an exp erience based learning mec hanism that summarizes as pro ductions the problem solving that o ccurs within a state In order to main tain a history of the pro cessing to b e used for c h unking Soar builds a tr ac e of the pro ductions that re in the subgoals This section describ es ho w the relev an t actions are determined ho w information is stored in a trace and nally ho w the trace and the act
213. n impasse as describ ed in Section Preferences can b e confusing for example there can b e t w o suggested v alues that are b oth b est whic h again will lead to an impasse unless additional preferences resolv e this conict or there ma y b e one preference to sa y that v alue A is b etter than v alue B and a second preference to sa y that v alue B is b etter than v alue A Soar s Execution Cycle Without Substates The execution of a Soar program pro ceeds through a n um b er of cycles Eac h cycle has v e phases Input New sensory data comes in to w orking memory CHAPTER THE SO AR AR CHITECTURE Prop osal Pro ductions re and retract to in terpret new data state elab ora tion prop ose op erators for the curren t situation op erator prop osal and com pare prop osed op erators op erator comparison All of the actions of these pro ductions are I supp orted All matc hed pro ductions re in parallel and all retractions o ccur in parallel and matc hing and ring con tin ues un til there are no more additional complete matc hes or retractions of pro ductions quiesc enc e Decision A new op erator is selected or an impasse is detected and a new state is created
214. n to explain c h unks and justi cations soar T oggle b et w een Soar metho dology and Soar metho dology w aitsnc Generate a w ait state rather than a state no c hange impasse explain backtraces name full cond num The explain backtraces command pro vides some in terpretation of the bac ktraces generated during the formation of c h unks and justications when impasses are re solv ed This command is only meaningful for a particular c h unk or justication if the save backtraces v ariable has b een set to on b efor e the impasse is resolv ed see Section If no argumen t is sp ecied then explain backtraces prin ts a list of all c h unks and justications for whic h bac ktracing information is a v ailable There are four dieren t w a ys to call explain backtraces with no argumen ts with a pro duction name with a pro duction name and an in teger condition n um b er and with a pro duction name and the argumen t full 0 CHAPTER THE SO AR USER INTERF A CE argumen ts action no ar gs prin t a listing of all pro ductions that can b e explained prodname prin t the conditions and grounds for the named pro duction prodname n prin t the grounds for the n th condition of the named pro
215. nd application of op erators is illustrated in Figure Soar has separate memories and dieren t represen tations for descriptions of its cur ren t situation and its long term kno wledge In Soar the curren t situation including data from sensors results of in termediate inferences activ e goals and activ e op era tors is held in working memory W orking memory is organized as obje cts Ob jects are describ ed in terms of their attributes the v alues of the attributes ma y corresp ond to sub ob jects so the description of the state can ha v e a hierarc hical organization This need not b e a strict hierarc h y for example there s nothing to prev en t t w o ob jects from b eing substructure of eac h other The long term kno wledge whic h sp ecies ho w to resp ond to dieren t situations in CHAPTER THE SO AR AR CHITECTURE select apply select apply select apply Soar execution Figure Soar is con tin ually trying to select and apply op erators w orking memory can b e though t of as the program for Soar The Soar arc hitecture cannot solv e an y problems without the addition of long term kno wledge Note the distinction b et w een the Soar arc hitecture and the Soar program The for
216. njunctions negations acceptable preferences for op erators and a few adv anced topics A grammar for the condition side is giv en in App endix Conditions The condition side of a pro duction consists of a set of conditions Eac h condition tests for the existence or absence explained later in Section of w orking memory elemen ts Eac h condition consists of a op en paren thesis follo w ed b y a test for the iden tier and the tests for augmen tations of that iden tier in terms of attributes and v alues The condition is terminated with a close paren thesis Th us a single condition migh t test prop erties of a single w orking memory elemen t or prop erties of m ultiple w orking memory elemen ts that constitute an ob ject identifier test attribute test value test attribute test value test attribute test value test The rst condition in a pro duction m ust matc h against a state in w orking memory Th us the rst condition m ust b egin with the additional sym b ol state All other conditions and actions m ust b e linke d directly or indirectly to this condition This link age ma y b e direct to the state or it ma y b e indirect through ob jects sp ecied in the conditions If the id
217. ns When the depth is greater than the iden tier links from the sp ecied WME s will b e follo w ed so that additional substructure is prin ted F or example a depth of means that the ob ject sp ecied b y the iden tier wme pattern or timetag will b e prin ted along with all other ob jects whose iden tiers app ear as v alues of the rst ob ject This ma y result in m ultiple copies of the same ob ject b eing prin ted out If internal is also sp ecied then individuals WMEs and their timetags will b e prin ted instead of the full ob jects Example soar gt default wme depth soar gt default wme depth Notes See the print command on page 0 for more information and examples on default prin t depth CONFIGURING TRA CE INF ORMA TION AND DEBUGGING wmes fidentifier timetag pattern g The wmes alias is a shorthand for print depth 0 internal used to prin t w orking memory elemen ts The wmes command alw a ys prin ts WME s in their in ternal form i e as separate w orking memory elemen ts with timetags rather than as ob jects As with the print command the depth can b e set to an y lev el b y using the optional depth ag but then WMEs ma y b e prin ted m ultiple times once for eac h ob
218. ntifier timetag pattern g argumen t prin ts depth n for w orking memory elemen ts only follo ws links to prin t the sub ob jects of ob jects to the sp ecied depth internal Prin t the individual WMEs for the item sp ecied identifier prin ts the w orking memory ob ject sp ecied b y the iden tier timetag prin t the ob ject or WME with this in teger timetag pattern prin t ob ject or WME that matc hes this pattern print is also used to prin t items in w orking memory The syn tax of prin ting items from w orking memory is a bit tric ky including the optional ags can alter the output dramatically By default print retriev es the ob ject asso ciated with the identier timetag or p attern sp ecied as the argumen t to print Recall that an ob ject com prises all WMEs with a common iden tier But dep ending on whether internal is sp ecied and what the depth v alue is the output generated migh t b e a long list of individual WMEs or sev eral copies of the same ob ject The eects of these ags will b e describ ed in text but the reader is encouraged to study the examples T o prin t items from w orking memory one of the follo wing argumen ts m ust b e giv en an identier suc h as S
219. o cate memory leaks gds print This is a debugging command for examining the Goal Dep endency Set for eac h goal in the stac k First it steps through all the w orking memory elemen ts in the rete lo oking for an y that are included in any goal dep endency set and prin ts eac h one Then it also lists eac h goal in the stac k and prin ts the wmes in the goal dep endency set for that particular goal This command is useful when trying to determine wh y subgoals are disapp ear unexp ectedly often something has c hanged in the goal dep endency set causing a subgoal to b e regenerated prior to pro ducing a result EXAMINING MEMOR Y Example soar gt gds_print Current GDS stepping thru all wmes in rete looking for any that are in a gds For Goal S S superstate S For Goal S S choices multiple For Goal S S operator O For Goal S S operator O For Goal S S operator O For Goal S S desired D For Goal S 0 S problem space P For Goal S P default state copy yes For Goal S P default operator copy no For Goal S No GDS for this goa
220. o cessing required to pro duce the results of subgoals When a c h unk is built it is added to pro duction memory where it will b e matc hed in similar situations a v oiding the need for the sub goal Ch unks are created only when results are formed in subgoals since most Soar programs are con tin uously subgoaling and returning results to higher lev el states c h unks are t ypically created con tin uously as Soar runs This c hapter b egins with a discussion of when c h unks are built Section b elo w follo w ed b y a detailed discussion of ho w Soar determines a c h unk s conditions and actions Section Sections through examine the construction of c h unks in further detail Section explains ho w and wh y c h unks are prev en ted from matc h ing with the WME s that led to their creation Section reviews the problem of o v ergeneral c h unks Ch unk Creation Sev eral factors go v ern when c h unks are built Soar c h unks the results of ev ery subgoal unless one of the follo wing conditions is true Learning is off See Section on page for details of learn used to turn learning o Learning can b e set to on or off When learn is on c h unks are built When lea
221. o lea v e it and see ho w it pla ys with users Since alias is implemen ted in TCl and not C it will b e simple to ha v e users up date it later 0 CHAPTER THE SO AR USER INTERF A CE Dening command aliases The user ma y dene his or her o wn aliases for an y of the Soar commands pro vided here see the alias command on page for more information F requen tly used aliases ma y b e dened in a le that is loaded using the source command at start up time see App endix on page for more information source default The command source default pro vides a simple means of loading Soar s default kno wledge describ ed in Section and in App endix without kno wing the path name to the le of default rules Example soar gt source default soar gt Notes The dollar sign indicates that default is a Tcl v ariable If y ou ha v e an y problems with this command it is lik ely that this v ariable is not b eing resolv ed prop erly If this should happ en y ou ll ha v e to use the full pathname to load the default pro ductions rep ort the problem to y our lo cal Soar ad
222. o o ccur When the impasse o ccurs a pro duction can test for the resulting substate and create a result for the original subgoal This form of state test builds o v ergeneral c h unks b ecause no pre existing structure is relev an t to the result that terminates the subgoal The result is dep enden t only on the existence of the substate within a substate Solution The curren t solution to this problem is to allo w the problem solving to signal the arc hitecture that the test for a substate is b eing made The signal used b y Soar is a test for the quiescence t augmen tation of the subgoal The c h unking mec hanism recognizes this test and do es not build a c h unk when it is found in a bac ktrace of a subgoal The history of this test is main tained so that if the result of the substate is then used to pro duce further results for a sup erstate no higher c h unks will b e built Ho w ev er if the result is used as searc h con trol it is a desirabilit y preference then it do es not prev en t the creation of c h unks b ecause the original result is not included in the bac ktrace If the quiescence t b eing tested is connected to a sup erstate it will not inhibit c h unking and it
223. o select the curren t op erator for that state F or an op erator to b e selected there will b e at least one preference for it sp ecically a preference to sa y that the v alue is a candidate for the op erator attribute of a state this is done with either an acceptable or require preference There ma y also b e others for example to sa y that the v alue is b est The dieren t preferences a v ailable and the seman tics of preferences are explained in Section Preferences remain in preference memory un til remo v ed for one of the reasons previously discussed in Section Preference seman tics This section describ es the seman tics of eac h t yp e of preference More details on the preference resolution pro cess are pro vided in App endix Only a single v alue can b e selected as the curren t op erator that is all v alues are m utually exclusiv e In addition there is no implicit transitivit y in the seman tics of preferences If A is indieren t to B and B is indieren t to C A and C will not b e indieren t to one another unless there is a preference that A is indieren t to C or C and A are b oth indieren t to all comp eting v alues Acceptable An acceptable preference
224. o gt name move block moving block lt thing gt destination lt thing gt CHAPTER THE SYNT AX OF SO AR PR OGRAMS Structured v alues ma y b e nested to an y depth Th us it is p ossible to write our example pro duction using a single condition with m ultiple structured v alues sp blocks world propose move bl ock state lt s gt problem space blocks thing lt thing gt lt gt lt thing gt lt thing gt clear yes ontop top block lt thing gt type block clear yes bottom block lt gt lt thing gt gt lt s gt operator lt o gt lt o gt name move block moving block lt thing gt destination lt thing gt Notes on structured v alue notation A ttribute path notation and structured v alue notation are orthogonal and can b e com bined in an y w a y A structured v alue can con tain an attribute path or a structure can b e giv en as the v alue for an attribute path Structured v alue notation ma y also b e com bined with negations and with m ulti attributes Structured v alue notation ma y not b e used in the actions of pro ductions The action side of pro ductions or RHS The action side of a pro duction also called the righ t hand side or RHS of the pro duction
225. oblem space P will also b e remo v ed as will the acceptable preferences for O O and O and the impasse attribute and choices augmen tations of state S These w orking memory elemen ts are remo v ed b ecause they are no longer link ed to the subgoal stac k The acceptable preferences for op erators O O and O remain in w orking memory They w ere link ed to state S but since they are also link ed to state S so they will sta y in w orking memory un til S is remo v ed or un til they are retracted or rejected Soar s Execution Cycle With Substates When there are m ultiple substates Soar s cycle remains basically the same but has a few minor c hanges The rst c hange is that during the decision pro cedure Soar will detect impasses and create new substates F or example follo wing the prop osal phase the decision phase will detect if a decision cannot b e made giv en the curren t preferences If an impasse arises a new substate is created and added to w orking memory LEARNING The decision pro cedure will detect an op erator no c hange impasse as so on as an op erator is selected and added to w orking memory b y c hec king to see whether or not pro ductions will create O supp orted a
226. ommand name The help command and its alias pro vide online reference information ab out Soar commands Only the help command is referred to in this c hapter but help and ma y b e used in terc hangably When called with no argumen ts help will pro vide a brief synopsis of some of the most frequen tly used Soar commands When called with the optional argumen t all help will prin t a listing of all of the commands in Soar follo w ed b y a listing of the core Tcl commands for whic h information is a v ailable Or it ma y prin t a hin t as to where to lo ok for the on line Tcl do cumen tation if Soar can t displa y it for some reason When help is called with a sp ecic c ommand name help will displa y a man ual page for that command Soar will searc h for Soar Tcl and on Unix the system man pages and prin t the information for the rst matc h to c ommand name that it nds When Soar is b eing run under the Tcl Soar In terface TSI the requested help page will b e displa y ed in an indep enden t scrollable windo w When Soar is run without the TSI the help page will temp orarily o v erwrite the text on the windo w in whic h y ou are running Soar to mak e the help page go a w
227. on pro cedure creates the op erator augmen tation of the state based on preferences This records the selection of the curren t op erator In order to allo w these links to ha v e some substructure the attribute name ma y b e an iden tier whic h means that the attribute ma y itself ha v e attributes and v alues as sp ecied b y additional w orking memory elemen ts CHAPTER THE SO AR AR CHITECTURE The I O system creates w orking memory elemen ts on the input link for sensory data The elemen ts in w orking memory are remo v ed in six dieren t w a ys The decision pro cedure automatically remo v es all state augmen tations it creates when the impasse that led to their creation is resolv ed The decision pro cedure remo v es the op erator augmen tation of the state when that op erator is no longer selected as the curren t op erator Pro duction actions that use reject preferences remo v e w orking memory ele men ts i supp orted w orking memory elemen ts are remo v ed when the pro ductions that created them no longer matc h The I O system remo v es sensory data from the input link when it is no longer v alid The arc hitecture automatically remo v es WME s that are no longer link
228. ons These will b e discussed more thoroughly in Chapter CHAPTER INTR ODUCTION Chapter The Soar Arc hitecture This c hapter describ es the Soar arc hitecture It co v ers all asp ects of Soar except for the sp ecic syn tax of Soar s memories and descriptions of the Soar user in terface commands This c hapter giv es an abstract description of Soar It starts b y giving an o v erview of Soar and then go es in to more detail for eac h of Soar s main memories w orking memory pro duction memory and preference memory and pro cesses the decision pro cedure learning and input and output An Ov erview of Soar The design of Soar is based on the h yp othesis that all delib erate go al orien ted b eha vior can b e cast as the selection and application of op er ators to a state A state is a represen tation of the curren t problem solving situation an op erator transforms a state mak es c hanges to the represen tation and a goal is a desired outcome of the problem solving activit y As Soar runs it is con tin ually trying to apply the curren t op erator and select the next op erator a state can ha v e only one op erator at a time un til the goal has b een ac hiev ed The selection a
229. ory It will also prin t the curren t subgoal stac k The print command m ust tak e an argumen t suc h as the name or typ e of a pro duction to prin t pro ductions an identier timetag or p attern to prin t an ob ject or elemen t in w orking memory or stack to prin t the curren t subgoal stac k It is a rather o v erloaded and complex command so it is brok en do wn in to its three dieren t functions b elo w Eac h section denes the p ertinen t argumen ts and giv es examples The output of print is dep enden t on the order of the argumen ts Argumen ts suc h as internal full and filename are applied only to argumen ts that follo w them on the commandline F or example soar gt print chunks full print only the names of chunks default soar gt print full chunks print each chunk entirely This ma y seem inexible but it do es allo w users to prin t an y n um b er of items in memory and ha v e dieren t mo diers apply to dieren t argumen ts with a single com 0 CHAPTER THE SO AR USER INTERF A CE mand Prin ting items in pro duction memory Usage print internal name full filename n fprodname all chunks defaults ju stif icat ions u serg argumen t pr
230. osg mem pos funhashed negativeg negative funhashed positiveg positive fdummy topg fdummy matchesg fconj neg g fconj neg partnerg production total Note that the t w o w ord rtyp es m ust b e enclosed in curly braces and qualier m ust b e one of the follo wing CONFIGURING TRA CE INF ORMA TION AND DEBUGGING actual if no merging if no sharing The total statistic giv es a total coun t o v er all no de t yp es The if no sharing option is a v ailable only if Soar has b een compiled with SHARING FACTORS set to TRUE whic h is the default for the Soar distribution Examples soar gt stats rete Node Type Actual If no merging unhashed memory memory unhashed mem pos 0 mem pos 0 unhashed negative 0 0 negative unhashed positive 0 positive 0 dummy top dummy matches 0 0 conj neg conj neg partner production Total 0 warnings on off The warnings command con trols whether w arnings are prin ted during the loading of pro ductions The default v alue for warnings is on it ma y also b e set to off With no argumen t the warnings command returns the curren t setting If w arnings are disabled using
231. ot determine wh y a w orking memory elemen t was not pro duced in the subgoal and th us allo w ed the pro duction to re Ignoring these negations of conditions in ternal to the subgoal ma y lead to o v ergeneralization in c h unking see Section on page Determining a c h unk s conditions The conditions of a c h unk are determined b y a dep endency analysis of pro duction traces a pro cess called b acktr acing F or eac h instan tiated pro duction that creates a subgoal result bac ktracing examines the pro duction trace to determine whic h w orking memory elemen ts w ere matc hed If a matc hed w orking memory elemen t is link ed to a sup erstate it is included in the c h unk s conditions If it is not link ed to a sup erstate then bac ktracing recursiv ely examines the trace of the pro duction that created the w orking memory elemen t Th us bac ktracing b egins with a subgoal result traces bac kw ards through all w orking memory elemen ts that w ere used to pro duce that result and collects all of the w orking memory elemen ts that are link ed to a sup erstate This metho d ignores when the w orking memory elemen ts w ere created th us allo wing the conditions of one c h unk to test
232. otes If double quotes are used the string will rst b e scanned for Tcl v ariable references indicated b y a sign and em b edded command ev aluations an ything enclosed in square brac k ets b efore the command is ev aluated Examples soar gt command to file print all my task soar soar gt command to file print chunk my chunks soar soar gt command to file firing counts existing my firing counts save The rst example will sa v e all pro ductions including c h unks justications and de fault pro ductions to the le my task soar the second example will sa v e only c h unks to the le mychunks soar Both les are formatted suc h that they could b e read bac k in to reload the pro ductions The third example app ends the ring coun ts data to the le my firing counts save note that the curly braces w ere not required to group the command string but including them w ould w ork ne to o 0 CHAPTER THE SO AR USER INTERF A CE Directory F older functions chdir cd dirs popd pushd pwd topd There are sev eral commands for c hanging and displa ying the curren t dir e ctory or folder chdir cd pwd The commands chdir and cd are synon yms They tak e as an optional argumen t the relativ e or absolute p
233. other collection of WME s migh t describ e the ob ject T T is a table T is bro wn and T is on top of F And still another collection of WME s migh t describ e the ob ject F F is a o or etc All ob jects in w orking memory m ust b e link ed to a state either directly or indirectly through other ob jects Ob jects that are not link ed to a state will b e automatically remo v ed from w orking memory b y the Soar arc hitecture WME s are also often called augmentations b ecause they augmen t the ob ject pro W ORKING MEMOR Y THE CURRENT SITUA TION viding more detail ab out it While these t w o terms are somewhat redundan t WME is a term that is used more often to refer to the con ten ts of w orking memory while augmen tation is a term that is used more often to refer to the description of an ob ject W orking memory is illustrated at an abstract lev el in Figure on page The attribute of an augmen tation is usually a constan t suc h as name or type b ecause in a sense the attribute is just a lab el used to distinguish one link in w orking memory from another The v alue of an augmen tation ma y b e either a constan t suc h as red or an iden tier suc h as 0
234. oun tered leading to new subgoals Th us it is p ossible for Soar to ha v e a stack of subgoals represen ted as states Eac h state has a single sup erstate except the initial state and eac h state ma y ha v e at most one substate Newly created subgoals are considered to b e added to the b ottom of the stac k the rst state is therefore called the top level state See Figure 0 for a simplied illustrations of a subgoal stac k The original state is the top of the stac k b ecause as Soar runs this state created rst will b e at the top of the computer screen and substates will app ear on the screen b elo w the top lev el state CHAPTER THE SO AR AR CHITECTURE superstate attribute choices impasse nil thing B1 B2 B3 T1 S1 O2 operator operator superstate S2 operator superstate no change operator none S3 O9 attribute choices impasse tie operator multiple O4 O5 O6 O1 item O7 O8 O9 Top level state Subgoal level 1 Subgoal level 2 operator operator operator acceptable preferences for operators state and operator objects other objects operator decisions that have not yet been made O2 nil This subgoal was created because Soar didn t know how to apply opera
235. ously sa v ed The Rete net is Soar s in ternal represen tation of pro duction memory the conditions of pro ductions are reordered and common substructures are shared across dieren t pro ductions This command pro vides a fast metho d of sa ving and loading pro ductions since a binary format is used rete net les are p ortable across platforms that supp ort Soar The action m ust b e one of the follo wing argumen t action save filename Sa v e the Rete net in the named lename load filename Load the named lename in to the Rete net w ork The Rete net w ork cannot b e sa v ed while there are justications presen t These can b e eliminated b y using the init soar command In order to load pro ductions stored in binary form w orking memory and pro duc tion memory m ust b oth b e empt y W orking memory can b e emptied b y using the init soar command Pro duction memory can b e emptied b y using the excise all command If w orking memory or pro duction memory is not empt y an error message is issued Example soar gt rete net save my program with chunks ret e soar gt init soar soar gt excise all soar gt rete net load my program with chunks ret e CHAPTER THE SO AR USER INTERF A CE Notes If the
236. parated b y dots after the in a condition F or example using attribute path notation the pro duction sp blocks world monitor move bl ock state lt s gt operator lt o gt lt o gt name move block moving block lt block gt destination lt block gt lt block gt name lt block name gt lt block gt name lt block name gt gt write crlf Moving Block lt block name gt to lt block name gt could b e written as sp blocks world monitor move bl ock state lt s gt operator lt o gt lt o gt name move block moving block name lt block name gt destination name lt block name gt gt write crlf Moving Block lt block name gt to lt block name gt A ttribute path notation yields shorter pro ductions that are easier to write less prone to errors and easier to understand When attribute path notation is used Soar in ternally expands the conditions in to the m ultiple Soar ob jects creating its o wn v ariables as needed Therefore when y ou CHAPTER THE SYNT AX OF SO AR PR OGRAMS prin t a pro duction using the print command the pro duction will not b e represen ted using attribute path notation Negations and attribute path notation A negation ma y b e us
237. perator O is a preference that asserts that op erator O is an acceptable op erator for state S while S operator O gt O is a preference that asserts that op erator O is a b etter c hoice for the op erator of state S than op erator O The seman tics of preferences and ho w they are pro cessed w ere describ ed in Section whic h also describ ed eac h of the t w elv e dieren t t yp es of preferences Multiple pro duction instan tiations ma y create iden tical preferences Unlik e w orking memory preference memory is not a set Duplicate preferences are allo w ed in preference mem ory Pro duction Memory Pro duction memory con tains pro ductions whic h can b e loaded in b y a user t yp ed in while Soar is running or sourced from a le or generated b y c h unking while Soar is running Pro ductions b oth user dened pro ductions and c h unks ma y b e examined using the print command describ ed in Section on page 0 Eac h pro duction has three required comp onen ts a name a set of conditions also called the left hand side or LHS and a set of actions also called the righ t hand side or RHS There are also t w o optional comp onen ts a do cumen tation string and a t
238. pt and only ags in teract with dont learn and force learn pro duction actions as describ ed in Section on page With the on ag c h unking is on all the time With the except ag c h unking is on but Soar will not create c h unks for states that ha v e had RHS dont learn actions executed in them With the only ag c h unking is o but Soar will create c h unks for only those states that ha v e had RHS force learn actions executed in them With the off ag c h unking is o all the time The only ag and its companion force learn RHS action allo w Soar dev elop ers to turn learning on in a particular problem space so that they can fo cus on debugging the learning problems in that particular problem space without ha ving to address the problems elsewhere in their programs at the same time Similarly the except ag and its companion dont learn RHS action allo w dev elop ers to temp orarily turn learning o for debugging purp oses These facilities are pro vided as debugging to ols and do not corresp ond to an y theory of learning in Soar The list ag pro duces a listing of the iden tiers of all states that ha v e b een set to don t learn and all states that ha v e b een set to force learn
239. r chunk Have explanation for chunk Have explanation for chunk Have explanation for justification Have explanation for justification Have explanation for justification Have explanation for justification Have explanation for justification soar gt explain backtraces chunk sp chunk state lt s gt object dynamic lt n gt problem space lt p gt desired lt d gt operator lt o gt object dynamic lt n gt lt n gt clear yes object static lt b gt lt s gt object dynamic lt n gt lt n gt clear yes object static lt b gt lt p gt default state copy no two level attributes object dynamic name blocks world default operator copy no CONFIGURING SO AR S R UNTIME P ARAMETERS lt d gt ontop count object dynamic lt d gt object dynamic lt gt lt d gt lt d gt object dynamic lt gt lt d gt lt gt lt d gt lt d gt lt b gt type block lt d gt object static lt b gt ontop lt b gt lt d gt object static lt b gt lt o gt moving block lt b gt destination lt b gt lt d gt ontop lt b gt lt n gt object static lt b gt ontop lt t gt lt d gt object static lt b gt lt d gt ontop lt t gt gt lt s gt operator lt o gt gt state lt s gt object dynamic lt n
240. r ob jects that are link ed to that state Arc hitectural roles of pro ductions Soar pro ductions can fulll four dieren t roles including the three kno wledge retriev al problem solving functions and state elab oration function as describ ed on page Op erator prop osal Op erator comparison Op er ator sele ction is not an act of know le dge r etrieval Op erator application State elab oration A single pro duction should not fulll more than one of these roles except for prop os ing an op erator and creating an absolute preference for it Although pro ductions are not declared to b e of one t yp e or the other Soar examines the structure of eac h pro duction and classies the rules automatically based on whether they prop ose and compare op erators apply op erators or elab orate the state Pro duction Actions and P ersistence The t w o main actions of a pro duction are to create preferences for op erator selec tion and create or remo v e w orking memory elemen ts F or op erator prop osal and PR ODUCTIONS LONG TERM KNO WLEDGE comparison a pro duction creates preferences for op erator selection These prefer ences should p ersist only as long as the pro duction instan tiation that
241. re The watch learning argumen ts aect the amoun t of information prin ted when a c h unk or justication is cr e ate d but not when they are red or retracted F or prin ting additional information ab out c h unks and justications after they are created see the explain backtraces command on page W atc hing other functions Three additional argumen ts to the watch command con trol the tracing of other Soar ev en ts as sho wn in the follo wing table w atc h eect on the Soar trace backtracing on prin t bac ktracing information when a c h unk is created off don t prin t bac ktracing information default aliases on ec ho aliases when they are dened off don t ec ho aliases when they are dened default loading on prin t an asterisk for eac h pro duction loaded and a p ound sign for eac h pro duction excised default off don t prin t an ything when pro ductions are loaded or excised Conguring Soar s Run time P arameters This section describ es the commands that con trol Soar s Run time P arameters Man y of these commands pro vide options that simplify or restrict run time b eha vior to en able easier and more lo calized debugging Others allo w users to select alternativ e CONFIGU
242. reated and initialized before init soar The agen t is ab out to b e initialized The init soar command will generate this ev en t after init soar The agen t has just b een initialized The init soar command will generate this ev en t after halt soar The agen t has just b een halted before schedule cycle This ev en t is triggered b y the run command it o ccurs just b efore the agen t is run after schedule cycle This ev en t is triggered b y the run command it o ccurs just after the agen t is run before decision cycle A decision cycle is just ab out to start after decision cycle A decision cycle has just ended before input phase An input phase is just ab out to start after input phase An input phase has just ended before preference A preference phase is just ab out to b egin phase cycle after preference A preference phase has just ended phase cycle before wm phase cycle A w orking memory phase is just ab out to b egin after wm phase cycle A w orking memory phase is just ab out to b egin before decision A decision phase is ab out to b egin phase cycle after decision A decision phase has just ended phase cycle before output phase An output phase is just ab out to b egin after output phase An output phase
243. remainder sp gt lt s gt quotient div lt x gt lt y gt remainder mod lt x gt lt y gt abs atan2 sqrt sin cos These sym b ols pro vide prex notation unary mathematical functions they eac h tak e one argumen t These sym b ols w ork similarly to C functions They will tak e either in teger or real n um b er argumen ts The rst function abs returns an in teger when its argumen t is an in teger and otherwise returns a real n um b er and the last four functions alw a ys return a real n um b er atan returns as a oat in radians the arctangen t of rst arg second arg sin and cos tak e as argumen ts the angle in radians sp gt lt s gt abs value abs lt x gt sqrt sqrt lt x gt int Con v erts a single sym b ol to an in teger constan t This function exp ects ei ther an in teger constan t sym b olic constan t or oating p oin t constan t The sym b olic constan t m ust b e a string whic h can b e in terpreted as a single in te ger The oating p oin t constan t is truncated to only the in teger p ortion This function essen tially op erates as a t yp e casting function F or example the expression sqrt could b e prin ted as
244. return the curren t pr ex defaults to chunk count n If n is giv en set the c h unk coun ter for naming c h unks to n Otherwise return the curren t v alue of the c h unk coun ter The short format for naming newly created c h unks is pr exChunknum The long default format for naming c h unks is pr ex Chunknum ddc imp assetyp e dcChunknum where pr ex is a user denable prex string pr ex defaults to chunk when unsp ecied b y the user It ma y not con tain the c haracter Chunknum is n for the rst c h unk created n for the second c h unk created etc dc is the n um b er of the decision cycle in whic h the c h unk w as formed imp assetyp e is one of tie conflict cfailure snochange opnochange dcChunknum is the n um b er of the c h unk within that sp ecic decision cycle CONFIGURING TRA CE INF ORMA TION AND DEBUGGING Notes The chunk name format command enforces the constrain t that the pr ex string ma y not con tain the c haracter The chunk name format command enforces the constrain t that the Ch unkn um can not b e reset to a n um b er lo w er than the smallest c h unk n um b er of an y loaded c h unk The c haracter marks the ending of the n
245. ribute or v alue p ositions V ariables can b e further constrained b y additional tests PR ODUCTION MEMOR Y describ ed in later sections or b y m ultiple o ccurrences in conditions If a v ariable o c curs more than once in the condition of a pro duction the pro duction will matc h only if the v ariables matc h the same iden tier or constan t Ho w ev er there is no restriction that prev en ts dieren t v ariables from binding to the same iden tier or constan t Because iden tiers are generated b y Soar at run time it imp ossible to include tests for sp ecic iden tiers in conditions Therefore v ariables are used in conditions whenev er an iden tier is to b e matc hed V ariables also pro vide a mec hanism for passing iden tiers and constan ts whic h matc h in conditions to the action side of a rule Syn tactically a v ariable is a sym b ol that b egins with a left angle brac k et i e lt ends with a righ t angle brac k et i e gt and con tains at least one alphan umeric sym b ol in b et w een In the example pro duction in Figure there are sev en v ariables lt s gt lt clear gt lt clear gt lt ontop gt lt block gt lt block gt and lt o gt The follo wing table
246. ribute names A ttribute names should not b egin with a n um b er if these attributes will b e used in attribute path notation 0 CHAPTER THE SYNT AX OF SO AR PR OGRAMS Remo ving W orking Memory Elemen ts A elemen t is explicitly remo v ed from w orking memory b y follo wing the v alue with a dash also called a reject gt lt s gt block lt b gt If the remo v al of a w orking memory elemen t remo v es the only link b et w een the state and w orking memory elemen ts that had the v alue of the remo v ed elemen t as an iden tier those w orking memory elemen ts will b e remo v ed This is applied recursiv ely so that all item that b ecome unlink ed are remo v ed The reject should b e used with an action that will b e o supp orted If reject is at tempted with I supp ort the w orking memory elemen t will reapp ear if the reject loses I supp ort and the elemen t still has supp ort The syn tax of preferences Belo w are the ten t yp es of preferences as they can app ear in the actions of a pro duction for the selection of op erators RHS preferences Seman tics id operator value acceptable id operator value acceptable id operator valu
247. ring with no sp ecial c haracters the double quotes ma y b e omitted The prin ting of asterisks and p ound signs for eac h pro duction loaded as dened b y the sp command and excised redened using sp or remo v ed from pro duction memory using excise ma y b e turned o b y using the watch loading command this is describ ed in Section If the le b eing source d includes commands to source other les then users should either pushd to the directory or sp ecify full pathnames whenev er the source com mand is issued SO AR I O COMMANDS Soar I O Commands This section describ es the commands used to manage Soar s Input Output I O sys tem whic h pro vides a mec hanism for allo wing Soar to in teract with external systems suc h as a computer game en vironmen t or a rob ot Soar I O is accomplished via input functions and output functions whic h are managed using the io command These functions mak e calls to add wme and remove wme to add and remo v e elemen ts to the io structure of Soar s w orking memory See section for a functional description of Soar I O and The So ar A dvanc e d Applic ations Manual for more information on creating input and output functions The demo le demos soar io usin
248. rn is off c h unks are not built Learning is set to bottom up and a c h unk has already b een built for a subgoal of the state that generated the results See Section on page for details of learn used to set learning to b ottom up With b ottom up learning c h unks are learned only in states in whic h no subgoal has y et generated a c h unk In this mo de c h unks are learned only for the b ot CHAPTER LEARNING tom of the subgoal hierarc h y and not the in termediate lev els With exp erience the subgoals at the b ottom will b e replaced b y the c h unks allo wing higher lev el subgoals to b e c h unk ed The c h unk duplicates a pro duction or c h unk already in pro duction memory In some rare cases a duplicate pro duction will not b e detected b ecause the order of the conditions or actions is not the same as an existing pro duction The augmen tation quiescence t of the substate that pro duced the result is bac ktraced through This mec hanism is motiv ated b y the chunking fr om exhaustion problem where the results of a subgoal are dep enden t on the exhaustion of alternativ es see Section on page If this substate augmen tation is encoun tered whe
249. scrib ed in Section on page If there are m ultiple Soar agen ts that exist in the same Soar pro cess then issuing a run command in an y agen t will cause all agen ts to run with the same set of parameters unless the ag self is sp ecied in whic h case only that agen t will execute run follo w ed b y the k eyw ord forever is the same as the default b eha vior with no argumen ts Soar executes un til stopp ed b y an external in terrupt eg Ctrl C a RHS interrupt action or a RHS halt action The run command tak es t w o optional argumen ts an in teger n whic h sp ecies ho w man y units to run and a unit ag indicating what steps or incremen ts to use The follo wing is a list of a v ailable units and their meaning In eac h case if n is not sp ecied as an argumen t to run but a unit ag is sp ecied n defaults to CHAPTER THE SO AR USER INTERF A CE unit eect on running p run for n phases a phase is either input prop ose decide apply or output e run Soar for n elab oration cycles here input decide and output phases are eac h coun ted as an elab oration cycle d run for n decision cycles this is the default unit for running Soar if run is called with a n
250. sing structured v alue notation the pro duction in Figure on page ma y also b e written as sp blocks world propose move bl ock state lt s gt problem space blocks thing lt thing gt lt gt lt thing gt lt thing gt ontop top block lt thing gt bottom block lt gt lt thing gt lt thing gt type block clear yes lt thing gt clear yes gt lt s gt operator lt o gt lt o gt name move block moving block lt thing gt destination lt thing gt Th us sev eral conditions ma y b e collapsed in to a single condition Using v ariables within structured v alue notation V ariables are allo w ed within the paren theses of structured v alue notation to sp ecify an iden tier to b e matc hed elsewhere in the pro duction F or example the v ariable lt ontop gt could b e added to the conditions although it are not referenced again so this is not helpful in this instance sp blocks world propose move bl ock state lt s gt problem space blocks thing lt thing gt lt gt lt thing gt lt thing gt ontop lt ontop gt top block lt thing gt bottom block lt gt lt thing gt lt thing gt type block clear yes lt thing gt clear yes gt lt s gt operator lt o gt lt
251. sms pro vided in Soar are called input functions and output functions Input functions add and delete elemen ts from w orking memory in resp onse to c hanges in the external en vironmen t Output functions attempt to eect c hanges in the external en vironmen t Input is pro cessed at the b eginning of eac h execution cycle and output o ccurs at the end of eac h execution cycle Using input and output functions with Soar will b e discussed briey in Chapter and in more detail in The So ar A dvanc e d Applic ations Manual Chapter The Syn tax of Soar Programs This c hapter describ es in detail the syn tax of elemen ts in w orking memory preference memory and pro duction memory and ho w impasses and I O are represen ted in w orking memory and in pro ductions W orking memory elemen ts and preferences are created as Soar runs while pro ductions are created b y the user or through c h unking The bulk of this c hapter explains the syn tax for writing pro ductions The rst section of this c hapter describ es the structure of w orking memory elemen ts in Soar the second section describ es the structure of preferences and the third section describ es the structure of pro ductions The fourth section describ
252. t lt lt o gt lt o gt lt o gt lt s gt operator lt o gt operator lt o gt operator lt o gt lt lt o gt operator lt o gt lt o gt An y one of those actions could b e expanded to the follo wing list of preferences lt s gt operator lt o gt lt s gt operator lt o gt lt s gt operator lt o gt lt lt o gt lt s gt operator lt o gt lt s gt operator lt o gt Note that structured v alue notation ma y not b e used in the actions of pro ductions Righ thand side F unctions The fourth t yp e of action that can o ccur in pro ductions is called a righthand side function Righ thand side functions allo w pro ductions to create side eects other than c hanging w orking memory The RHS functions are describ ed b elo w organized b y the t yp e of side eect they ha v e CHAPTER THE SYNT AX OF SO AR PR OGRAMS Stopping and pausing Soar halt T erminates Soar s execution and returns to the user prompt A halt action irrev ersibly terminates the running of a Soar program It should not b e used if Soar is to b e restarted see the interrupt RHS action b elo w sp gt halt interrupt Executing this function causes Soar to stop at the end o
253. t y gt 0 Example Pro duction sp propose operator to show exa mple pre dica te state lt s gt car lt c gt lt c gt style convertible color lt gt rust gt lt s gt operator lt o gt lt o gt name drive car car lt c gt In this pro duction there m ust b e a color attribute for the w orking memory ob ject that matc hes lt c gt and the v alue of that attribute m ust not b e rust Disjunctions of v alues A test for an iden tier attribute or v alue ma y also b e for a disjunction of constan ts With a disjunction there will b e a matc h if an y one of the constan ts is found in a w orking memory elemen t and the other parts of the w orking memory elemen t matc hes V ariables and predicates ma y not b e used within disjunctiv e tests Syn tactically a disjunctiv e test is sp ecied with double angle brac k ets i e lt lt and gt gt There m ust b e spaces separating the brac k ets from the constan ts The follo wing table pro vides examples of legal and illegal disjunctions Legal disjunctions Illegal disjunctions lt lt A B C I gt gt lt lt lt A gt A gt gt lt lt 0 gt gt lt lt lt gt 0 gt gt lt lt good morning good evening gt gt
254. tate ontop bottom object name table ontop bottom object name A gt lt s gt nothing ontop A or tabl e true whic h expands to sp blocks negated conjunctio n e xamp le state lt s gt name top state lt s gt ontop lt o gt lt o gt bottom object lt b gt lt b gt name a lt s gt ontop lt o gt lt o gt bottom object lt b gt lt b gt name table gt lt s gt nothing ontop a or tabl e true Notes on attribute path notation A ttributes sp ecied in attribute path notation ma y not start with a digit F or example if y ou t yp e foo bar Soar thinks the is a oating p oin t n um b er A ttributes that don t app ear in path notation can b egin with a n um b er A ttribute path notation ma y b e used to an y depth A ttribute path notation ma y b e com bined with structured v alues describ ed in Section PR ODUCTION MEMOR Y Structured v alue notation Another con v enience that eliminates the use of in termediate v ariables is structured v alue notation Syn tactically the attributes and v alues of a condition ma y b e written where a v ariable w ould normally b e written The attribute v alue structure is delimited b y paren theses U
255. tations of an ob ject can b e com bined in to a single action using the same syn tax as in conditions including path notation and m ulti v alued attributes gt lt s gt block color red thing lt t gt lt t gt The action ab o v e is expanded to b e gt lt s gt block lt b gt lt b gt color red lt s gt thing lt t gt lt s gt thing lt t gt This will add four elemen ts to w orking memory with the v ariables replaced with whatev er v alues they w ere b ound to on the condition side Since Soar is case sensitiv e dieren t com binations of upp er and lo w ercase letters represen t dier ent constan ts F or example red Red and RED are all distinct sym b ols in Soar In man y cases it is pruden t to c ho ose one of upp ercase or lo w ercase and write all constan ts in that case to a v oid confusion and bugs The constan ts that are used for attributes and v alues ha v e a few restrictions on them There are a n um b er of arc hitecturally created augmen tations for state and im passe ob jects see Section for a listing of these sp ecial augmen tations User dened pro ductions can not create or remo v e augmen tations of states that use these att
256. te These t w o v ariables will not necessarily bind to the same iden tiers in w orking memory Negated m ulti v alued attributes and attribute path notation Negations of m ulti v alued attributes can b e com bined with attribute path notation Ho w ev er it is v ery easy to mak e mistak es when using negated m ulti v alued attributes with attribute path notation Although it is p ossible to do it correctly w e strongly discourage its use F or example sp blocks negated conjunctio n e xamp le state lt s gt name top state ontop bottom object nam e table A gt lt s gt nothing ontop A or tabl e true CHAPTER THE SYNT AX OF SO AR PR OGRAMS gets expanded to sp blocks negated conjunctio n e xamp le state lt s gt name top state lt s gt ontop lt o gt lt o gt bottom object lt b gt lt b gt name A lt b gt name table gt lt s gt nothing ontop A or tabl e true This example do es not refer to t w o dieren t blo c ks with dieren t names It tests that there is not an ontop relation with a bottom block that is named A and named table Th us this pro duction probably should ha v e b een written as sp blocks negated conjunctio n e xamp le state lt s gt name top s
257. ted Pro ductions rings at higher lev els can resolv e impasses and th us eliminate lo w er states b efore the pro ductions at the lo w er lev el ev er re Th us whenev er a lev el in the state stac k is reac hed all pro duction activit y is guaran teed to b e consisten t with an y pro cessing that has o ccurred at higher lev els Learning When an op erator impasse is resolv ed it means that Soar has through problem solving gained access to kno wledge that w as not readily a v ailable b efore Therefore when an impasse is resolv ed Soar has an opp ortunit y to learn b y summarizing and generalizing the pro cessing in the substate Soar s learning mec hanism is called chunking it attempts to create a new pro duction called a c h unk The conditions of the c h unk are the elemen ts of the state that through some c hain of pro duction rings allo w ed the impasse to b e resolv ed the action of the pro duction is the w orking memory elemen t or preference that resolv ed the impasse the result of the impasse The conditions and action are v ariablized so that this new pro duction ma y matc h in a similar situation in the future and prev en t an impasse from arising Ch unks are v ery s
258. ted in the most recen t of those states and is not considered to ha v e b een created in the other states The arc hitecture automatically detects if a preference or w orking memory elemen t created in a substate is also link ed to a sup erstate These w orking memory elemen ts and preferences will not b e remo v ed when the im passe is resolv ed b ecause they are still link ed to a sup erstate and therefore they are called the r esults of the sub go al A result has either I supp ort or O supp ort the determination of supp ort is describ ed b elo w A w orking memory elemen t or preference will b e a result if its iden tier is already link ed to a sup erstate A w orking memory elemen t or preference can also b ecome a result indirectly if after it is created and still in w orking memory or preference memory its iden tier b ecomes link ed to a sup erstate through the creation of another result F or example if the problem solving in a state constructs an op erator for a sup erstate it ma y w ait un til the op erator structure is complete b efore creating an acceptable preference for the op erator in the sup erstate The acceptable preference is a result b ecause it w as created in the state
259. ter whic h op erator is selected b y default Soar c ho oses randomly from among the alter nativ es The indifferent selection function can b e used to c hange this b eha vior as describ ed on page in Chapter Require A require preference states that the v alue m ust b e selected if the goal is to b e ac hiev ed Prohibit A prohibit preference states that the v alue cannot b e selected if the goal is to b e ac hiev ed If a v alue has a prohibit preference it will not b e selected for a v alue of an augmen tation indep enden t of the other preferences If there is an acceptable preference for a v alue of an op erator and there are no other comp eting v alues that op erator will b e selected If there are m ultiple acceptable preferences for the same state but with dieren t v alues the preferences m ust b e ev aluated to determine whic h candidate is selected If the preferences can b e ev aluated without conict the appropriate op erator aug men tation of the state will b e are added to w orking memory This can happ en when they all suggest the same op erator or when one op erator is preferable to the others that ha v e b een suggested When the preferences conict Soar reac hes a
260. the same iden tier On the other hand the condition lt p gt name john type father spouse lt p gt w ould matc h only if there is no ob ject in w orking memory that matc hes all three attribute v alue tests Example Pro duction sp default evaluate object state lt ss gt operator lt so gt lt so gt type evaluation superproblem space lt p gt lt p gt default state copy no gt lt so gt default state copy yes Notes One use of negated conditions to a v oid is testing for the absence of the w orking memory elemen t that a pro duction creates with I supp ort this w ould lead to an PR ODUCTION MEMOR Y innite lo op in y our Soar program as Soar w ould rep eatedly re and retract the pro duction Negated conjunctions of conditions Conditions can b e group ed in to conjunctiv e sets b y surrounding the set of conditions with f and g The pro duction compiler groups the test in these conditions together This grouping allo ws for negated tests of more than one w orking memory elemen t at a time In the example b elo w the state is tested to ensure that it do es not ha v e an ob ject on the table sp blocks negated conjunctio n e xamp le state lt s gt name top state
261. ti c ation The justication summarizes the pro cessing in the substate that led to the result The conditions of a justication are those w orking memory elemen ts that exist in the sup erstate and ab o v e that w ere necessary for pro ducing the result This is determined b y collecting all of the w orking memory elemen ts tested b y the pro ductions that red in the subgoal that led to the creation of the result and then remo ving those conditions that test w orking memory elemen ts created in the subgoal The action of the justication is the result of the subgoal Soar determines I supp ort or O supp ort for the justication just as it w ould for an y other pro duction as describ ed in Section If the justication is an op erator application the result will receiv e O supp ort Otherwise the result gets I supp ort from the justication If a suc h a result loses I supp ort from the justication it will b e retracted if there is no other supp ort Justication are not added to pro duction memory but are otherwise treated as an instan tiated pro ductions that ha v e already red Justications include an y negated conditions that w ere in the original pro ductions that participated in pro ducing the results
262. tings the named argumen ts should b e used The named argumen ts can ha v e one of the additional switc hes on off inc Sp ecifying the inc switc h whic h fully sp ecied is inclusive or setting no ag at all has the eect of setting all lev els up to and including the lev el sp ecied This is the same b eha vior as when the equiv alen t n umeric argumen t is used Setting either the on or off switc h selectiv ely turns on or o only that lev el F or example watch productions on selectiv ely turns on the tracing of pro duction rings retractions watch productions off selectiv ely turns it o again watch productions inc turns on the tracing of pro ductions and also turns on tracing of all lev els b elo w pro ductions decisions and phases to o The n umeric and named ags ma y also b e used in com binations F or example y ou migh t w an t to sa y something lik e watch phases off to w atc h state and op er ator decisions and to see the names of pro ductions that re and retract but to omit the prin ting of phases Examples soar gt watch Current watch settings Decisions on Phases off Production firings retractions default productions off user productions off chunks
263. tor c hanging the state so the op erator prop osal no longer matc hes or other op erators are prop osed and preferred Eliminating Impasses An impasse is resolv ed when results are created that allo w progress to b e made in the state where the impasse arose In Soar impasse can b e eliminate d but not resolv ed when a higher lev el impasse is resolv ed eliminated or regenerated In these cases the impasse b ecomes irrelev an t b ecause higher lev el pro cessing can pro ceed An impasse can also b ecome irrelev an t if input from the outside w orld c hanges w orking memory whic h in turn causes pro ductions to re that mak e it p ossible to select an op erator In all these cases the impasse is eliminated but not resolv ed and Soar do es not learn in this situation Regenerating Impasses An impasse is r e gener ate d when the problem solving in the subgoal b ecomes inc onsis tent with the curren t situation During problem solving in a subgoal Soar monitors whic h asp ect of the surrounding situation the w orking memory elemen ts that exist in sup erstates the problem solving in the subgoal has dep eneded up on If those asp ects of the surronding situation c hange either b ecause of c hanges in
264. tor O2 in state S1 No operator has been selected yet for S2 This subgoal was created because Soar didn t know which of the three operators O4 O5 or O6 to select in state S2 Figure 0 A simplied illustration of a subgoal stac k IMP ASSES AND SUBST A TES Soar con tin ually attempts to retriev e kno wledge relev an t to all goals in the subgoal stac k although problem solving activit y will tend to fo cus on the most recen tly cre ated state Ho w ev er problem solving is activ e at all lev els and pro ductions that matc h at an y lev el will re Results In order to resolv e impasses subgoals m ust generate results that allo w the problem solving at higher lev els to pro ceed The r esults of a subgoal are the w orking memory elemen ts and preferences that w ere created in the substate and that are also link ed directly or indirectly to a sup erstate any sup erstate in the stac k A preference or w orking memory elemen t is said to b e created in a state if the pro duction that created it tested that state and this is the most recen t state that the pro duction tested Th us if a pro duction tests m ultiple states the preferences and w orking memory elemen ts in its actions are considered to b e crea
265. uction find default wme depth iv CONTENTS wmes Conguring T race Information and Debugging chunk name format firing counts format watch monitor pwatch stats System Stats Memory Stats Rete Stats 0 warnings watch Basic W atc h Settings
266. uctions is describ ed completely in Section on page 0 Syn tax Syn tactically eac h pro duction consists of the sym b ol sp follo w ed b y an op ening curly brace f the pro duction s name the pro duction s conditions the sym b ol gt the pro duction s actions and a closing curly brace g sp f pr o duction name CONDITIONS gt ACTIONS An optional commen t string can b e included follo wing the name of the pro duction This string is set o with double quotes when curly braces are used to dene the pro duction sp f pr o duction name optional documentation string CONDITIONS CHAPTER THE SO AR USER INTERF A CE gt ACTIONS One or more optional ags ma y b e used to force the pro duction to b e considered a certain t yp e regardless of what w ould otherwise b e true sp f pr o duction name optional documentation string flag CONDITIONS gt ACTIONS The optional ags are as follo ws o supp ort sp ecies that all the RHS actions are to b e giv en O supp ort when the pro duction res i supp ort sp ecies that all the RHS actions are only to b e giv en I supp ort when the pro duction res default sp ecies that this pro duction is a default pro duction
267. uld otherwise o ccur When waitsnc is set to on Soar will automatically generate a w ait state rather than a state no change impasse The decision cycle will rep eat and the decision cycle coun t is incremen ted but no state no change impasse and therefore no substate will b e generated w aitsnc eect on Soar on turns state no c hange impasse in to w ait mo de off state no c hange generates impasse default File System I O Commands This section describ es commands whic h in teract in one w a y or another with op erating system input and output or le I O Users can sa v e retriev e information to from les redirect the information prin ted b y Soar as it runs and sa v e and load the binary represen tation of pro ductions The sp ecic commands describ ed in this section are Summary command to le Ev aluate a command and prin t its results to a le FILE SYSTEM I O COMMANDS dir e ctory functions chdir cd dirs popd pushd pwd topd ec ho Prin t a string to the curren t output strings destinati on log Record all user in terface input and output to a le output strings destination Redirect the Soar output stream rete net Sa v e the curren t Rete net or restore a previous one source
268. um b er but not a letter s run un til the n th time a state is selected o run un til the n th time an op erator is selected out run un til the n th time output is generated on the output link or a maxim um of decision cycles with no output lt s gt run un til curren t lev el of subgoaling has terminated lt ss gt run un til sup erstate s lev el of subgoaling has terminated lt sss gt run un til sup ersup erstate s lev el of subgoaling has terminated lt o gt run Soar un til the n th time an op erator is selected at this level of sub go aling or un til the curren t lev el of subgoaling is terminated lt so gt run Soar un til the n th time a sup erop erator is selected or un til that lev el of subgoaling is terminated lt sso gt run Soar un til the n th time a sup ersup erop erator is selected or un til that lev el of subgoaling is terminated The n um b er n and unit argumen ts to the run command can app ear in either order for example run d and run d are equiv alen t Also note that if y ou call run with a n um b er but not a letter that d is assumed and Soar will run for n decision cycles Similarly if y ou call run with a letter but not a n um b er n is assume
269. unk F or example if a pro duction tests for the absence of a lo cal PR OBLEMS THA T MA Y ARISE WITH CHUNKING ag and that ag is copied do wn to the substate from a sup erstate then the c h unk should include a test that the ag in the sup erstate do es not exist Unfortunately it is computationally exp ensiv e to determine wh y a giv en w orking memory elemen t do es not exist Ch unking only includes negated tests if they test for the absence of sup erstate w orking memory elemen ts Solution T o a v oid using negated conditions for lo cal data the lo cal data can b e made a result b y attac hing it to the sup erstate This increases the n um b er of c h unks learned but a negated condition for the sup erstate can b e used that leads to correct c h unks T esting for the substate Ov ergeneral c h unks can b e created if a result of a subgoal is dep enden t on the creation of an impasse within the substate F or example pro cessing in a subgoal ma y consist of exhaustiv ely applying all the op erators in the problem space If so then a con v enien t w a y to recognize that all op erators ha v e applied and pro cessing is complete is to w ait for a state no c hange impasse t
270. vided as an action in Soar it should b e used only for simple monitoring or debugging F or more extensiv e text output Tcl and Tk should b e used crlf Short for carriage return line feed this function can b e called only within write It forces a new line at its p osition in the write action sp gt write lt x gt crlf lt y gt accept Susp ends Soar s execution and w aits for the user to t yp e a constan t follo w ed b y a carriage return The result of accept is the constan t The accept function do es not read in strings It accepts a single constan t whic h ma y lo ok lik e a string Soar applications that mak e extensiv e use of text input should b e implemen ted using Tcl and Tk functionalit y describ ed in the So ar A dvanc e d Applic ations Manual The accept function do es not w ork prop erly under the TSI Tcl Soar In ter face or an y other Soar program that has a separate Agen t Windo w instead of a Tcl or Wish Console In this instance users should emplo y the tcl RHS function describ ed on page to get user input through a text widget sp gt lt s gt input accept Mathematical functions The expressions describ ed in
271. ype state This sho ws all the individual augmen tations of S eac h is preceded b y an in teger timetag Acceptable preferences in w orking memory The acceptable preferences for the op erator augmen tations of states app ear in w orking memory as iden tier attribute v alue preference quadruples No other preferences ap p ear in w orking memory A template for an acceptable preference in w orking memory is identifier operator value F or example if y ou run Soar with the example blo c ks w orld program describ ed in App endix after the rst op erator has b een selected y ou can again lo ok at the top lev el state using the wmes command soar gt wmes s S io I S ontop O 0 S ontop O S ontop O S operator O S operator O 0 S operator O S operator O S operator O S operator O S operator O S problem space blocks S superstate nil S thing T S thing B S thing B S thing B S type state The state S has six augmen tations of acceptable preferences for dieren t op erators O through O These ha v e plus signs follo wing the v alue to denote that they are acceptable preferenc
272. ystems It has b een in use since and has ev olv ed through man y dieren t v ersions This man ual do cumen ts the most curren t of these Soar v ersion 0 Our goals for Soar include that it is to b e an arc hitecture that can b e used to build systems that w ork on the full range of tasks exp ected of an in telligen t agen t from highly routine to extremely dicult op en ended prob lems represen t and use appropriate forms of kno wledge suc h as pro cedural declara tiv e episo dic and p ossibly iconic emplo y the full range of problem solving metho ds in teract with the outside w orld and learn ab out all asp ects of the tasks and its p erformance on them In other w ords our in ten tion is for Soar to supp ort all the capabilities required of a general in telligen t agen t Belo w are the ma jor principles that are the cornerstones of Soar s design The n um b er of distinct arc hitectural mec hanisms should b e minimized In Soar there is a single represen tation of p ermanen t kno wledge pro ductions a single represen tation of temp orary kno wledge ob jects with attributes and v alues a single mec hanism for generating goals automatic subgoaling and a single learning
273. zen monitor add after decision cycle update The follo wing example remo v es the single attac hmen t m whic h asso ciates a script with the Soar ev en t after init agen t monitor delete after init agent m The next example remo v es all script attac hmen ts to the Soar ev en t b efore preference phase cycle monitor delete before preference phase c ycle Finally this example remo v es all script attac hmen ts that ha v e b een added with the monitor command monitor clear pwatch on off production name s The pwatch command enables and disables the tracing of the rings and retractions of individual pro ductions This is a companion command to watch whic h cannot sp ecify individual pro ductions b y name With no argumen ts pwatch lists the pro ductions curren tly b eing traced With one or more pr o duction name argumen ts pwatch enables tracing of those pro ductions on can b e explicitly stated but it is the default action If off is sp ecied follo w ed b y one or more pr o duction names tracing is turned o for those pro ductions When no pr o duction names are sp ecied pwatch on lists all pro ductions curren tly b eing traced and pwatch off disables tracing of all pro ductions Example

Download Pdf Manuals

image

Related Search

Related Contents

Xerox 016-2040-00 User's Manual    WatchGuard XTM 26-W + 3Y Email Security    PDFファイル - 医薬品医療機器総合機構  Sirius Satellite Radio XS075 User's Manual  Visual Tracer Visual Tracer  Mijoteuse Smart-Pot™ - Crock      

Copyright © All rights reserved.
Failed to retrieve file