0% found this document useful (0 votes)
10 views

AI Lectorial06 Planning Add

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

AI Lectorial06 Planning Add

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

RMIT Classification: Trusted


Artificial Intelligence

Week 6: Planning

COSC2129
RMIT Classification: Trusted

Automated planning

Materials:
• Book: Artificial Intelligence: A Modern Approach
- Chapter 11.1-11.3 [11.3.2, 11.4-11.7]
• Other sources.
RMIT Classification: Trusted

Search and planning

• Block world
RMIT Classification: Trusted

Search: BFS
RMIT Classification: Trusted

Planning: Representation

• Block world: Description by predicates of the form


– Ontable(x) x stands on the table
– On(x,y) x stands on y
– Clear(x) nothing stands on x
– Handempty robot hand is empty
– Holds(x) robot hand holds x

• Example
– Ontable(?)
–…
RMIT Classification: Trusted

Planning: Representation

• Block world: Description by predicates of the form


– Ontable(x) x stands on the table
– On(x,y) x stands on y
– Clear(x) nothing stands on x
– Handempty robot hand is empty
– Holds(x) robot hand holds x

• Example
– Ontable(A)
– Ontable(B)
– On(D,A)
– On(C,D)
– Clear(C)
– Clear(B)
– Handempty

Using First-Order Logic (FOL).


RMIT Classification: Trusted

Representation: FOL

• Block world

Initial state Goal state

– Ontable(A) – Ontable(B)
– Ontable(B) – Ontable(C)
– On(D,A) – On(D,B)
– On(C,D) – On(A,D)
– Clear(C) – Clear(A)
– Clear(B) – Clear(C)
– Handempty – Handempty

Using First-Order Logic (FOL).


RMIT Classification: Trusted

Application?

• Robot navigation
• Robot picking

Source

• Autonomous driving vehicle Grand


Challenge
• DARPA Grand challenge
RMIT Classification: Trusted

Example: Shakey the Robot

• The first general-purpose mobile robot


able to reason about its own actions.
While other robots would have to be
instructed on each individual step of
completing a larger task, Shakey could
analyze commands and break them
down into basic chunks by itself.

• The 'first electronic person'


was a box on wheels

https://en.wikipedia.org/wiki/Shakey_the_robot
RMIT Classification: Trusted

Planning as search
RMIT Classification: Trusted

Planning as search

Source
RMIT Classification: Trusted

Planning as search

Source
RMIT Classification: Trusted

Search and Planning


RMIT Classification: Trusted

Forward and backward chaining

• Inference in FOL: The approach


1. decide predicates and functions
2. construct a knowledge base
3. search for a proof
• Proof by
– Forward-chaining: starts with known facts and infer
new ones until reaching the goal, or
– Backward-chaining: starts with the goal, and work
backwards until hitting known facts
RMIT Classification: Trusted

Automated planning
RMIT Classification: Trusted

Automated planning

• Classic planning
– Definition
– Representation: Examples
• Planning algorithms
– Forward and backward state-space search
– Heuristics
– Other planning approaches.
RMIT Classification: Trusted

Automated planning

• Declarative Knowledge focuses on the description of


the world (So far)
• Procedural Knowledge focuses on how to change
the world (now)
• Need to specify how an action changes the world!
RMIT Classification: Trusted

Plans and Planning

• A plan is a sequence of actions that allows to


accomplish a certain task/ specified goal.
– An action is a primitive operation that can be carried
out by an agent (robot).
• Planning is the process of determining a sequence
of actions necessary to achieve a specified goal.
– Planning involves search.
RMIT Classification: Trusted

Knowledge Representation for Planning

• In planning:
– State knowledge (Declarative knowledge)
– Operator knowledge (Procedural knowledge)
• For state knowledge, use:
– PL and FOL state description
– Description of a state could be complex and requires a
large number of sentences
• For operator knowledge, use:
– Logic representation
– PDDL (Planning Domain Definition Language)
representation, e.g., STRIPS
• Heuristic search is preferred.
RMIT Classification: Trusted

