Classical Planning
From Action Models to Valid Plans
Classical planning constructs an action sequence that transforms a known initial state into a state satisfying a specified goal. You encounter it when modelling tasks such as moving materials, configuring equipment, or processing documents. The central challenge is that an action can enable a later action while destroying something another action needs. A useful plan therefore depends on the effects of the entire sequence, not just the usefulness of each action in isolation.
What the model assumes
The basic setting has a finite collection of discrete facts, a fully known initial state, and known, deterministic action effects. The environment changes only through the modelled actions. We consider sequential execution: one action completes before the next begins. These assumptions let you predict a single state after every executable sequence.
Let F be the available facts. A state s⊆F records exactly those facts currently true. Under the closed-world assumption, omission means false, rather than unknown. A goal set G specifies facts that must hold together at completion; it need not describe every fact in the final state.
Real equipment can have uncertain outcomes, but that uncertainty is outside this basic model. A classical plan is justified by the supplied deterministic model, so its guarantee depends on that model representing the task accurately.
Actions and state transitions
An action model specifies the facts required before an action and the changes it makes. In the STRIPS representation, write an action a using three sets: pre(a), add(a), and del(a). We use positive preconditions and disjoint add and delete sets here.
The governing rules are:
The first rule determines whether the action is applicable. Only then does the second rule construct the next state. Preconditions are checked in the old state; an action cannot supply its own missing precondition through its effects.
Example: A door-opening action might require Closed and Unlocked, delete Closed, and add Open. Unlocked remains true because it is not deleted. Merely requiring a fact does not consume it. Conversely, forgetting to delete Closed would leave both door-status facts true in this representation.
An action schema can use parameters, such as Move(object, source, destination). Replacing every parameter with a specific object produces a ground action. Its actual preconditions and effects are the ones you check during execution.
Validity, goals, and cost
For a proposed sequence π=⟨a1,…,an⟩, start at s0 and apply the transition rule repeatedly. If a precondition is missing, stop: the proposed sequence is not executable. If every action is applicable, test the goal in the final state:
Goal facts must hold simultaneously at completion. Achieving one earlier does not help if a later action deletes it. Unrequested facts may remain true, so testing G=sn would usually be too strict.
Property | Required check |
|---|---|
Executable sequence | Every action is applicable when reached |
Valid plan | The sequence is executable and its final state satisfies the goal |
Minimum-cost plan | No valid plan has a smaller total action cost |
With nonnegative action costs c(a), total cost is
When every action costs one unit, minimizing cost means minimizing action count. With unequal costs, a longer plan can be cheaper. To establish optimality, give a valid plan and a lower bound that matches its cost; a successful simulation alone establishes validity.
What to remember
- Check all preconditions before applying any effects.
- Remove delete effects, insert add effects, and preserve everything else.
- Validate the full sequence and test the final goal by set inclusion.
- Distinguish finding a valid plan from proving that its cost is minimal.
Example: Delivering a sealed laboratory sample
A laboratory robot must deliver one sample to an incubator and return to the preparation station. Use plan validation, the replay of a proposed sequence against its action model, to check the instructions before execution.
The initial state is
and the goal is G={Delivered,AtPrep}. Every fact absent from a state is false. The table gives all available actions and all their effects; unchanged facts persist.
Action | Preconditions | Add effects | Delete effects | Time (s) |
|---|---|---|---|---|
Load | AtPrep, SampleAtPrep, Empty | Carrying | SampleAtPrep, Empty | 2 |
Seal | Carrying, Unsealed | Sealed | Unsealed | 1 |
Go | AtPrep | AtIncubator | AtPrep | 3 |
Unload | AtIncubator, Carrying, Sealed | Delivered, Empty | Carrying | 2 |
Return | AtIncubator | AtPrep | AtIncubator | 3 |
Actions execute sequentially without overlap. Treat each listed time as a fixed additive cost; the state changes at action completion, and nothing else changes during execution.
a) Find the complete state after Load followed by Seal.
First, check Load against the initial state. AtPrep, SampleAtPrep, and Empty are all present, so Load is applicable. Load deletes ________ current facts and inserts ________ new fact. Applying those changes gives
Next, check Seal. Both Carrying and Unsealed are present. Remove Unsealed and insert Sealed, preserving AtPrep and Carrying:
The final state after the two actions is AtPrep, Carrying, and Sealed. Carrying remains true because Seal requires it but does not delete it.
b) Identify the first inapplicable action in the proposed sequence Load, Go, Unload. Repair the sequence so that it achieves the complete goal.
Load is applicable and produces s1 from part a. Go then requires AtPrep, which is present. It deletes AtPrep and adds AtIncubator, producing
Immediately before the attempted unload, the robot's location fact is ________. However, Sealed is absent. Unload requires Sealed as well as AtIncubator and Carrying, so Unload, the third action, is the first inapplicable action.
Insert Seal after Load, and append Return after Unload. The repaired sequence is
After Load and Seal, the state is s2 from part a. Go replaces AtPrep with AtIncubator. Unload then removes Carrying and adds Delivered and Empty. Return replaces AtIncubator with AtPrep. The final state is
which contains both goal facts. The extra true facts are allowed because the goal specifies requirements rather than an exact final-state description.
c) Calculate the repaired plan's execution time and determine whether any valid plan can take less time.
First, add the fixed times of the repaired sequence. The time through completion of Unload is ________. Including Return gives
Next, establish a lower bound. Unload is the only action that adds Delivered, so every valid plan needs Unload. Its requirements force Load to establish Carrying, Seal to establish Sealed, and Go to establish AtIncubator. Go deletes AtPrep, and Return is the only action that can restore it. Therefore every valid plan includes all five actions at least once.
Their combined cost is 11 s. All action times are positive, so adding actions cannot reduce that bound. The repaired plan attains it and therefore has minimum execution time 11 s.
A finishing station starts in state {Raw,Free}. Its goal is {Polished,Free}. The table lists all available actions; unlisted facts are false, and facts not changed by an action persist.
Action | Preconditions | Add effects | Delete effects |
|---|---|---|---|
Cut | Raw, Free | Cut, Occupied | Raw, Free |
Release | Occupied | Free | Occupied |
Polish | Cut, Free | Polished, Occupied | Cut, Free |
Find the minimum number of actions needed to achieve the goal. Give an exact integer. The station must be Free in the final state.
A parcel robot starts in {Home,Token,Locked,ParcelHome}. An access gate consumes its single-use token when unlocked. All other facts are initially false, and each action changes only its listed effects.
Action | Preconditions | Add effects | Delete effects |
|---|---|---|---|
Pick | Home, ParcelHome | Holding | ParcelHome |
Unlock | Home, Token, Locked | Open | Token, Locked |
Enter | Home, Open | Inside | Home |
Drop | Inside, Holding | Delivered | Holding |
The robot executes Pick, Unlock, Enter, Drop. Complete each cell with true or false for the fact named in its column. Record the state immediately after the named action.
| State after | Home | Token | Open | Holding | Delivered |
| Unlock | |||||
| Enter | |||||
| Drop |