Professional Documents
Culture Documents
Planning
Gihan P. Seneviratne
T20
1
Motivation
• What is Planning?
– “Planning is the process of thinking
about the activities required to
create a desired goal on some scale”
[Wikipedia]
2
Motivation
3
Motivation
• By “flexible” we mean:
– the problem is described to the planning
system in some generic language;
– a (good) solution is found fully
automatically;
– if the problem changes, all that needs
to be done is to change the description.
• We look at methods to solve any problem
that can be described in the language
chosen for the particular planning system.
4
An ‘easy’ planning example
Deep Space 1
• NASA's on-board autonomous
planning program controlled the
scheduling of operations for a
spacecraft
8
Space Exploration (cont’d)
9
Space Exploration (cont’d)
10
Space Exploration (cont’d)
12
Planning as State Space Search
13
Planning as State Space Search
14
Planning – basic terminology
15
Planning – basic terminology
16
STRIPS
17
STRIPS contd…
19
Mathematically, a STRIPS instance is a quadruple ⟨P,O,I,G⟩, in which each
component has the following meaning:
20
Mathematically, a STRIPS instance is a quadruple ⟨P,O,I,G⟩, in which each
component has the following meaning:
21
• A plan for such a planning instance is a sequence
of operators that can be executed from the initial
state and that leads to a goal state.
22
• Formally, a state is a set of conditions: a state is
represented by the set of conditions that are
true in it. Transitions between states are modeled
by a transition function, which is a function
mapping states into new states that result from
the execution of actions.
23
• Since states are represented by sets of
conditions, the transition function relative to the
STRIPS instance ⟨P,O,I,G⟩ is a function
• succ: 2P×O→2P,
where 2P is the set of all subsets of P, and is
therefore the set of all possible states.
24
A sample STRIPS problem
25
In other words…
26
Actions:
// move from X to Y
_Move(X, Y)_
Preconditions: At(X), Level(low)
Postconditions: not At(X), At(Y)
27
Actions:
// climb down from the box
_ClimbDown(Location)_
Preconditions: At(Location), BoxAt(Location), Level(high)
Postconditions: Level(low), not Level(high)
28
Actions:
29
STRIPS
Definition – Action
Let P be a set of facts.
An action a is a triple
a = (pre(a), add(a), del(a))
of subsets of P, where add(a) \ del(a) = Ø
pre(a), add(a), and del(a) are called the action precondition, add list,
and delete list, respectively
31
STRIPS
Definition – Action
32
STRIPS
pickup(x)
Preconditions: on(x, Table) ^ handEmpty ^
clear(x)
Add List: holding(x)
Delete List: on(x, Table) ^ handEmpty ^ clear(x)
33
STRIPS
Definition – Task
A task is a quadruple (P,A,I,G) where P is a (finite) set of facts, A is a
(finite) set of actions, I and G are subsets of P, I being the initial state
and G the goal state.
34
STRIPS
Definition – Result
Let P be a set of facts, s P be a state, and a be an action. The result
result( s, a ) of applying a to s is:
result(s, a) = (s add(a)) \ del(a) iff pre(a) s;
undefined otherwise
i.e. :
If preconditions of a is a sub-set of TRUE propositions of state s, then add
propositions in add(a) to the propositions in state s and remove the
propositions in del(a) from it. That is the new state given by the result. If
the pre(a) are not satisfied by the state s we can not apply action a to state
s.
35
STRIPS
Definition – Result
Let P be a set of facts, s P be a state, and a be an action. The result
result( s, a ) of applying a to s is:
result(s, a) = (s add(a)) \ del(a) iff pre(a) s;
undefined otherwise
36
STRIPS
• e.g.
state s = on(A, B) ^ handEmpty ^ clear(A)
action a = unstack(x,y)
Preconditions: on(x, y) ^ handEmpty ^ clear(x)
Add List: holding(x) ^ clear(y)
Delete List: on(x, y) ^ handEmpty ^ clear(x)
37
STRIPS
38
STRIPS
For convenience let’s denote result(s, a) i.e. new state with s1
39
STRIPS
41
STRIPS
Definition – Plan
Let (P,A,I,G) be a task. An action sequence a1, ... ,an is a plan for the
task iff G result(I, a1, ... ,an).
42
STRIPS
43
STRIPS
– Actions: A B
• Blocks can be stacked
Initial State
• Can pick up a block and move it to
another location
• Can only pick up one block at a time
A
– Goal:
• To build a specified stack of blocks C
Goal State
44
STRIPS
45
STRIPS
46
PDDL
47
PDDL
48
PDDL
49
Algorithms
51
Algorithms
Note:
• Solution paths s0 , ... , sn Sol correspond to solutions to our
problem
52
Progression
Definition – Progression
Let (P,A,I,G) be a task. Progression is the quadruple (S, s0, succ, Sol):
• S = 2P is the set of all subsets of P,
• s0 = I,
• succ : S 2S is defined by succ(s) = {s0 S | a A: pre(a) s,
s0 = result(s, a)}
• Sol = {s S | G s}
Progression algorithm:
1. Start from initial state
2. Find all actions whose preconditions are true in the initial state (applicable
actions)
3. Compute effects of actions to generate successor states
4. Repeat steps 2-3, until a new state satisfies the goal
Progression explores only states that are reachable from I; they may not
be relevant for G
53
Progression
C C
A B B
Step 1: Initial State Goal State
Initial state s0 = I = on(A, Table) ^ on(B, Table) ^ on(C, B) ^ clear(A) ^ clear(C) ^
handEmpty
Step 2:
Applicable actions: unstack(C,B), pickup(A)
Step 3:
result(s0, unstack(C,B)) = on(A, Table) ^ on(B, Table) ^ on(C, B) ^ clear(A) ^
clear(C) ^ handEmpty holding(x) ^ clear(y) \ on(x, y) ^ handEmpty ^ clear(x) =
on(A, Table) ^ on(B, Table) ^ clear(A) ^ clear(B) ^ holding(C)
Definition – Regression
Let P be a set of facts, s P, and a an action. The regression regress(s, a)
of s through a is:
55
Regression
Regression algorithm:
1. Start with the goal
2. Choose an action that will result in the goal
3. Replace that goal with the action’s preconditions
4. Repeat steps 2-3 until you have reached the initial state
• Regression explores only states that are relevant for G; they may not
be reachable from I
• Regression is not as non-natural as you might think: if you plan a trip to
Thailand, do you start with thinking about the train to Kandy?
56
Regression
C C
A B B
A B C B
58
Heuristic Functions
59
Heuristic Functions
A B C B
60
Heuristic Functions
62
Complexity and Decidability
64
65
Partial-Order Planning
87
Constraint-Based Search
Constraint-Based Search:
1. Constraints are discovered and propagated as far as
possible.
2. If there is still not a solution, then search begins, adding
new constraints.
88
Constraint-Based Search
91
Search is an almost totally generic construct: there is a space of possibilities, and
you want to locate one, but you have to find it by inspecting a (not necessarily
proper) subset.
There are all manner of details as to the specific search problem (i.e. what is the
space, how are you allowed to query it, etc.) and particular search algorithm (most
importantly, how you organize which parts of the space you query in what order).
Pretty much ANY problem can be posed as a search problem (what's the space of
possibilities, and how do you tell which is a desired one), which is why it plays such
a prominent place in AI.
92
Planning is a particular kind of search: it is a search through the space of action
sequences (or more generally, partial orders) for a plan that satisfies some criteria.
Saying that finding a book by its ISBN will take 10 billion actions suggests checking
an ISBN is one of the actions (as there are that many possible ISBNs), but
somehow planning (i.e. finding an appropriate action sequence) will result in fewer
actions (because you then won't need to inspect all of the ISBNs?). But without
details of the problem, we can't say how reasonable that claim is.
93
Planning can make use of Regression Search i.e. start with the goal state and
form a plan to reach the initial state.
For the book example, if you start with PRECONDITION: buy(B), ISBN(B) then
you may have million possibilities to look out(since there are a million ISBN
numbers), but you want to "plan" how you may reach the goal state and not just
"search“
Planning gives you the sequence of actions you need to reach the goal state.
Searching is not concerned with "actions“
94
Questions?
98 98