an example of hierarchical planning… (1) planning a sequence of actions - n.b. not yet linguistic!
Post on 20-Dec-2015
229 views
TRANSCRIPT
A goal to be achieved by planning
• Task:– Ed wants to be in New York
• Formalization as a plan goal:– be-at (Ed, New York)
• The algorithm: Top-down hierarchical planning– Search our library of plan operators for ways of achieving the
goal– For an operator to be usable, the preconditions much match the
‘state of the world’– For an operator to be useful, the effect must leave us nearer to
achieving our goal than we were before!
?
Our PLAN OPERATORS…
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
Operator: GO-TO (ACTOR, LOCATION) Effect: be-at (actor, location)
Operator: BUY (ACTOR, RECIPIENT, OBJECT) Effect: have (actor, object) + Precond.: have (actor, price (object)) + Body: • go-to (actor, recipient) • give (actor, recipient,price (object)) • give (recipient, actor, object)
Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
be-at (Ed, New York)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
be-at (Ed, New York)
Operator: BUY (ACTOR, RECIPIENT, OBJECT) Effect: have (actor, object) + Precond.: have (actor, price (object)) + Body: • go-to (actor, recipient) • give (actor, recipient,price (object)) • give (recipient, actor, object)
be-at (Ed, New York)
be-at (Ed, New York)
Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object)
Our PLAN OPERATORS…
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
Operator: GO-TO (ACTOR, LOCATION) Effect: be-at (actor, location)
Operator: BUY (ACTOR, RECIPIENT, OBJECT) Effect: have (actor, object) + Precond.: have (actor, price (object)) + Body: • go-to (actor, recipient) • give (actor, recipient,price (object)) • give (recipient, actor, object)
Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
cost?time?
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
This one looks promising, the planning process decides to take a closer look…
We have a useful plan operator: so we ‘instantiate’ the operator
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
Task goal: be-at (Ed, NY)
be-at (Ed, NY)be-at (actor, destination)
Matchingor ‘unification’
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
ACTOR = Ed TRAIN=?train DESTINATION= NY
Testing phase
• Do the preconditions hold?– If not, we have to make them hold by planning
further before we can carry out the action and get the desired effect
• When the preconditions hold, we can achieve the effect by adding the actions in the body into our plan. This is the hierarchical expansion of the plan tree.
Do the preconditions hold?
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
ACTOR = Ed TRAIN=?train DESTINATION= NY
Destination (?train, NY)On-board (Ed, ?train)
The preconditions do not yet match the world unfortunately…
Destination (?train, NY)On-board (Ed, ?train)
PRECONDITIONSWORLD
Be-at (Ed, Washington)
So, can we plan some actions that will take the world to be nearer to how we want it?
We set up some new goals (called ‘posting’) and see if we can plan for
them to be achieved…
Destination (?train, NY)On-board (Ed, ?train)
PRECONDITIONS GOALS
• Lets us assume that there are lots of trains to NY from Washington, so the first goal can be filled in directly (‘be satisfied’) by looking in a database, e.g.:
• destination (9am-train, NY)• destination (10am-train ,NY)• destination (11am-train, NY).
+
We set up some new goals (called ‘posting’) and see if we can plan for
them to be achieved…
Destination (?train, NY)On-board (Ed, ?train)
PRECONDITIONS GOALS
• The second goal takes more work. We have to look in our plan library for operators with an effect that is relevant for:
•On-board (Ed, 10am-train)
?Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
Operator: GO-TO (ACTOR, LOCATION) Effect: be-at (actor, location)
Operator: BUY (ACTOR, RECIPIENT, OBJECT) Effect: have (actor, object) + Precond.: have (actor, price (object)) + Body: • go-to (actor, recipient) • give (actor, recipient,price (object)) • give (recipient, actor, object)
Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
On-board (Ed, 10am-train)
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train)
On-board (Ed, 10am-train)
Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object)
On-board (Ed, 10am-train)
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
This one looks promising, the planning process decides to take a closer look…
On-board (Ed, 10am-train)
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
ACTOR = Ed TRAIN= 10am-train
Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train)
Do the preconditions hold?ACTOR = Ed TRAIN=10-am-train
Be-at (Ed, 10am-train)Have (Ed, ticket (10am-train))
The preconditions do not yet match the world unfortunately…
Be-at (Ed, 10am-train)Have (Ed, ticket (10am-train))
PRECONDITIONSWORLD
Be-at (Ed, Washington)
So, can we plan some actions that will take the world to be nearer to how we want it?
Further planning as above
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
Resulting in a final complete hierarchical plan…
A complete plan…
• is a hierarchically organized sequence of actions
• carrying out the actions in sequence will guarantee that the preconditions for achieving and subsequent effect are met in time
• when all the sub-actions of a more abstract action have been performed, the abstract action has also been achieved and the corresponding effect also
Operator: TAKE-TRIP (ACTOR, TRAIN, DESTINATION) Effect: be-at (actor, destination) Precond.: destination (train, destination) + on-board (actor, train) Body: • get-on (actor, train) Operator: GET-ON (ACTOR, TRAIN) Effect: on-board (actor, train) Precond.: be-at (actor, train) have (actor, ticket (train)) Body: • buy (actor, clerk, ticket (train)) • go-to (actor, train) Operator: GO-TO (ACTOR, LOCATION) Effect: be-at (actor, location) Operator: BUY (ACTOR, RECIPIENT, OBJECT) Effect: have (actor, object) + Precond.: have (actor, price (object)) + Body: • go-to (actor, recipient) • give (actor, recipient,price (object)) • give (recipient, actor, object) Operator: GIVE (ACTOR, RECIPIENT, OBJECT) Effect: have (recipient, object) Precond.: have (actor, object) ....
‘+ ‘ : Unconditionally true actions/states
GET-ON (Ed, train)
Precond. BE-AT (Ed, train) HAVE (Ed, train-ticket)
Ef f ect : ON-BOARD (Ed, train)
TAKE-TRIP (Ed, train, NY)
Pr econd. DESTINATION (train, NY)Ef f ect : BE-AT (Ed, NY)
ON-BOARD (Ed, train)
Ef f ect : HAVE (Ed, train-ticket)Pr econd. HAVE (clerk, train-ticket)
GIVE (clerk, Ed, train-ticket)Ef f ect : HAVE (clerk, ticket-money)Pr econd. HAVE (Ed, ticket-money)
GIVE (Ed, clerk, ticket-money)GO-TO (Ed, clerk)
Ef f ect : BE-AT (Ed, clerk)
GO-TO (Ed, train)Ef f ect : BE-AT (Ed, train)
Pr econd. HAVE (Ed, ticket-money)
BUY (Ed, clerk, train-ticket)Ef f ect : HAVE (Ed, train-ticket)
the three dotted arcs show that the effect of a given operator has to include satisfaction of the precondition of the field to which
they point (and are hence do not specify dependency relationships)
Figure 17.5: Plan library of action types
Figure 17.6: A partial plan built to achieve the goal ‘get to NY’
COMPLETE SUMMARY OF THE PLAN and PLAN LIBRARY (Bateman & Zock, 2003)