M. Silaghi
Robotics&AI
Planning● Planning is nothing but a special case of search:
– What are the search elements:
M. Silaghi
Robotics&AI
Planning● Planning is nothing but a special case of search:
– What are the search elements:● States, ● Initial state, ● Goal, ● Operators● Good Heuristics?
M. Silaghi
Robotics&AI
Planning● Planning is nothing but a special case of search:
– Situation-space planning is a particular modeling as search. States are FOL sentences. Operators are described by: preconditions,action,effects(added,deleted)
● Planning is a difficult problem and old general purpose algorithms were not good at it.
Action:Go(x,y)
Preconditions: At(x)
Effects:At(y) Deletes:At(x)
What is an intelligent solution?
M. Silaghi
Robotics&AI
Search vs. planning
● Consider the task get milk, bananas, and a cordless drill
● Standard search algorithms seem to fail miserably:
After-the-fact heuristic/goal test inadequate
Start
Go To Pet Store
Go To School
Go To WalMart
Go To Sleep
Read a Book
Sit in a Chair
Etc. Etc....
Talk to a Parot
Buy a Dog
Go To Class
Buy Tuna Fish
Buy Arugula
Buy Milk
Sit Some More
Read a Book
M. Silaghi
Robotics&AI
Efficient planning● Abstractions
– Aggregation, reasoning with many ● Alternatives at ones (least commitment)● Objects at once
– Approximation● Consider first only important conditions● Use of macro operators first
– Split of operators in sub-operators (an aggregation):● Choice of action● Choice of application time● Choice of details (instantiation of variables)
M. Silaghi
Robotics&AI
Order in Plans
Go Supermarket Buy Milk Buy Bananas Go HW Store Buy Drill Go Home
Buy Bananas
Go Supermarket Go Home
M. Silaghi
Robotics&AI
Order in Plans
Go Supermarket Buy Milk Buy Bananas Go HW Store Buy Drill Go Home
Buy Bananas
Go Supermarket
Buy Drill
Go HW Store
Go Home
M. Silaghi
Robotics&AI
Order in Plans
Go Supermarket Buy Milk Buy Bananas Go HW Store Buy Drill Go Home
Buy Bananas
Go Supermarket
Buy Drill
Go HW StoreBuy Milk
Go Home
M. Silaghi
Robotics&AI
Implementation of a POP
● Classes:– Plan(operators, requirements, steps, conflicts,
constraints, links, first-step, final-step, next-plans)– Step(operator, step_id)– Requirement(condition, step)– Link(producer, consumer, conditions)– Conflict(link,clobberer)– Constraint(begin,end)– Operator(additions,preconditions,deletions)
M. Silaghi
Robotics&AI
Example: Blocks world
● “Sussman anomaly” problem
B A
C B
A
C
Start State Goal State
PutOn(x,y) PutOnTable(x)
Clear(x) On(x,z) Clear(y) Clear(x) On(x,z)
~On(x,z) ~Clear(y)Clear(z) On(x,y)
~On(x,z) Clear(z) On(x,Table)
+ several inequality constraints
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
B AC
BA
C
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
B AC
BA
C
On(B,C) , ¬Cl(C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
B AC
BA
C
On(B,C) , ¬Cl(C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
B AC
BA
C
On(B,C) , ¬Cl(C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
B AC
BA
C
On(B,C) , ¬Cl(C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
B AC
BA
C
On(B,C) , ¬Cl(C)
On(A,B), ¬Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
B AC
BA
C
On(B,C) , ¬Cl(C)
On(A,B), ¬Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
B AC
BA
C
On(B,C) , ¬Cl(C)
On(A,B), ¬Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
B AC
BA
C
On(B,C) , ¬Cl(C)
On(A,B), ¬Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
B AC
BA
C
On(A,B), ¬Cl(B)
On(B,C) , ¬Cl(C)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
PutOnTable(C)
On(C,z=A) Cl(C)
B AC
BA
C
On(A,B), ¬Cl(B)
On(B,C) , ¬Cl(C)
On(C,Table) , Cl(A)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
PutOnTable(C)
On(C,z=A) Cl(C)
B AC
BA
C
On(A,B), ¬Cl(B)
On(B,C) , ¬Cl(C)
On(C,Table) , Cl(A)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
PutOnTable(C)
On(C,z=A) Cl(C)
B AC
BA
C
On(A,B), ¬Cl(B)
On(B,C) , ¬Cl(C)
On(C,Table) , Cl(A)
M. Silaghi
Robotics&AI
START
FINAL
On(C,A) On(A,Table) Cl(B) On(B,Table) Cl(C)
On(A,B) On(B,C)
PutOn(B,C)
Cl(B) On(B,z) Cl(C)
PutOn(A,B)
Cl(A) On(A,z) Cl(B)
PutOn(A,B)clobbers Cl(B)=> order after PutOn(B,C)
PutOnTable(C)
On(C,z=A) Cl(C)
PutOn(B,C)clobbers Cl(C)=> order afterPutOnTable(C)
B AC
BA
C
On(A,B), ¬Cl(B)
On(B,C) , ¬Cl(C)
On(C,Table) , Cl(A)
M. Silaghi
Robotics&AI
Planning Graphs● Work only for propositional problems● A planning graph is a sequence of levels.
– A set of literals– A set of actions
● Non-action shown with persistence actions.● Mutual exclusion (mutex) links show incompatibility.
Planning graph for “have cake and at cake too” problem up to level S2.Rectangles indicate action (small squares indicate persistance actions) andstraight lines indicate preconditions and effects. some Mutex lines are shown as curved gray lines
M. Silaghi
Robotics&AI
Planning Graphs
● Graphs can be extended until they level-off– (i.e. they change no more)
● Actions mutex:– Inconsistent effects (negating effects)– Interference (negating preconditions)– Competing needs (mutex preconditions)
● Literal mutex:– Negations of each other– Inconsistent support (actions to them are mutex)
M. Silaghi
Robotics&AI
Using Planning Graphs
● Admissible Heuristics idea:– No literal may come in less steps than its first level
● Heuristics for sets of goals:– max-level (admissible: max level of first appearance)– level sum (sum of levels of first appearances)– set-level (set appears without mutex)
● GraphPlan– Search a solution in the planning graph (backward)– A boolean Constraint Satisfaction Problems (CSP/SAT)
with backtracking (1 variable/action)
M. Silaghi
Robotics&AI
Example
Planning graph for the spare tire problem after expansion to S2.Solution indicated by bold lines and outlines
M. Silaghi
Robotics&AI
STRIPS limitation
● Time– STRIPS tells order but not exact time constraints– Job shop scheduling applications:
● Actions with duration and resources● The effect DURATION(m) tells m minutes are needed
– Algorithm: Critical path method (CPM)● Action on CPM must follow each others immediately● Other actions have a leeway window (slack) = LS-ESES = earliest possible time LS = latest possible time (LS.ES form a schedule)
● Resources
M. Silaghi
Robotics&AI
CPM
● ES(Start) = 0● ES(B) = max A<B ES(A) + Duration(A)● LS(Finish) = ES(Finish)● LS(A) = min A<B LS(B) – Duration(A)
● Complexity O(Nb)
max over all A that must comebefore B
M. Silaghi
Robotics&AI
Resources
● Shared by actions– Mutual exclusion constraints
● Can be reusable, or not…● STRIPS operator needs RESOURCE R(k), saying
that k units of resource R are needed– Resources of the same type are aggregated
● Efficiency: 10 machines, 10 jobs, 100 actions– Required 23 years for solving!
M. Silaghi
Robotics&AI
Minimum slack
● Plan first, schedule later (after using first CPM)● Greedy action scheduling
– at each step, select● An unscheduled action● With scheduled preconditions● With minimal slack
– then update ES and LS for actions affected by resources and repeat …
M. Silaghi
Robotics&AI
Hierarchical Decomposition
● Can reduce problem complexity.● Hierarchical task networks (HTN)
– HTN plan is abstract– Plan refined by action decomposition.– Lowest level made of primitive actions.
● HTN planning uses only successive action decomposition● Decomposition methods stored in plan library.
– Decompose (a,d), where a-action, d-complete partial-order plan– Based on external preconditions = intersection of possible preconditions– Internal effects = additional effects appearing in decomposition– May use subtask sharing.
M. Silaghi
Robotics&AI
Heuristic
● d decompositions of n steps into k actions– d(n-1)/(k-1) decomposition trees– d should be small– k should be big.
M. Silaghi
Robotics&AI
Non-determinism● Bounded indeterminacy
– Finite number of alternatives● Unbounded indeterminacy
– Unknown/unlisted possible effects● (“qualification problem” of McCarthy: however many pre-conditions you list, somebody
may think of more) need re-planning
Sensorless planning:
conformant planning, coercion (of the world into a state)
Conditional planning (contingency planning): add sensing actions
Execution monitoring and replanning:
execution monitoring (tells if revision is needed)
Continuous planning: persist over a lifetime, with goal formation.
M. Silaghi
Robotics&AI
Contingency Planning
● AND-OR search:– Game against nature (demonic nondeterminism)
● Plans effects consist of disjunctions of – when situation:K(statements).
● Sensing can be:– Automatic: when inputs arrive continuously
● Inputs can appear in the condition of actions giving access to them
– Active: when inputs are received only on request
Top Related