Uploaded by Haya Movie

AI chapter4

advertisement
DEFENCE UNIVERSITY
COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING
ARTIFICIAL INTELLIGENCE
Chapter 4
Planning
By: Bereket M.
What is AI Planning ?
●
●
Classic planning in AI refers to the process of generating a sequence of
actions to achieve specific goals in an environment with known dynamics and
rules. It is a fundamental problem in artificial intelligence.
It is used in various applications, including robotics, game playing, logistics,
and automated decision-making systems.
What is AI Planning ?
●
In response to the challenges and complexities of planning problems, planning researchers have
adopted a factored representation approach. In this approach, a state of the world is represented by
a collection of variables, each of which captures a specific aspect or dimension of the state.
Variables:
●
●
Location Variables:L[robot] : Represents the current location of the robot in the
warehouse.
L [package1],L[package2] , ...L[package n] : Represent the current locations of the
packages in the warehouse.
Package Status Variables:
●
S[package1],S[package2],...S[package3]:Represent the status of each package, such as
whether it's waiting to be picked up, being transported, or has been delivered.
What is AI Planning ?
●
●
●
Each state is represented as a conjunction of fluents that are ground,
functionless atoms.
ground: variable-free
For example:
○
○
Poor ∧ Unknown might represent the state of a hapless agent
State in a package delivery problem might be At(Truck 1 , Melbourne) ∧ At(Truck 2 ,
Sydney).
Planning vs. Problem solving
●
●
●
●
●
Planning and problem solving methods can often solve the same sorts of
problems
Planning is more powerful because of the representations, methods used and
accurate o/p.
States, goals, and actions are decomposed into sets of sentences (usually in
first-order logic)
The main objective of planning is to develop a structured course of action to
achieve desired outcomes while considering constraints and uncertainties.
Where The primary objective of problem-solving is to reach a solution or an
optimal outcome for a given problem instance.
State Representation
●
●
A state is represented with a conjunction of positive literals
Using
○
○
●
●
●
Logical Propositions: P ∧ Q
FOL literals: At(Plane1,OMA) ∧ At(Plan2,JFK)
FOL literals must be ground(variable-free) & function-free
Closed World Assumption
What is not stated are assumed false
Actions
●
●
●
Actions are described by a set of action schemas that implicitly define the
ACTIONS (s) and RESULT (s, a) functions needed to do a problem-solving
search.
Classical planning concentrates on problems where most actions leave most
things unchanged. So having all objects state as a set of result is not feasible.
PDDL solves this by specifying the result of an action in terms of what
changes, everything that stays the same is left unmentioned.
Actions
●
A set of ground (variable-free) actions can be represented by a single action
schema. Where the schema is a lifted representation.
○
●
lifts the level of reasoning from propositional logic to a subset of first-order logic.
Example:
Action(Fly(p, from, to),
PRECOND :At(p, from) ∧ Plane(p) ∧ Airport (from) ∧ Airport (to)
EFFECT :¬At(p, from) ∧ At(p, to))
Action
Relevant Action
●
●
In Progression planning when its preconditions match a subset of the current
state
In Regression planning, when its effects match a subset of the current goal
state
Consistent Action
●
●
●
The purpose of applying an action is to ‘achieves a desired goal’
We should be careful that the action does not undo a desired literal (as a side
effect)
A consistent action is an action that does not undo a desired literal
Goal Representation
●
●
Goal is a partially specified state
A proposition satisfies a goal if it contains all the atoms of the goal and
possibly others..
○
Example: Rich ∧ Fapartiallymous ∧ Miserable satisfies the goal Rich ∧ Famous
Classic planning example
●
Sample example of changing a flat tire and not leaving over night.
Init(Tire(Flat ) ∧ Tire(Spare) ∧ At(Flat , Axle) ∧ At(Spare, Trunk ))
Goal (At (Spare, Axle))
Action(Remove(obj , loc),
PRECOND : At(obj , loc)
EFFECT : ¬ At(obj , loc) ∧ At(obj , Ground ))
Action(PutOn(t , Axle),
PRECOND : Tire(t) ∧ At(t , Ground ) ∧ ¬ At(Flat , Axle)
EFFECT : ¬ At(t , Ground) ∧ At(t , Axle))
Action(LeaveOvernight ,
PRECOND :
EFFECT : ¬ At(Spare, Ground) ∧ ¬ At(Spare, Axle) ∧ ¬ At(Spare, Trunk)
∧ ¬ At(Flat , Ground ) ∧ ¬ At(Flat , Axle) ∧ ¬ At(Flat , Trunk))
Planning with State-Space Search
●
Search the space of states (first chapters)
○
○
●
Initial state, goal test, step cost, etc.
Actions are the transitions between state
Actions are invertible
○
○
Move forward from the initial state: Forward State-Space Search or Progression Planning
Move backward from goal state: Backward State-Space Search or Regression Planning
Planning with State-Space Search
Forward state-space search
●
●
Searching all possible states to reach to the goal.since the output of the
action can not be determined all possible states have to be searched. This
results with having exponential time complexity.
By implementing heuristic search this can be improved.
Backward state-space search
●
In regression search we start at the goal and apply the actions backward until
we find a sequence of steps that reaches the initial state. It is called
relevant-states search because we only consider actions that are relevant to
the goal (or current state).
Heuristic to Speed up Search
●
We need an admissible heuristic
○
●
●
●
Divide-and-conquer: sub-goal independence assumption
By adding more edges to the graph,making it strictly easier to find a path,
By grouping multiple nodes together, forming an abstraction of the state
space that has fewer states, and thus is easier to search.
Problem relaxation by removing or adding edges(actions)
○
○
○
ignore all preconditions
Ignore all preconditions and negative effects
Ignore negative effects only: Empty-Delete-List
Planning Graph
●
●
A planning graph organizes the states of the planning problem into levels, with
each level representing a snapshot of the world at a particular point in time.
The graph also includes actions that can be taken to transition from one state
to another.
Planning Graph
●
Initial State Level (Level 0):
○
●
Expansion:
○
●
From the initial state, the graph expands by considering all possible actions that can be
applied in the current state. These actions represent potential transitions to new states.
State Levels (Level 1, Level 2, ...):
○
○
●
The initial state of the problem is represented at the first level (Level 0) of the graph.
Each subsequent level of the graph corresponds to a new state resulting from applying actions
from the previous level.
The graph continues to grow as new states are generated, representing the progression of the
world over time.
Action Levels:
○
○
In addition to state levels, the graph may include action levels, where actions are represented.
Each action level corresponds to the actions that can be taken in a particular state.
Planning Graph
Init (Have(Cake))
Goal (Have(Cake) ∧ Eaten(Cake))
Action(Eat (Cake)
PRECOND : Have(Cake)
EFFECT : ¬ Have(Cake) ∧ Eaten(Cake))
Action(Bake(Cake)
PRECOND : ¬ Have(Cake)
EFFECT : Have(Cake))
●
●
To avoid redundant states and actions, planning graphs often employ pruning
techniques such as mutex relations. (red curve lines)
Mutex relations identify mutually exclusive states or actions that cannot coexist or
be applied together.
Planning with Propositional Logic
●
State Representation: In a planning problem, a state represents the current
configuration of the world. We can use propositional logic to represent the
state by defining propositions that capture relevant aspects of the world. For
example, in a navigation problem, we might have propositions like "At(A)",
"At(B)", where A and B represent different locations.
Planning with Propositional Logic
●
Action Representation: Actions represent the operations or steps that can
be taken to change the state of the world. Each action has preconditions
(conditions that must be true for the action to be applicable) and effects
(changes it brings about in the state variables). We can represent actions
using propositional logic by defining propositions for the preconditions and
effects of each action.
Planning with Propositional Logic
●
Let's consider a simple planning problem where we have two locations, A and
B, and a robot that can move between these locations. Our goal is to move
the robot from location A to location B.
○
○
○
○
○
○
Initial State: At(A)
Goal State: At(B)
Action: Move(robot, from, to)
We can represent this problem using propositional logic:
Propositions:
■ At(A), At(B): Represent the current location of the robot.
Actions:
■ Move(robot, A, B): Preconditions: At(robot, A), Effects: ¬At(robot, A) ∧ At(robot, B)
Time, Schedules and Resources
●
●
The classical planning representation talks about what to do, and in what
order, but the representation cannot talk about time: how long an action takes
and when it occurs.
For example:
○
●
●
the planners of an airline that says which planes are assigned to which flights, but we really
need to know departure and arrival times as well.
This is the subject matter of scheduling. The real world also imposes many
resource constraints;
This section covers methods for representing and solving planning problems
that include temporal and resource constraints.
Time, Schedules and Resources
“plan first, schedule later”
●
we have a planning phase in which actions are selected, with some ordering
constraints, and a later scheduling phase, in which temporal information is
added to the plan.
○
The notation A ≺ B means that action A must precede action B.
Time, Schedules and Resources
Jobs({AddEngine1 ≺ AddWheels1 ≺ Inspect1 },
{AddEngine2 ≺ AddWheels2 ≺ Inspect2 })
Resources(EngineHoists(1), WheelStations (1), Inspectors (2), LugNuts(500))
Action(AddEngine1 , DURATION :30,
USE :EngineHoists(1 ))
Action(AddEngine2 , DURATION :60,
USE :EngineHoists(1 ))
Action(AddWheels1 , DURATION :30,
CONSUME :LugNuts(20), USE :WheelStations(1))
Action(AddWheels2 , DURATION :15,
CONSUME :LugNuts(20), USE :WheelStations(1))
Action(Inspect i , DURATION :10,
USE :Inspectors (1))
Solving scheduling problems
●
●
Applying Critical path method to determine the possible start and end times of each action.
○ critical path is that path whose total duration is longest; the path is “critical” because it
determines the duration of the entire plan.
On the example the top job is having a slack of 15 which is LS-ES
○ ES:The Earliest Start Time (ES) of a task is the earliest point in time at which the task
can begin while still satisfying all constraints and dependencies.
○ LS:The Latest Start Time (LS) of a task is the latest point in time at which the task can
begin without delaying the project's completion.
Solving scheduling problems
●
●
Resource allocation is not taken into
consideration.
The tasked on the top job have a slack of
15.
Solving scheduling problems
●
●
When considering the use of EngineHost in this example. The time allocated
for the use have to be with out no overlap when scheduling.
This is 30 minutes longer than the 85 minutes required for a schedule without
resource constraints.Notice that there is no time at which both inspectors are
required.
Reading assignment
●
●
Hierarchical Planning
Conditional Planning
Download