Planning Planning is a special case of reasoning We want to achieve some state of the world Typical...

23
Planning Planning is a special case of reasoning We want to achieve some state of the world Typical example is robotics Many thanks to Robin Burke, University of Chicago, for many of thes http://people.cs.uchicago.edu/~burke/cs250/lectures/lecture1107.htm
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of Planning Planning is a special case of reasoning We want to achieve some state of the world Typical...

Planning Planning is a special case of

reasoning We want to achieve some state of

the world Typical example is robotics

Many thanks to Robin Burke, University of Chicago, for many of these ideas:http://people.cs.uchicago.edu/~burke/cs250/lectures/lecture1107.html

Search vs. Planning

Example: Taking a Bath Goal: Take A Bath Initial State:

Final State:

))(),((),(

)(),(

TubDrainOfTubPlugOfInRobotTubIn

TubEmptyClothedRobotteClothedSta

))(),((),(

)(),(

TubDrainOfTubPlugOfInRobotTubIn

TubFullUnclothedRobotteClothedSta

Operators Actions you take that

affect state Examples:

RemoveClothes PutOnClothes TurnOnWater TurnOffWater GetInTub GetOutOfTub

Can use search to find the right combination of actions

InsertPlug RemovePlug Scrub Lather PourShampoo PlayWithDuckie

Problems with Search Need a good heuristic – may not have one No direct sense of which operators are

relevant to the problem Other constraints

Don’t want solutions where we take off clothes and put them on again several times

Search might find one There is a directionality to what we want to do Once the plug is in, we don't even want to

consider removePlug Blind search doesn't let us make these

distinctions

How does planning improve on search?

Explicitly represent the goal and the way it is achieved using logic

Make "important" decisions first and fill in the details later

Take advantage of independence Puzzles are puzzles because subgoals are

interlocking (cannot do each tile of 8-puzzle separately)

The real world is more forgiving in many cases: taking off my clothes will not affect the state of the plug in the tub

Allows divide and conquer strategies

STRIPS Planning STRIPS = STanford Research Institute

Problem Solver one of the first planning systems one of the first formalisms considerably extended now, but still in

use an entire subfield of planning is planning

using the STRIPS representation good place to start

STRIPS Representation States: Conjunctions of predicates

applied to constants

Goals: Conjunctions of predicates applied to constants or simple variables

))(),((),(

)(),(

TubDrainOfTubPlugOfInRobotTubIn

TubEmptyClothedRobotteClothedSta

))(),((),(

)(),(

TubDrainOfTubPlugOfInRobotTubIn

TubFullUnclothedRobotteClothedSta

STRIPS Representation Actions: Get agent from one state to

another Action description: What to do, e.g.

forward, vacuum, etc. Precondition: what must be true to do

action PlugIn(Tub) would be a precondition for a

Fill(Tub) action Effect: what changes occur due to

action Full(Tub) would be effect of Fill(Tub)

Action Example

Precondition automatically refers to situation before, effects to situation after

Negation = retraction Actions can have variables

))()(:

),()(:

),(:(

TubEmptyTubFullEffect

TubPlugInTubEmptyPrecond

TubFillActionOp

))()(:

),()(:

),(:(

xEmptyxFullEffect

xPlugInxEmptyPrecond

xFillActionOp

Integrating Search Still going to need to do some

seaching Could go forward from initial state

Progressive High branching factor problem

Backward from goal Regressive Typically goals are conjunctive, works

much like backward chaining

The STRIPS Planner Start with a goal

TakingBath(Robot) Need to know what conditions achieve

this goal for backward chaining

Each conjunct is called a sub-goal Need to achieve all subgoals Want to know steps on how you got there

)(

)(),()()(

xTakingBath

TubPluggedTubxInTubFullxUnclothed

Algorithm Start with goal See if achieved already If not, see if there’s some operator that

can achieve it Unclothed(x) In KB, I have Clothed(Robot) Unclothed(Robot) is achieved with the plan

Undress(Robot) If no such operator, try and decompose

by backward chaining If unable to do so, fail and backtrack

Full Example Start with goal

Unclothed(Robot) & Full(Tub) & In(Robot,Tub) & Plugged(Tub)

Operator Undress(x): Precond: Clothed(x) Effect: Unclothed(x) & ~Clothed(x)

So plan is, for starters, Undress(Robot)

Remaining goals: Full(Tub) & In(Robot, Tub) & Plugged(Tub)

Next subgoal: Full(Tub)

Example continued We have an operator Fill(x)

Precond: Plugged(x) Effect: Full(x) & ~Empty(x)

So backward chain over precondition Try operator Plug(x)

Precond: Unplugged(x) Effect: Plugged(x) & ~Unplugged(x)

So add it to plan: Undress(Robot), Plug(Tub)

Example continued Now that precondition of Fill satisfied,

add to plan Plan: Undress(Robot), Plug(Tub), Fill(Tub) Remaining goals: In(Robot,Tub) &

Plugged(Tub) Use operator GetIn(x,y) to get in tub Plan: Undress(Robot), Plug(Tub),

Fill(Tub), GetIn(Robot,Tub) Remaining goals: Plugged(Tub) – it’s true

What’s the catch? Test the solution at the end: You

may clobber a condition along the way E.g. You have to leave bathroom to fill

tub (get dressed) Done by keeping track of threats

Unclothed(Robot) is a precondition for final goal

Do not allow an operator which inserts Clothed(Robot) between Undress(Robot) and goal

Actual algorithm Select subgoal state Sneed to

resolve Choose operator c to resolve it

Record link from previous state to final state