SOAR - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

SOAR

Description:

Hello World Rule # From Chapter 2 of Soar 8 Tutorial ... Rule name is hello-world -- separates the if and then parts of a rule statement ... – PowerPoint PPT presentation

Number of Views:700
Avg rating:3.0/5.0
Slides: 34
Provided by: BMA2
Category:
Tags: soar | hello

less

Transcript and Presenter's Notes

Title: SOAR


1
SOAR
  • CIS 488/588
  • Bruce R. Maxim
  • UM-Dearborn

2
Behavior Modeling
  • Production rules can be used to model
    problem-solving behavior
  • Short term memory holds WM assertions
  • Long term memory holds production rules
  • Derived from protocol analysis (e.g. studying
    transcripts of recorded think out loud problem
    solving sessions)

3
Behavior Modeling
  • State of knowledge
  • what the subject knows
  • Problem behavior graph
  • trace of subject moving through states of
    knowledge
  • Problem solving
  • search through network of problem states

4
SOAR
  • Starts with an initial situation and moves toward
    the goal state
  • Establishes a preference net to determine
    rankings of various choices
  • absolute preferences connect states to
    acceptable, rejected, best, and worst nodes
  • relative preferences connect states to better,
    worse, and indifferent nodes

5
SOAR
  • Preference labels and links are translated into
    dominance relations among states
  • Dominance relations used to select next current
    state
  • If goal state not found, process begins again
  • SOAR does no conflict resolution, it fires all
    applicable rules
  • Rules generally focus on replacing the current
    operator being used to discover states

6
SOAR Algorithm
  • To determine the preferred state using the SOAR
    automatic preference analyzer
  • Collect all states that are labeled acceptable
  • Discard all acceptable states that are also
    labeled rejected
  • Determine the dominance relations as follows
  • State A dominates state B if there is a better
    link from A to B but no better link from B to A
  • State A dominates state B if there is a worse
    link from B to A but no worse link from A to B
  • A state labeled best, and not dominated by any
    other state, dominates all other states
  • A state labeled worst, which does not dominate
    any other state, is dominated by all other states

7
SOAR Algorithm
  • Discard all dominated states
  • Select the next state from among those remaining
    as follows
  • If only one other state remains, select it.
  • Otherwise, if no states remain, select the
    current state, unless it is marked rejected
  • Otherwise, if all states are connected by
    indifferent links,
  • If the current state is one of the remaining
    states, keep it.
  • Otherwise, select a state at random
  • Otherwise, announce an impasse

8
Hello World Rule
  • From Chapter 2 of Soar 8 Tutorial
  • This rule writes "Hello World" and halts.
  •  
  • sp hello-world
  • (state ltsgt type state)
  • --gt
  • (write Hello World)
  • (halt)
  •  

9
SOAR Syntax
  • sp soar production
  • Body of rule delimited by
  • Rule name is hello-world
  • --gt separates the if and then parts of a rule
    statement
  • Conditions and actions delimited by ( )
  • Identifiers a..z, 0..9, , -,
  • Variables lt identifier gt

10
Working Memory
  • Contains the dynamic information for SOAR
    entities
  • Sensor data
  • Calculations
  • Current operators
  • Goals
  • Collections of WM elements describing the same
    entity are called objects

11
How does hello-world work?
  • The first condition always starts with a state
  • ltsgt is a variable capable of matching everything
  • So the interpretation of
  • (state ltsgt type state)
  • is if I exist
  • Every entity has a state attribute so the actions
    are carried out

12
SOAR Operator
  • Can do things in either the real world or in the
    mind of the SOAR agent
  • Operators have two basic parts
  • Proposal rule used to determine when an operator
    can be applied
  • Application rule that actually performs the work
    for the operator

13
Operator Proposal Rule
  • From Chapter 3 of Soar 8 Tutorial
  • This operator writes "Hello World" and halts.
  •  
  • sp proposehello-world
  • (state ltsgt type state)
  • --gt
  • (ltsgt operator ltogt )
  • (ltogt name hello-world)

14
Syntax
  • (ltsgt operator ltogt )
  • This action creates a preference for the new
    operator in WM
  • The marks it as an acceptable preference
  • (ltogt name hello-world)
  • This action creates a working memory element that
    holds the name of the operator
  • Variable scope is limited to a single rule

15
Operator Application Rule
  • From Chapter 3 of Soar 8 Tutorial
  • This operator writes "Hello World" and halts.
  •  
  • sp applyhello-world
  • (state ltsgt operator ltogt)
  • (ltogt name hello-world)
  • --gt
  • (write Hello World)
  • (halt)

16
English Versions
  • Propose hello-world
  • If I exist propose hello-world operator
  • Apply hello-world
  • If hello-world operator is selected
  • Then write Hello World and stop

17
SOAR Execution Cycle
  • Propose operators (rules)
  • Select operations (decision procedure)
  • Apply operator (rules)
  • Go to step 1

