gp¶
Generate productions according to a specified pattern.
Synopsis¶
Description¶
The gp command defines a pattern used to generate and source a set of Soar
productions. production_body
is a single argument that looks almost identical
to a standard Soar rule that would be used with the sp command.
Indeed, any syntax that is allowed in sp is also allowed in gp.
Patterns in gp are specified with sets of whitespace-seprated values in square brackets. Every combination of values across all square-bracketed value lists will be generated. Values with whitespaces can be used if wrapped in pipes. Characters can also be escaped with a backslash (so string literals with embedded pipes and spaces outside of string literals are both possible).
gp is primarily intended as an alternative to :template
rules for
reinforcement learning. :template
rules generate new rules as patterns occur
at run time. Unfortunately, this incurs a high run time cost. If all possible
values are known in advance, then the rules can be generated using gp at source
time, thus allowing code to run faster. gp is not appropriate when all possible
values are not known or if the total number of possible rules is very large (and
the system is likely to encounter only a small subset at run time). It is also
possible to combine gp and :template
(e.g., if some of the values are known
and not others). This should reduce the run time cost of :template
.
There is nothing that actually restricts gp to being used for RL, although for
non-RL rules, a disjunction list (using <<
and >>
) is better where it can be
used. More esoteric uses may include multiple bracketed value lists inside a
disjunction list, or even variables in bracketed value lists.
Each rule generated by gp has *integer
appended to its name (where integer
is some incrementing number).
Examples¶
Template version of rule:
gp
version of rule (generates 144 rules):
Esoteric example (generates 24 rules):
testgp.soar contains many more examples.