Download SOAR Tutorial Part 1
Transcript
62
10.3 Simplified Operators
In writing the operator application rules for the jump operator, you have probably noticed that both
operators include a rule to create the action command (move or jump) on the output-link, and then
remove that command when it has completed. You can simplify the writing of future operators by writing
two general rules that perform these functions for every operator that performs external actions.
The first rule creates the action command on the output-link. To make this a completely general rule, you
need to have a standard way of representing action commands on operators so that a single rule can
create the commands on the output-link. The simplest convention is to have the action command be an
augmentation of the operator, such as: ^jump.direction <direction>. Another possibility would be to have a
specific augmentation on the operator, say ^actions, that had the commands as subobjects:
(<o> ^actions.jump.direction <direction1>)
You probably want to adopt this second approach because it makes it possible to write a single rule that
copies the action commands to the output-link without risk of copying other augmentations. Under that
convention, the general command creation rule is:
sp {apply*operator*create-action-command
(state <s> ^operator.actions.<att> <value>
^io.output-link <ol>)
-->
(<ol> ^<att> <value>)}
The <att> variable will match jump and the value will match the identifier of the object that has
direction as an augmentation. It copies ^jump and that identifier on to the output-link.
The second general rule removes a completed action command.
sp {apply*operator*remove-command
(state <s> ^operator.actions
^io.output-link <ol>)
(<ol> ^<att> <value>)
(<value> ^status complete)
-->
(<ol> ^<att> <value> -)}
Included so action has
o-support.
With these rules included in an Eater, both the move and the jump operator require only proposals
(except when other actions are performed, such as remembering prior moves). To use both of these
rules, you need to modify the proposal rules so that they create the actions structure. Below is an
example of the jump operator proposal.
sp {propose*jump
(state <s> ^io.input-link.my-location.<dir>.<dir>.content
{ <content> <> wall })
-->
Replaced ^direction
(<s> ^operator <o> + =)
<dir> with this.
(<o> ^name jump
^actions.jump.direction <dir>
^content <content>)}
Rules like this simplify the writing of Soar programs by creating conventions; however these conventions
also restrict what can be written in a Soar program. For example, if this rule is used in a Soar program,
then the status complete augmentation will always be removed and will not be available for other rules to
test. For this domain, it doesn’t seem like that will be a problem, and it might not be for others as well. It is
just that before creating a rule that applies to all operators, you should be careful. Throughout this tutorial
you will see additional rules that are used to simplify the writing of programs. We have tried to be careful
in selecting these types of rules.
03/16/01
Soar Tutorial