Planning is deciding what to do based on an agent’s ability, goals, and the state of the world. It is finding a sequence of actions to solve a goal.
Planning combines the two major area of AI covered so far: search and reasoning.
The combination enables planners to progress from toy problems, limited to around a dozen actions and states, to real-world industrial applications involving millions of states and thousands of actions.
Assumptions
The world is deterministic
There are no exogenous events outside the agent’s control that change the state of the world
The agent knows what state it is in
Time progresses discretely from one state to the next
Goals are predicates of states that need to be achieved or maintained
Planners that are used in the real world for planning and scheduling the operations of spacecraft, factories, and military campaigns.
Definition of classical planning
Classical planning is defined as the task of finding a sequence of actions to accomplish a goal in a discrete, deterministic, static, fully observable environment. (See Properties of task environments).
We have seen Wumpus world both as propositional logical agent and problem-solving agent. Both share two limitations:
They require ad hoc heuristics for each new domain.
They both need to explicitly represent an exponentially large state space. For example in the Wumpus world, the axioms for moving a step forward had to be repeated for all four orientations, time and current locations with a total cost of actions.
In response to these limitations, planning researchers have invested in a factored representation using a family of languages called PDDL: Planning Domain Definition Language.
These languages allows us to express the actions with a single action schema, and does not need domain-specific knoweldge.
Basic PDDL can handle classical planning domains, and extensions can handle nonclassical domains that are continuous, partially observable, concurrent, and multi-agent.
In PDDL, a state is represented as a conjunction of ground atomic fluents. Recall that:
Ground means no variables
fluent is an aspect of the world that changes over time (see fluents)
Ground atomic indicates there is a single predicate, with possible arguments being constants.
PDDL uses database semantics: the closed-world assumption means that any fluents that are not mentioned are false.
could indicate a state in a package delivery problem.
An action schema represents a family of ground actions.
For example, here is an action schema for flying plane from one location to another:
At(p,from), Plane(p) are literals
The schema consists of the action name, a list of all the variables used in the schema, a precondition and an effect.
The precondition and the effect are each conjunctions of literals (positive or negated atomic sentences).
We can choose constants to instantiate the variables, yielding a ground (variable-free) action:
A ground actiona is applicable in state s if s entails the precondition of a; that is, every positive literal in the precondition is in s and every negated literal is not.
Explanation
A ground actiona is applicable in state s if s entails the precondition of a; that is, every positive literal in the precondition is in s and every negated literal is not.
The definition states that for action a to be applicable in state s, s must entail (or satisfy) the preconditions. This breaks into two checks:
Positive Literals (The “Yes” List): if the precondition contains a positive literal (e.g., At(P1, SFO)), that fluent must be present in the state s.
Check: Is At(P1, SFO) in the set of true facts s?
Logic: If no, the condition is not met, and the action is not applicable.
Negated Literals (The “No” List) If the precondition contains a negated literal (e.g., ¬InMaintenance(P1)), that fluent must not be present in the
state s.
Check: Is InMaintenance(P1) in the set of true facts s?
Logic: If it is in the set, the action is not applicable. If it is not in the set, then due to the closed-world assumption, we treat InMaintenance(P1) as false, which means the condition ¬InMaintenance(P1) is satisfied.
The result of executing applicable action a in state s is defined as a state which is represented by the set of fluents formed by starting with s, removing the fluents that appear as negative literals in the action’s effects (what we call delete list or ) and adding the fluents that are positive literals in the action’s effects (what we call the add list or ):
For example, with the action we would remove the fluent and add the fluent .
Example
Say for absurd that in the action schema you forgot to include . After you make the action “fly”, the resulting set would erroneously contain both and which means the airport cloned itself or teleported to the other airport.
A set of action schemas serves as a definition of a planning domain. A specific problem within the domain is defined with the addition of an initial state and a goal.
The initial state is a conjunction of ground fluents (introduced with the keyword Init in Figure 1.11)
The goal introduced with Goal is just like a precondition: a conjunction of literals (positive or negative) that may contain variables.
graph TD
PDDLDes[PDDL Description]
AS[Action Schema]
Init[Initial State]
Goal
PDDLDes --> Init
PDDLDes --> Goal
PDDLDes --> AS
AS --> Action
AS --> Precond[Precondition]
AS --> Effect
Goal --> Plan[Plan <small>is a solution</small>]
Plan -->|Sequence of actions| Action
Example Domain: Air Cargo Transport
Air cargo transport problem involving loading and unloading cargo and flying it from place to place:
The following plan is a solution to the problem:
Example domain: the spire tire problem
Consider the problem of changing a flat tire. The goal is to have a good spare tire properly mounted onto the car’s axle.
The initial state has a flat tire on the axle and a good spare tire in the trunk.
To keep it simple, our version of the problem is an abstract one, with no sticky lug nuts or other complications. There are just four actions: removing the spare from the trunk, removing the flat tire from the axle, putting the spare on the axle, and leaving the car unattended overnight.
The solution is:
Example domain: the block world
One of the most famous planning domains is the blocks world. This domain consists of a set of cube-shaped blocks sitting on an arbitrarily-large table.
The blocks can be stacked, but only one block can fit directly on top of another.
A robot arm can pick up a block and move it to another position, either on the table or on top of another block. The arm can pick up only one block at a time, so it cannot pick up a block that has another one on top of it.
A typical goal to get block A on B and block B on C:
We use to indicate that block b is on x, where x is either another block or the
table. The action for moving block b from the top of x to the top of y will be .
One of the preconditions for moving is that no other block be on it. In FOL this would be , however basic PDDL does not allow quantifiers, so instead we introduce a predicate that is true when nothing is on .
The action Move moves a block b from x to y if both b and y are clear. After the move is made, b is still clear but y is not.