Logic Representation of Action

• Actions ~ rules, operate on states and generate new


states.
• Form: A ⇒ (B ⇐ C) ~ action A produces new
predicate(s) B when condition(s) C is(are) true.
• Example: Pickup action
∀X (Pickup(X) ⇒ ( Gripping(X) ⇐ Gripping() ∧ Clear(X))
-- For all blocks X, when the gripper is empty and X is
clear we can get a new state with the gripper holding X
by applying action Pickup
RMIT Classification: Trusted

Frame Axioms

• Actions specify what changes.


• Frame problem: representing all the things that
stays the same.
• Frame axioms are rules defined to say what
predicates describing a state are not changed after
an operator is applied
RMIT Classification: Trusted

STRIPS Representation

• An action-centric representation which, for each


action, specifies when the action can occur and the
effects of the action
– States;
– Actions;
– Goal.
• Solution for a planning problem: an action sequence
that, when executing in the initial state, results in a
state that satisfies the goal.
RMIT Classification: Trusted

Planning Algorithms

• Planning inherently maps into a state-space search problem.


• Planning problems can be solved with any search algorithms
while keeping track of actions used to reach the goal.
• Forward state-space search:
– progression planning
– irrelevant action problem
– large state space
• Backward state-space search:
– regression planning
– relevant and consistent actions.
• Heuristic functions estimate the distance from a state to the
goal. Good heuristic functions enables practical feasibility.
RMIT Classification: Trusted

Planning

• The world is described in (a fragment of) logic


• Search in the state space
• Operators are represented by three lists:
[Preconditions:] specify the applicability of the operator
[delete list:] specifies what does not hold any longer
[add list:] specifies what newly holds
RMIT Classification: Trusted

STRIPS

• STanford Research Institute Problem Solver initial


state
– Init (given by predicate logical formulae)
– goal state goal (given by predicate logical formulae)
– set of rules (given by name, preconditions, delete list,
& add list )
RMIT Classification: Trusted

STRIPS

• Example: Blocks World


RMIT Classification: Trusted

Example Plan Execution


RMIT Classification: Trusted

Example Plan Execution


RMIT Classification: Trusted

Example Plan Execution


RMIT Classification: Trusted

How to Search in STRIPS?

• Simple planning algorithm: BFS, i.e. apply all applicable


operators with all possible instantiations one after the
other and generate all possible states.
→ intractable
• Heuristic in Strips: Search in the search space from the
goal, apply operators backward
• Advantages: Goal often relatively easy compared to
initial state

• Examples: how to come up with Holds(A)?

• two possibilities: PICKUP(A) or UNSTACK(A,x)


RMIT Classification: Trusted

How to Search in STRIPS?

Algorithm MEA (means-end-analysis)


• Input: a set Goal, an initial state Init, a set of rules
RULES
• Output: a plan P in form of a list of operators with
instantiations
• Auxiliary Variable: Actual for actual state.
RMIT Classification: Trusted

Example

Open are:
• Ontable(C),
• On(D,B),
• On(A,D),
• and Clear(A)

• Goal_1 := Ontable(C)
• How to achieve this goal?

• Only by PUTDOWN(C)
• we need a plan for the preconditions of PUTDOWN(C), i.e.
Holds(C)
RMIT Classification: Trusted

• How to achieve Holds(C)?


• Two possibilities by PICKUP(C) or UNSTACK(C,x)
– First: bad choice, since precondition is Ontable(C) (was
initial goal)
– Second: with x|-> D, hence plan:
P=(UNSTACK(C,D),PUTDOWN(C))
• Now apply P to Init: Actual:= P(Init), i.e., Result after one
loop ( Actual):
RMIT Classification: Trusted

• …
• Your turn
RMIT Classification: Trusted

Reference

• Search Block world: bham.ac.uk


• A* for search for Block world (Python)
RMIT Classification: Trusted

Question?

You might also like