18
Eater Move-North
  • Move-north operator
  • From Chapter 4 of Soar 8 Tutorial
  • Proposemove-north
  • If I exist, then propose the move-north
  • operator.
  •  
  • sp proposemove-north
  • (state ltsgt type state)
  • --gt
  • (ltsgt operator ltogt )
  • (ltogt name move-north)

19
Eaters Demo
20
Eater Move-North
  • Applymove-north
  • If the move-north operator is selected, then
  • generate an output command to
  • move north.
  • sp applymove-north
  • (state ltsgt operator ltogt
  • io ltiogt)
  • (ltiogt output-link ltolgt)
  • (ltogt name move-north)
  • --gt
  • (ltolgt move ltmovegt)
  • (ltmovegt direction north)

21
Syntax
  • io ltiogt
  • This adds a requirement for a match on the output
    before firing the rule
  • It is getting the output link ltolgt that will
    allow Eater movement (but not continuous
    movement)

22
Fixing Eater Move-North
  • Move-north operator
  • From Chapter 5 of Soar 8 Tutorial
  • Corrected so operator applies more than once.
  • Proposemove-north
  • If I am at some location, then propose the
  • move-north operator. 
  • sp proposemove-north
  • (state ltsgt io.input-link.eater ltegt)
  • (ltegt x ltxgt y ltygt)
  • --gt
  • (ltsgt operator ltogt )
  • (ltogt name move-north)

23
Explanation
  • The key change is eliminating the test for state
    and focus on non-persistent object attributes
  • This sets the stage for a second operator
    instance selected
  • We also need to create a second apply rule that
    removes the previous move command from WM

24
Application Rule 1
  • Applymove-north
  • If the move-north operator is selected, then
  • generate an output command to
  • move north.
  • sp applymove-north
  • (state ltsgt operator.name move-north
  • io.output-link ltolgt)
  • --gt
  • (ltolgt move.direction north)

25
Application Rule 2
  • Applymove-northremove-move
  • If the move-north successfully performs a move
  • command, then remove the command from the
  • output-link
  • sp applymove-northremove-move
  • (state ltsgt operator.name move-north
  • io.output-link ltolgt)
  • (ltolgt move ltmovegt)
  • (ltmovegt status complete)
  • --gt
  • (ltolgt move ltmovegt -)

26
Multiple Rule Processing
  • In SOAR both the operator proposal and
    application phases can be expanded
  • Multiple rules fire and retract in parallel until
    the system researches equilibrium or quiescence
  • Consider the Move-to-Food eater (it can sense
    walls, food, and bonus food)

27
Move-to-Food
  • Propose move-to-food
  • If there is normal food in an adjacent cell then
    propose move in that direction
  • Propose move-to-food-bonus-food
  • If there is bonus food in an adjacent cell then
    propose move in that direction and allow operator
    selection to be random

28
Move-to-Food
  • Apply move-to-food
  • If move-to-food op selected then generate an
    output command
  • Apply move-to-food-remove-move
  • If move-to-food op is selected and there is a
    completed move or ltolgt then remove move command

29
Move to Food
  • From Chapter 6 of Soar 8 Tutorial
  • Proposemove-to-foodnormalfood
  • If there is normalfood in an adjacent cell,
  • propose move-to-food in the direction of that
  • cell and indicate that this operator can be
  • selected randomly the preference.
  • sp proposemove-to-food
  • (state ltsgt io.input-link.my-location.ltdirgt.con
    tent
  • ltlt normalfood bonusfood gtgt)
  • --gt
  • (ltsgt operator ltogt )
  • (ltogt name move-to-food
  • direction ltdirgt)

30
Move to Food
  • Applymove-to-food
  • If the move-to-food operator for a direction is
  • selected, generate an output command to move in
    that
  • direction.
  • sp applymove-to-food
  • (state ltsgt io.output-link ltolgt
  • operator ltogt)
  • (ltogt name move-to-food
  • direction ltdirgt)
  • --gt
  • (ltolgt move.direction ltdirgt)

31
Move to Food
  • Applymove-to-foodremove-move
  • If the move-to-food operator is selected,
  • and there is a completed move command on the
    output
  • link,then remove that command.
  • sp applymove-to-foodremove-move
  • (state ltsgt io.output-link ltolgt
  • operator.name move-to-food)
  • (ltolgt move ltmovegt)
  • (ltmovegt status complete)
  • --gt
  • (ltolgt move ltmovegt -)

32
Generalized Move Operator
  • Check for adjacent square
  • Do not propose moving into a wall
  • Look for normal or bonus food
  • Avoid other eaters
  • Note the use of list notation to simplify rule
    syntax
  • ltlt .. list .. gtgt

33
Advanced Move Operator
  • Avoids thrashing (moving back and forth between
    the same two cells)
  • Has a preference for moving to bonus food when
    available
  • The jump operator code can be merged with the
    advanced move operator to allow an eater to jump
    over a cell that does not contain a wall
Write a Comment
User Comments (0)
About PowerShow.com