AI Automated Planning In A Nutshell
Vitaly MirkisMarch 4, 2013
Netanya Academic College
Acknowledgments:Some slides are based slides of Prof. Carmel Domshlak and of Dr. Michael Katz
Technion – Israel Institute of Technology Industrial Engineering & Management
Planning
“Adventure is just bad planning” Roald Amundsen
“Planning is the art and practice of thinking before acting: of reviewing the courses of action one has available and predicting their expected (and unexpected) results to be able to choose the most beneficial course of action, with respect to ones goals.”
Patrik Haslum
Planning in today’s industry
• Planning in today’s Industry: NASA’s mars rover, Hubble Space Telescope etc.
UAV Cooperative Mission x1 x2 x3 x4 x5 x6 x7 x8 x9
y1
y2
y3
y4
y5
y6
• An UAV is able to move to some of its neighbor cells.
• An UAV is able to photograph a object in current cell.
• The goal is to photograph all colored objects and return to its initial position.
UAV Cooperative Mission
x1 x2 x3 x4 x5 x6 x7 x8 x9
y1
y2
y3
y4
y5
y6
Planning software principle
• A Planning software (planner) execution flow description:– A given task is translated (compiled) to a planning problem . – Planning problem supplied to a solver (planner).
– The solution λ is also a solution for the task (or can be easily translated to such).
Translator
Planner
task λ
Planning software principle
• A Planning software (planner) execution flow description:– A given task is translated (compiled) to a planning problem . – Planning problem supplied to a solver (planner).
– A solution λ is also a solution for the task (or can be easily translated to such).
– Hence, it is sufficient to consider any convenient task, for planning principles introduction.
Translator
Planner
task λ
x1 x2 x3 x4 x5 x6 x7 x8
y1
y2
y3
y4
y5
y6
’Solution
λ’
Planning in blocks world Initial state Goal state
Game rules:- No two blocks can be on top of the same block- Block can’t be on top of two blocks- Exact location on table or on block doesn’t
matter
GRB
Y G BYR?
BY G
Y GB
Planning in blocks world Initial state
on-table(Y), clear(Y),on-table(G), on(R, G), on(B, R), clear(B)
Goal state
on-table(G), clear(G), on-table(Y), clear(Y), clear(R), on(R, B), on-table(B)
GRB
Y G BYR
on(i,j), on-table(i), clear(i)
Planning in blocks world Initial state Goal state
Actions defined with:• Move-Block(i)-from-Block(j)-to-Table• Move-Block(i)-from-Table-to-Block(j)• Move-Block(i)-from-Block(j)-to-Block(k)
GRB
Y G BYR?
Planning in blocks world
• Appling an action examples:= Move-Block(B)-from-Block(R)-to-Table:– = { clear(B) , on(B,R) }– = { on(B,R) }– = { on-table(B) , clear(R) }
GR
Y
B
Initial state Goal state
Planning in blocks world
GRB
Y BG
Y
R
G YRB
GR
= Move-Block(B)-from-Block(R)-to-Table= Move-Block(R)-from-Block(G)-to-Block(Y)= Move-Block(G)-from-Table-to-Block(B)= Move-Block(R)-from-Block(Y)-to-Block(G)
• Optimal plan as shortest graph path:
Planning in blocks world: states space
• How to solve (= find a plan) the described problem?
GRB
Y
GR
YB
GRBY
GR
YB
G RYB
GR
BY
G YBR
G YBR
YBRG
GR
B
Y
• Partial transition graph for 4 blocks:• Plan as graph path:
• How to find an optimal solution?– Use Dijkstra’s to find optimal solution.– The problem has 73 states
• For the general case?• The traversing time for all problem’s states is growing
very fast with problem size (planning is hard, both satisficing and optimal)– State space of 100 blocks problem have more states than
number of atoms in the universe (> 1087) visiting all states is infeasible approach.
• Yet, these problems are solved somehow. How?
How hard Planning is?
GRB
Y
GR
YB
GRBY
GR
YB
G RYB
GR
BY
G YBR
G YBR
YBRG
GR
B
Y
- search algorithm
• Good news : may visit only a subset of the problem states during its run.
• Bad news : In the worst case, running time is still slow1.
• Also known as Heuristic search.
1 Exponential in the problem size.
The intuition behind heuristic search
• h : An oracle estimation of the coast of reaching the goal from a given state.
• Partial transition graph for 4 blocks:
h = 2
??
? h = 3
h = 1
GRB
Y
GR
YB
GRBY
GR
YB
G RYB
GR
BY
G YBR
G YBR
YBRG
GR
B
Y
h = 2
Heuristic search basic model
• Heuristic search composed of two major, (usually) independent, parts:I. State search algorithm
II. Heuristic evaluation function (h)
– Search dynamics: The search algorithm uses a heuristic function to evaluate state to decide which state visit next.
• Each part developed independently.
Heuristic function (h)
• Intuitively, a heuristic function is “an estimation” or “a rule of thumb” of the real solution.
• All heuristic functions for our today’s purpose are estimations of a solution (plan) cost.
Definition:
- A heuristic function maps a search state (node) into a non-negative real number.
- A heuristic function called admissible if it never overestimate real state’s cost.
The intuition behind heuristic search
• h : The coast of reaching the goal from the current state is no less than h (h real cost).
GRB
Y
GR
YB
GRBY
GR
YB
G RYB
GR
BY
G YBR
G YBR
YBRG
GR
B
Y
• Partial transition graph for 4 blocks:
h = 2
??
? h = 3
h = 1
- search algorithm guided by an admissible heuristic
• Good news : may visit only a subset of the problem states during its run.
• Bad news : In the worst case, running time is still slow1.
Theorem: (Hart, Nilsson & Raphael, 1968):
guided with an admissible heuristic, guarantied to find an optimal path (plan).
1 Exponential in the problem size.
Constructing a heuristic function
• The most common method to find a “good” heuristic is via a solution to an “easier” version of the problem.
• Such easier problem can be obtained from the given problem, via two common techniques:
1. Relaxation: ignoring some constrains of the given problem. The outcome often called relaxed problem.
2. Abstraction: use a smaller version of the given problem, small enough to traverse all its states.
• Practically, an “easy to compute” heuristics are preferable.
Relaxed Planning in blocks world
• Each action will modified as follows: = Move-Block(B)-from-Block(R)-to-Table:– = { clear(B) , on(B,R) }– = { on(B,R) }– = { on-table(B) , clear(R) }
GR
Y
BB
Delete free (relaxation)
• One such relaxation technique named delete free. – Once fact achieved, it can’t be deleted:
Initial state Goal
GR
YRBRRB
G BYRR
B
Satisficing / parallel plan can be found in polynomial time (finding an optimal plan is still hard)
Ignore all but the goals (abstraction)• One method can be to achieve an abstraction by
choosing only the goal blocks:
– Initial state:
– Goal state:
But, how can it be utilized?
GRB
Y
G BYR
RB
BR
State of the art heuristicsDelete relaxation:• (Hoffman & Nebel, 2001)• and (Bonet & Geffner, 2001)• (Hoffman & Nebel, 2001)• (M. & Domshlak, 2007)
Abstractions:• PDBs (Edelkamp, 2001; Haslum et al., 2005, 2007)• Merge & Shrink (Helmert et al., 2007)• Implicit Abstractions (Katz & Domshlak, 2008, 2010)
Landmarks:• Landmark count (Hoffman et al., 2004)• and (Karpas & Domshlak, 2009)• LM-cut (Helmert & Domshlak, 2009)
Beyond classical planning
Planning variations:
• Oversubscription planning – Given a plan cost limitation, achieve the most valuable
goals.
• Probabilistic planning– Some of the action’s effects are stochastic.
• Planning with partial observability– The initial state is non-deterministic.
Summary
• Planning is a model-based approach to a machine autonomous behavior,
• Task independent problem solver,
• Wide researchers interest,
• Continue grow in usage in industrial applications.
The end
Thank you
Appendix
Planning Model
Definition: • Finite and discrete state space • Initial state • A set of goal states • A set of actions , and denotes a set of actions applicable in
state • A deterministic transition function for • Non negative action costs
A solution is a sequence of applicable actions that creates a path from to a state in . A solution is optimal if it minimizes actions costs.
STRIPS: A Formal Planning Language
Definition: A STRIPS Planning task is a 5-tuple :• : finite set of atoms (boolean variables)• : finite set of operators (actions), each action is a 3-tuple :
while Add/Delete/Preconditions are subsets of atoms.• : operator cost function ( )• : Initial state (subset of atoms)• : goal description (subset of atoms)
From Language to Model
A STRIPS Planning task defines a state model where:• the states in are collection of atoms from • the initial state is • the goal states are such that • the actions are the operators in such that – the next state is – action cost
(Optimal) Solution of P is (optimal) solution of