Planning
Planning
In Artificial Intelligence (AI), planning refers to the process of
deciding a sequence of actions that a system must take to
achieve a specific goal. Just like humans plan their daily tasks
with a goal in mind, AI systems use planning algorithms to
break down a problem into smaller, manageable tasks and
determine the best course of action.
Planning is crucial for AI applications because it allows
machines to:
Think ahead: AI systems evaluate multiple possible outcomes
before selecting the optimal one.
Adapt to changes: When faced with uncertain environments, AI
systems can revise their plans based on new information.
Act autonomously: Whether it’s an autonomous robot or a smart
assistant, AI planning enables machines to perform tasks
2
independently.
Blocks World
Predicates describing the initial state:
On(C, A), On(A, Table), On(B, Table), Clear(C), Clear(B)
Predicates describing the target state:
On(A, B), On(B, C)
ACTIONS:
Move(X, Y)
Precond: Clear(X), Clear(Y)
Effect: On(X, Y)
Move(X, Table)
Precond: Clear(X)
3
Effect: On(X, Table)
Choosing Action
We can move C to the table
This achieves none of the goal predicates
We can move C to top of B
This achieves none of the goal predicates
We can move B to top of C
This achieves On(B, C)
4
Partial Solution
5
Partial Solution
6
Ordering Partial Solutions
7
Ordering Partial Solutions
8
Sometimes Partial Order may stay
9
10
Example Planning Problem: Making Tea
suppose you have a robot that can serve tea think about what
the robot must do to make tea, e.g.:
it must put water in the kettle
heat the kettle
get a cup
pour hot water into the cup (after the water is hot enough)
get a tea bag
leave the tea bag in the water for enough time
remove the tea bag
add milk
add sugar
mix the tea
serve the tea
11
There are many, many actions to consider! and most
actions consist of many smaller sub-actions and in
some situations very long sub-plans might be
triggered.
e.g. if there is no milk, the robot might go to the store,
or ask if creme would be an acceptable substitute
e.g. if the robot drops the spoon on the floor, then it
must pick it up and clean it before continuing
time and sensing is important as well
how long should the robot mix the tea for?
12
Types of Planning
Two types of planning
Classical planning environments
Fully observable, deterministic, finite, static and discrete.
Non-classical planning is for partially observable or
stochastic environments.
The non-classical planning involves a different set of algorithms
and agent designs.
Classical planning is a type of planning in artificial
intelligence (AI) that involves creating a series of actions to
achieve a goal in a predetermined setting.
In classical planning, the goal is to move a system from an
initial state to a goal state by applying actions with known and
deterministic effects.
13
Planning Problem
Agent environment states are represented as valuations of
state variables.
An action can be represented as a procedure or a program.
The procedures are used to compute values of state
variables.
After the execution of procedure (i.e. after the action), the
environment state will be changed toward the goal.
A planning problem in artificial intelligence (AI) involves
choosing a sequence of actions to change the world's state
to meet a goal. For example, building a house involves
deciding the order of construction
14
Types of Planning in Artificial
Intelligence (AI)
There are several types of planning approaches in AI, each
suited to different tasks and environments:
15
Classical Planning
Classical planning is the traditional form of AI planning and
assumes a static and fully observable environment where all
actions are deterministic.
The AI agent has complete knowledge of the world and
operates with a fixed goal, attempting to find a sequence of
actions that leads from an initial state to a goal state.
Key Concepts
Initial State: The starting point of the problem.
Goal State: The desired outcome or target state.
Actions: The possible steps or moves that can be taken.
State Transitions: The changes in the state resulting from
actions.
16
Classical Planning
Components
Planning Domain: Description of the environment, including:
Objects (e.g., blocks, robots)
Actions (e.g., move, pick-up)
Constraints (e.g., block A cannot be on top of block B)
Problem Instance: Specific initial state and goal:
Initial state: Description of the initial environment (e.g., block A
is on the table)
Goal: Desired outcome (e.g., block A is on block B)
Actions: Operators that transform the state:
Preconditions: Conditions that must hold for an action to be
applicable
Effects: Changes to the state resulting from an action
17 Goal: Desired outcome:
Planning Process
Problem Formulation:
Define planning domain and problem instance
Planning: Generate a plan (sequence of actions)
Planning algorithms (e.g., Graphplan, Plan Space Planning)
Planning strategies (e.g., forward search, backward search)
Plan Validation: Verify plan correctness
Check plan feasibility
Check plan optimality
Plan Execution: Execute plan
18
Example 1
Block Stacking
Planning Domain:-
Blocks (A, B, C)
Actions:
Pick-up (block)
Put-down (block)
Stack (block1, block2)
Constraints:
Block A cannot be on top of block B
Problem Instance:-
Initial State: Block A is on the table, Block B is on the table
Goal: Block A is on Block B
Plan:
Pick-up (Block A)
19
Put-down (Block A, Block B)
Robot Navigation Planning Domain:- Example 2
Robot-
Locations (L1, L2, L3)
Actions:
Move (robot, location)
Pick-up (object)
Deliver (object)
Constraints:
Robot cannot move to occupied location
Problem Instance:-
Initial State: Robot is at L1, Object is at L2
Goal: Object is at L3
Plan:1.
Move (Robot, L2)
Pick-up (Object)
Move (Robot, L3)
20 Deliver (Object)
Example
Let’s consider the Robot Navigation problem.
Scenario:
A robot needs to navigate from a start point to an end point in
a grid. The robot can move up, down, left, or right.
Initial Setup:
Initial State: Robot is at (1,1).
Goal State: Robot needs to reach (3,3).
Grid:
Here S is initial state and G is the goal state.
21
Actions:
Move Up: If not at the topmost row.
Move Down: If not at the bottommost row.
Move Left: If not at the leftmost column.
Move Right: If not at the rightmost column.
Plan:
Move Right: (1,1) -> (1,2)
Move Right: (1,2) -> (1,3)
Move Down: (1,3) -> (2,3)
Move Down: (2,3) -> (3,3)
Steps:
Move Right: The robot moves from (1,1) to (1,2).
Move Right: The robot moves from (1,2) to (1,3).
Move Down: The robot moves from (1,3) to (2,3).
Move Down: The robot moves from (2,3) to (3,3).
22 By following these actions, the robot reaches the goal state at (3,3).