
APT.all-test.default.selection-optimal-original.soar Maven / Gradle / Ivy
## -*- Mode: sde -*-
##
############################# -*- Mode: Soar -*- #############################
##
## File : default/selection.soar
## Author : John Laird
## Created on : Mon Feb 27 16:15:34 1989
## Last Modified On: 26 October, 2003
##
## Contents: Default productions for selection problem space for Soar 8.5
##
######################################################################
### Change made for Soar 8.5
###
### Significant Changes made to Convert to Soar 8.2
### 1. evaluate-object -> evaluate-operator
### 2. Removed other types of evaulate-
### 3. Change from problem-space.name selection -> name selection
### 4. Simplified so only handles vanillia evaluate-operator
### 5. Don't copy down problem space, just copy down name and
### assume problem space will be regenerated in subgoal based on name
### 6. Added some documentation
###
###
### State structure:
### (state ^evaluation
### ^not-all-operators-evaulated true
### ^operator-selection not-indifferent
### ^found-value true)
### ( ^numeric-value novalue
### ^symbolic-value novalue/success/failure
### ^value true
### ^operator (identifier of operator being evaluated)
### ^desired
###
###
### ( ^name evaluate-operator
### ^operator
### ^evaluation ;# same as on state
### ^superproblem-space
### ^superstate
### Use selection for all choice multiple, impasses
sp {selection*elaborate*name*selection
:default
(state ^choices multiple)
-->
( ^name selection)}
###
### 7.3.1 The evaluate-operator operator
###
### Create evaluate operator in selection problem space.
sp {selection*propose*evaluate-operator
:default
(state ^name selection
^item )
-{(state ^evaluation )
( ^superoperator
^value true)}
-->
( ^operator +)
( ^name evaluate-operator
^superoperator )}
### Make them indifferent if not ^operator-selection not-indifferent.
sp {selection*select*evaluate-operator*indifferent
:default
(state ^name selection
- ^operator-selection not-indifferent
^operator +)
( ^name evaluate-operator)
-->
( ^operator =)}
### Create evaluation once the eval operator is selected.
sp {selection*apply*state*evaluation
:default
(state ^name selection
^operator )
( ^name evaluate-operator
^superoperator )
-->
( ^evaluation )
( ^superoperator )}
sp {selection*elaborate*evaluate-operator*evaluation
:default
(state ^name selection
^operator
^evaluation )
( ^name evaluate-operator
^superoperator )
( ^superoperator )
-->
( ^evaluation )}
sp {selection*elaborate*evaluate-operator*superproblem-space
:default
(state ^name selection
^operator
^superstate.problem-space )
( ^name evaluate-operator)
-->
( ^superproblem-space )}
sp {selection*elaborate*evaluate-operator*superstate
:default
(state ^name selection
^operator
^superstate )
( ^name evaluate-operator)
-->
( ^superstate )}
###
### 7.3.1.1 Evaluation Objects
###
sp {selection*elaborate*evaluation*value
:default
(state ^evaluation )
( ^ << numeric-value symbolic-value >>)
-->
( ^value true)}
sp {selection*elaborate*evaluation*desired
:default
(state ^superstate.desired
^evaluation )
-->
( ^desired )}
###
### 7.3.1.2 Applying the evaluate-operator operator
###
### Domain specific code may directly implement an evaluation, or an operator no-change may occur
### to do the job, see the next section.
###
### 7.3.2 The evaluation subgoal
###
###
### These productions which fire once an evaluation subgoal has been created
### have also been generalized.
sp {evaluate-operator*elaborate*state*desired
:default
(state ^impasse no-change
^attribute operator
^superstate.operator )
( -^default-desired-copy yes
^name evaluate-operator
^evaluation.desired )
-->
( ^desired )}
sp {evaluate-operator*elaborate*state*name
:default
(state ^impasse no-change
^attribute operator
^superstate.operator )
( ^name evaluate-operator
^superstate.name )
-->
( ^name )}
## install a copy of the state, when ^default-state-copying and there
## is an operator tie.
sp {evaluate-operator*elaborate*state*duplicate-of
:default
(state ^superstate
^default-state-copy yes)
(state ^operator )
( ^name evaluate-operator
^superstate )
-->
( ^duplicate-of* )}
### Copy down operator
sp {evaluate-operator*elaborate*state*look-ahead-operator*copy
:default
(state ^problem-space.name
^default-operator-copy yes
^superstate.operator )
( ^name evaluate-operator
^superoperator
^superproblem-space.name )
-->
( ^look-ahead-operator )
( ^duplicate-of* )}
## Create pointer for uniform access even in no copy
### Added test for superproblem-space. This restricts these productions
### to only fire in a lookahead. Previously, these productions made it
### impossible to use evaluation problem spaces other than lookahead.
sp {evaluate-operator*elaborate*state*look-ahead-operator*no-copy
:default
(state ^problem-space.name
^default-operator-copy no
^superstate.operator )
( ^name evaluate-operator
^superoperator
^superproblem-space.name )
-->
( ^look-ahead-operator )}
### install copy of operator in lookahead context.
sp {evaluate-operator*propose*look-ahead
:default
(state ^look-ahead-operator
-^tried-tied-operator )
-->
( ^operator +)}
sp {evaluate-operator*propose*look-ahead*reject-all-others
:default
(state ^look-ahead-operator
^operator { <> } +)
-( ^tried-tied-operator )
-->
( ^operator -)}
### Detect that the operator has been tried.
sp {evaluate-operator*elaborate*state*tried-tied-operator
:default
(state ^operator
^look-ahead-operator )
-->
( ^tried-tied-operator )}
### Give symbol-value failure when no operators are proposed in subgoals
sp {evaluate-operator*elaborate*evaluation*failure*no-operators
:default
(state ^operator
^evaluation )
( ^name evaluate-operator
^evaluation )
(state ^superstate
^quiescence t)
(state ^superstate
^attribute state
^impasse no-change
^quiescence t)
(state ^superstate
^attribute state
^impasse no-change
^quiescence t)
-->
( ^symbolic-value failure)}
sp {evaluate-operator*elaborate*evaluation*failure*constraint-failure
:default
(state ^operator )
( ^evaluation )
( ^name evaluate-operator
^evaluation )
(state ^superstate )
(state ^superstate
^attribute operator
^impasse constraint-failure)
-->
( ^symbolic-value failure)}
sp {evaluate-operator*elaborate*symbolic-evaluation*from-subgoal
:default
(state ^operator
^evaluation )
( ^name evaluate-operator
^evaluation
^evaluation.desired )
(state ^superstate
^ { << required-success success partial-success
indifferent partial-failure failure prohibit-failure
draw lose win >> } )
-->
( ^symbolic-value )}
sp {evaluate-operator*elaborate*numeric-evaluation*from-subgoal
:default
(state ^operator
^evaluation )
( ^name evaluate-operator
^evaluation
^evaluation.desired )
(state ^superstate
^desired
^numeric-value )
-->
( ^numeric-value )}
## Added to handle duplicated desireds
sp {evaluate-operator*elaborate*evaluation*from-subgoal*duplicate-desired
:default
(state ^superstate
^ { << required-success success partial-success
indifferent partial-failure failure prohibit-failure
draw lose win >> } )
(state ^operator
^evaluation )
( ^name evaluate-operator
^evaluation
^evaluation.desired )
( ^duplicate-of* )
-->
( ^symbolic-value )}
###
### 7.3.2.1. State Copying
###
## Switch to look at current problem space, not super
## If no signals on problem space, the default is to copy both state and operator
sp {evaluate-operator*elaborate*default-for-default-state-copy-is-yes
:default
(state ^superstate.operator.name evaluate-operator
^problem-space )
-(
^default-state-copy no)
-->
( ^default-state-copy yes)}
sp {evaluate-operator*elaborate*default-state-copy-from-problem-space
:default
(state ^superstate.operator.name evaluate-operator
^problem-space.default-state-copy )
-->
( ^default-state-copy )}
### Default is that all-attributes-at-level are copied
sp {evaluate-operator*elaborate*state*default-copy-is-all-attributes-at-level-one
:default
(state ^impasse no-change
^attribute operator
^superstate.operator.name evaluate-operator
^problem-space )
(
-^all-attributes-at-level two
-^one-level-attributes
-^two-level-attributes
-^dont-copy
-^dont-copy-anything)
-->
( ^all-attributes-at-level one)}
sp {evaluate-operator*elaborate*state*default-copy-is-all-attributes-at-level-one*no-problem-space
:default
(state ^impasse no-change
-^problem-space
^attribute operator
^superstate.operator )
( ^name evaluate-operator
-^superproblem-space )
-->
( ^all-attributes-at-level one)}
### We want ^all-attributes-at-level one to be on the goal, but if someone
### puts it on the space along with the other copying flags, we should allow
### that. So, copy it from the space to the goal.
sp {evaluate-operator*elaborate*state*copy-all-attributes-at-level-one-from-problem-space
:default
(state ^problem-space.all-attributes-at-level one
^default-state-copy yes)
-->
( ^all-attributes-at-level one)}
### Set up identifier mapping table for state duplication.
sp {evaluate-operator*elaborate*state*create-duplicates-table
:default
(state ^impasse no-change
^attribute operator
^default-state-copy yes
^superstate.operator.name evaluate-operator)
-->
( ^duplicates* )}
### Copy one-level-attributes.
sp {evaluate-operator*elaborate*state*add-one-level-attributes
:default
(state ^problem-space.one-level-attributes
^duplicate-of*.
^default-state-copy yes)
-->
( ^ )}
## Copy all attributes, when ^all-attributes-at-level one.
sp {evaluate-operator*elaborate*state*add-all-attributes-at-level-one
:default
(state ^problem-space
^default-state-copy yes
^all-attributes-at-level one
^duplicate-of* )
( -^dont-copy-anything
-^dont-copy )
( ^{ <> duplicate-of* <> tried-tied-operator <> problem-space
<> impasse <> attribute <> choices <> quiescence
<> operator <> superstate <> type <> name <> look-ahead-operator
} )
-->
( ^ )}
### If we copied a one-level-attribute, and it later turned
### out that its value happened to be something that was pointed to by a
### two-level-attribute, change its value to be the copied object.
sp {evaluate-operator*elaborate*state*change-one-level-attribute-to-duplicate
:default
(state ^problem-space.one-level-attributes
^duplicates*.
^default-state-copy yes
^duplicate-of*. )
-->
( ^ -
^ )}
### Fixes, when all-attributess-at-level one.
sp {evaluate-operator*elaborate*state*change-all-attributes-at-level-one-to-duplicate
:default
(state -^problem-space.dont-copy
^default-state-copy yes
^all-attributes-at-level one
^duplicates*.
^duplicate-of*.{ <> tried-tied-operator } )
-->
( ^ -
^ )}
### Create new ids for two-level-attributes.
sp {evaluate-operator*elaborate*state*duplicate-id-for-attribute
:default
(state ^problem-space.two-level-attributes
^duplicates*
^default-state-copy yes
^duplicate-of*. )
-->
( ^ )}
### Create new ids for all attributes, when ^all-attributes-at-level two.
sp {evaluate-operator*elaborate*state*duplicate-id-for-all-attributes
:default
(state ^problem-space
^duplicates*
^default-state-copy yes
^duplicate-of* )
( -^dont-copy-anything
-^dont-copy
^all-attributes-at-level two
-^one-level-attributes )
( ^{ <> duplicate-of* <> tried-tied-operator <> problem-space
<> impasse <> attribute <> choices <> quiescence
<> operator <> superstate