Inference in first

Planning
Chapter 11- Part1
Author: Vali Derhami
1/16
Outline
• Search vs. planning
• STRIPS operators
• Forward and backward search algorithms
in planning
2/16
Search vs. Planning
• Consider the task get milk, bananas.
• Standard search algorithms seem to fail miserably:
3/16
Search vs. Planning (cont.)
Assume a problem-solving agent using search . . .
♦ Which actions are relevant?
– Our previous state-space definition does not clarify this
♦ What is a good heuristic function?
– Must be provided by a human in each individual case
♦ How to decompose the problem?
– Most real-world problems are nearly decomposable
– But the state-space definition does not reveal any
structure of the problem
4/16
What is planning?
• Planning in AI is the problem of finding a
sequence of actions to achieve some goals.
• The sequence of actions is the system’s plan
which then can be executed.
• Planning requires the following:
– representation of goal to achieve;
– knowledge about what actions can be performed;
– knowledge about state of the world;
to generate a plan to achieve the goal.
5/16
Architecture of a Planner
6/16
Planning Language
• What is a good language?
– Expressive enough to describe a wide variety of
problems
– Restrictive enough to allow efficient algorithms to operate
on it
Planning algorithm should be able to take advantage of the
logical structure of the problem
7/16
STRIPS Language
• STanford Research Institute Problems
Solver
• The language of predicate logic to represent
goal to be achieved;
 state of environment;
 actions available to agent;
8/16
Example: Blocks world
• To represent this environment, need the following
predicate names:
On(x, y) obj x on top of obj y
OnTable(x) obj x is on the table
Clear(x) nothing is on top of obj x
Holding(x) arm is holding x
ArmEmpty robot arm is empty
Here is a FOL representation of the blocks world described above:
Clear(A)Clear(C)  On(A,B)  OnTable(B)  OnTable(C)  ArmEmpty
9/16
Representation of states and goal
• Representation of States = conjunction of ground and
function free literals
)‫ترکیت عطفی از لیترالهای مثبت (در اینجا بیشتر لیترالهای گزاره ای‬
– e.g. At(A,B) Clear(C), . . .
But not At(A, x) or At(neighbour(A),B)!
closed-world assumption is used, meaning that any
conditions that are not mentioned in a state are assumed
false.
• Representation of goals: A goal is a particular state
– e.g. OnTable(A)  OnTable(B)  OnTable(C)
A state s satisfies a goal g if s contains all the atoms in g
(and possibly others)
Rich  Famous  Miserable satisfies Rich  Famous
10/16
Representation of actions
Action(Fly(p, from, to),
PRECOND:At(p, from)  Plane(p)  Airport(from)  Airport(to)
Effect: At(p, from)  At(p, to))
 Each action schema has:
– a name and parameter list
– a pre-condition list: conjunction of function-free positive literals,
list
of facts which must be true for action to be executed;
Any variables in the precondition must also appear in the action's parameter
list.
– an effect list: a conjunction of function-free literals describing how the
state changes when the action is executed. may be contains:
 a delete list: list of facts that are no longer true after action is
performed (negative literals);
 an add list: list of facts made true by executing the action. (positive literals)
Each of these may contain variables.
11/16
Applicable actions
An action is applicable in any state satisfying its
preconditions
Example:
Action(Fly(p, from, to),
PRECOND:At(p, from)  Plane(p)  Airport(from)  Airport(to)
Effect: At(p, from)  At(p, to))
• Current State: At(Pi, JFK)  At(P2, SFO)  Plane(Pi)  Plane(P2) 
Airport(JFK)  Airport(SFO) .
• ={p/Pi, from/JFK, to/SFO} ‫تعریف جایگزین‬
• Thus, the concrete action Fly (Pi, JFK, SFO) is applicable.
12/16
Effect of actions
• Starting in state s, the result of executing an applicable
action a is a state s' that is the same as s except that
 Any positive literal P in the effect of a is added to s'
 any negative literal P is removed from s‘
 all other atoms do not change their value!
After Fly (Pi, JFK, SFO),
• current state:
At(Pi, SFO)  At(P2, SFO)  Plane(Pi)  Plane(P2) 
Airport(JFK)  Airport(SFO) .
13/16
Expressiveness and extensions
14/16
Air cargo transport
In(c, p) means that cargo c is inside plane p, and At(x, a) means that
object x (either plane or cargo) is at airport a.
15/16
Air cargo transport (Cont.)
• Following plan is a solution to the problem:
[Load(C1, P1, SFO), Fly(P1, SFO, JFK),
Unload(C1,P1, JFK),Load(C2, P2, JFK),
Fly(P2, JFK, SFO), Unload(C2, P2, SFO)]
.
16/16