You turn the skill catalogue into a planning domain
You turn the map and the belief graph into a planning problem
You solve a fetch, and measure how much a heuristic saves over blind search
What a planner takes
The domain
The actions, each with its parameters, preconditions and effects
The problem
The objects, the initial state and the goal
You already have both. The domain comes from isfr/skills/catalogue.py. The problem comes from week 5's map and belief graph, and from a task that says where the robot starts and who wants which drink.
Which skills become actions
SkillSpec has a field plannable. The catalogue sets it false for three skills.
Skill
Why it stays out
go-to
It drives one edge of the map, and the planner never chooses edges
ik-solve
It declares no effects
detect
No skill's precondition uses the one atom it makes true
The six that remain are navigate-to, place-base-for, reach-to, grasp, release and hand-over.
navigate-to in, go-to out
navigate-to runs week 5's route search, then drives each edge of the route with go-to
The planner sees navigate-to and never go-to
The route search therefore stays outside the planning problem
navigate-to has the preconditions (at ?from) and (reachable ?from ?to). The planner has no map, so it cannot decide reachability itself.
The generator decides reachability
reachable(kg) returns every ordered pair of places joined by a route of unblocked edges
The generator writes one reachable fact for each pair, when it writes the problem
This week the pairs include each place with itself
Week 7's meta-actions start by driving to the drink. With the reflexive pair they still apply when the robot already stands there.
The price is one navigate-to from each place to itself. It changes nothing, and no shortest plan contains it.
STRIPS
A state is a set of atoms
A ground atom such as (at worktop_place) is true when it is in the set
An atom outside the set is false
Block 4 returns to that second line.
An operator
An operator has preconditions and two lists
The delete list holds the clauses that might no longer be true after the operator is applied
The add list holds the clauses that are true afterwards
An operator applies in a state when its preconditions hold there
Fikes & Nilsson (1971), section 3.2, Artificial Intelligence 2(3–4), 189–208. Their example is push(k, m, n).
A skill already has this shape
Skill declaration
STRIPS operator
navigate-to
Preconditions
Preconditions
(at ?from), (reachable ?from ?to)
Positive effects
Add list
(at ?to)
Negated effects
Delete list
(at ?from)
One application, before
Apply (navigate-to bed_place counter_place).
Its preconditions, in bold, are both in \( s \), so it applies.
One application, after
Delete (at bed_place), struck out, then add (at counter_place), shaded
The other two atoms are in \( s' \) because they were in \( s \)
The STRIPS assumption
A feature that an action does not mention is unchanged by it.
That is why a skill can declare two effects and leave the rest of the apartment alone
navigate-to says nothing about the gripper, so the gripper holds what it held before the drive
Poole & Mackworth (2023), section 6.1.2.
Schemas and grounding
The catalogue's entries contain variables, so each is an action schema
Grounding substitutes an object of the right type for each variable
Each substitution gives one ground action
The planner grounds the schemas over the problem's objects before it searches.
Grounding navigate-to
navigate-to has two place parameters. The apartment's map has 22 places, so grounding gives 484 navigate-to actions.
\[ 22 \times 22 = 484 \]
22 of them drive from a place to itself.
The registry is a set of schemas
The registry resolves a skill by name, and each plannable skill is one schema
The search runs over their groundings
place-base-for has a drink and a place as parameters. How many ground actions does it give with \( d \) drinks?
PDDL
Two files
PDDL, the Planning Domain Definition Language, writes STRIPS down in two files
The domain file declares types, predicates and actions
The problem file declares objects, the initial state and the goal
One domain serves many problems
Fox & Long (2003), Journal of Artificial Intelligence Research 20, 61–124, credit PDDL to McDermott and the committee of the 1998 planning competition.
After the 1998 planning competition. A robot with two grippers carries balls between two rooms.
Reading the domain
:requirements names the parts of the language the domain uses, here STRIPS and types
Each parameter has a type, and grounding substitutes only objects of that type. Without types, pick would also be grounded with a room in the place of the ball.
Each (not ...) in an effect is an entry in the delete list
pick deletes (at ?b ?r) and (free ?g), so the ball leaves the room and the gripper is no longer free
One problem
(define (problem gripper-problem)
(:domain gripper)
(:objects rooma roomb - room left right - gripper ball1 ball2 - ball)
(:init (at ball1 rooma) (at ball2 rooma) (free left) (free right) (at-robby rooma))
(:goal (and (at ball1 roomb) (at ball2 roomb))))
Two balls, two grippers, two rooms
The goal names the balls only. Where the robot ends up is left open.
; no atom for a blocked edge, and absent:
(reachable bed_place arch)
(reachable bed_place hall_door)
(reachable bed_place counter_place)
; and the three reverse pairs
The fetch domain has no predicate for a blocked edge. A pair of places that only blocked edges joined loses its reachable fact.
Task c of the micro-project shuts off the kitchen. The third written question asks you which fact the problem then lacks.
Gripper with the robot nowhere
The example removes (at-robby rooma) from the initial state and asks again.
without (at-robby rooma): no plan
Every action needs the robot in a room, and no action can put it in one from nowhere.
State-space search
Forward planning
Forward planning is search in the state space. Each node is a state.
A node's neighbours are the states the actions applicable in it lead to, each computed by slide 22's transition
The search starts at the initial state and stops at a state that satisfies the goal
The path to that state is the plan
Poole & Mackworth (2023), section 6.2.
Two blind searches
Breadth-first search expands nodes in order of depth. When every action costs the same, the first goal state it reaches ends a shortest plan.
Uniform-cost search orders the frontier by path cost. Week 5 used it for routes, as lowest-cost-first search.
With every action at cost 1, path cost equals depth, and the two searches differ only in how they break ties
Both are blind. Neither uses the goal to choose which node to expand next.
Poole & Mackworth (2023), section 3.5.4.
Breadth-first on two balls, 1 of 3
Write a state as where ball1, ball2 and the robot are. A and B are the rooms, L and R the grippers.
Expand the initial state, A A A. Six ground actions apply, four picks and two moves.
move rooma rooma leads back to A A A by slide 23, so it adds nothing.
Frontier, depth 1
Reached by
A A B
move rooma roomb
L A A
pick ball1 rooma left
R A A
pick ball1 rooma right
A L A
pick ball2 rooma left
A R A
pick ball2 rooma right
Breadth-first on two balls, 2 of 3
Expand the five states at depth 1.
From A A B the robot can only move. Either move gives a state already seen, A A A or A A B.
A drop in rooma gives A A A again. Duplicate detection keeps one copy of each state.
Frontier, depth 2
Reached from
L R A
L A A or A R A
R L A
R A A or A L A
L A B
L A A
R A B
R A A
A L B
A L A
A R B
A R A
Breadth-first on two balls, 3 of 3
Depth
0
1
2
3
4
5
New states
1
5
6
4
6
5
The first goal state, B B B, lies at depth 5
Breadth-first search expands all 22 states at depths 0 to 4 before it expands any state at depth 5
The plan is the path to B B B. It picks twice, moves, and drops twice.
The branching factor
The branching factor is the number of actions applicable in a state.
The apartment's map is connected, so 22 navigate-to actions apply wherever the robot stands, one to each place, its own included
The manipulation skills add a few more where a drink or a person is
The apartment, blind
With the reference encoding of the apartment problem, blind search expands
2583 nodes on the one-drink task
95770 nodes on the two-drink task
Your own counts depend on your encoding.
Part 3 of the micro-project asks you why the second count is so much larger.
Gripper's growth, blind
Balls
Shortest plan
Expanded
Seconds
2
5
25
0.00
4
11
253
0.00
6
17
1853
0.01
8
23
11773
0.08
10
29
68605
0.59
The plan grows by six steps for every two balls, since each trip carries two
From 4 balls on, the nodes expanded grow by a factor of 5.8 to 7.3 for every two balls added
The blind rows of the example's table. Node counts are the same on every machine. Seconds vary.
Why it grows
Each ball is in one of four positions, either room or either gripper
At most one ball is in each gripper
So the number of states grows exponentially with the number of balls
Blind search has nothing to tell it which of those states lead towards the goal.
Other ways to plan
Regression planning, Poole and Mackworth section 6.3
Planning as a CSP, section 6.4
Partial-order planning, section 6.5
The planners you run this week all search forwards, and the course uses forward search only.
Heuristics by relaxation
A heuristic from the domain
A heuristic for a state estimates the cost of solving the goal from that state
On week 5's map the problem was the lack of a common frame. A planner has a different problem, since no geometry relates its states.
So the estimate has to come from the domain itself. Solve an easier problem, and use its cost.
Poole & Mackworth (2023), section 6.2.
The delete relaxation
Ignore the delete lists of all actions. Apply (move rooma roomb).
In the relaxed task the robot is in both rooms. Nothing an action does can undo another action's work.
Hoffmann & Nebel (2001), Definition 4, Journal of Artificial Intelligence Research 14, 253–302.
Solve the relaxed task
Gripper with 10 balls in rooma, the robot in rooma, both grippers free. The goal is all 10 in roomb.
In the relaxed task, what is the shortest plan?
Pick all 10, since a gripper that picks a ball never stops being free
Move once
Drop all 10, since the robot is still in roomb after each drop
FF works back from the goal and extracts one relaxed plan, counting a shared action once
On this state it extracts exactly the 21 of slide 44, so \( h_{\mathrm{FF}} = 21 \)
Its relaxed plan is not guaranteed to be the shortest one, so \( h_{\mathrm{FF}} \) is not admissible
Hoffmann & Nebel (2001), footnote 2. Ghallab, Nau & Traverso (2025), section 3.2.2, give the algorithm.
Against the shortest plan of 29
Estimate
Value
Against 29
\( h_{\max} \)
2
Below. It counts one ball.
\( h^{+} \)
21
Below. It counts one move.
\( h_{\mathrm{FF}} \)
21
Below here, since it equals \( h^{+} \) on this state
\( h_{\mathrm{add}} \)
30
Above. It counts the move once for every ball.
Only \( h_{\max} \) and \( h^{+} \) are guaranteed below the true cost on every state. Those two are the admissible ones.
\( h_{\max} \) reports 2 here whatever the number of balls, so it is admissible and nearly useless.
A* and greedy best-first
A* orders the frontier by \( f(n) = g(n) + h(n) \), the cost so far plus the heuristic
With an admissible heuristic it returns a shortest plan whenever a plan exists
Greedy best-first search orders the frontier by \( h(n) \) alone. It ignores the cost so far, and it gives no guarantee on plan length.
FF itself searches by enforced hill-climbing. When that fails, it starts again with complete greedy best-first search.
Poole & Mackworth (2023), Proposition 3.1. Hoffmann & Nebel (2001), section 5.1 and page 267.
The example's table
Balls
Length
Expanded
Seconds
2
5 / 5 / 5
25 / 12 / 6
0.00 / 0.00 / 0.00
4
11 / 11 / 13
253 / 208 / 26
0.00 / 0.02 / 0.00
6
17 / 17 / 21
1853 / 1760 / 54
0.01 / 0.24 / 0.01
8
23 / 23 / 29
11773 / 11616 / 90
0.08 / 2.34 / 0.03
10
29 / 29 / 37
68605 / 68368 / 134
0.59 / 17.73 / 0.07
Each cell gives blind, A* with \( h_{\max} \) and greedy with \( h_{\mathrm{FF}} \), in that order. From the example's README. Node counts are the same on every machine. Seconds vary.
Reading the table
A* with \( h_{\max} \) returns the shortest plan for every number of balls
For 10 balls it expands 68368 nodes, against blind search's 68605, and takes 17.73 s, against 0.59 s
It computes \( h_{\max} \) at every state it evaluates, and blind search computes nothing
Greedy best-first search with \( h_{\mathrm{FF}} \) expands at most 134 nodes up to 10 balls. For 10 balls it returns 37 steps where the shortest plan has 29.
Planners as tools
From skills to a plan
Three tools
You do not write a search this week. Three tools do it.
unified-planning, a Python library
pyperplan, a planner written in Python. The course installs version 2.1.
Fast Downward, a planner run through unified-planning
pyperplan names its searches and its heuristics separately, so you can combine them: bfs, astar, gbf against blind, hmax, hadd, hff.
Micheli et al. (2025), SoftwareX 29, 102012. Alkhazraji et al. (2020), Pyperplan (Version 1.3), Zenodo.
Call a planner
Gripper's two files, read back and solved.
from unified_planning.io import PDDLReader
from unified_planning.shortcuts import OneshotPlanner, get_environment
get_environment().credits_stream = None
problem = PDDLReader().parse_problem("gripper.pddl", "gripper-2.pddl")
with OneshotPlanner(name="fast-downward") as planner:
result = planner.solve(problem, output_stream=None)
parse_problem_string takes the two files as text instead, which is what you want once you generate them.
Read what came back
result.status # SOLVED_SATISFICING, SOLVED_OPTIMALLY, UNSOLVABLE_PROVEN, ...
result.plan # None when no plan exists
result.log_messages # the engine's own output
if result.plan is None:
print("unsolvable")
else:
for step in result.plan.actions:
print(step.action.name, [p.object().name for p in step.actual_parameters])
When it does not work
What you see
What it means
result.plan is None
The planner proved there is no plan. That is a result rather than an error.
A PDDLReader parse error
The file you wrote is malformed. check.py names it and skips that task.
A step whose precondition fails on replay
Your action dropped a precondition the skill declares
No such engine
The engine name is wrong, or the package is not installed
A configuration past its limit
compare.py stops it and prints timeout
Task c of the micro-project is unsolvable by design, so a traceback there is a defect in your code rather than in the planner.
Fast Downward
A progression planner based on heuristic search (Helmert, 2006)
It translates the PDDL task into a multi-valued planning task before it searches, and computes its causal graph heuristic from hierarchical decompositions of that task
It runs in configurations that have names. The engine fast-downward runs lama-first, which returns a plan without a guarantee that it is the shortest.
The engine fast-downward-opt runs A* with the LM-cut heuristic and guarantees a shortest plan
Helmert (2006), Journal of Artificial Intelligence Research 26, 191–246, for the first two lines. The configurations are not described there.
A configuration is a choice
A configuration is a choice of search and heuristic, and the choice decides what the planner guarantees. Part 3 runs four.
Configuration
Search
Shortest plan guaranteed
blind
Breadth-first
Yes, when every action costs the same
admissible
A* with \( h_{\max} \)
Yes
greedy
Greedy best-first with \( h_{\mathrm{FF}} \)
No
fast-downward
lama-first
No
What a plan is not, and the project
A plan is a sequence of skill calls
Each step is a skill with its arguments
The planner assumed that each call has its declared effects
On the robot, any call can terminate in failure, as week 2's skill model allows. The rest of the plan then rests on a state that does not hold.
Week 8 executes plans, detects the failure and repairs it.
Valid for the domain, useless for the robot
While the course's planner was being built, grasp(?obj ?place) had only the preconditions (gripper-at ?obj) and (gripper-empty)
Nothing bound ?place. The planner returned a fetch that placed the base at the drink, drove away, and reached and grasped with ?place bound to a place the robot was not at.
Adding (at ?place) and (object-at ?obj ?place) to grasp's preconditions fixed it
A replay against the same model cannot find such a gap, since it checks the plan against the preconditions that let it through.
Week 7
Week 7 adds meta-actions, fixed compositions of skills, each one action in the domain with its preconditions and effects derived from its steps
It compares plans with and without them
This week varies the search with the domain fixed. Week 7 varies the domain with the search fixed.
The micro-project
Write the domain from the six plannable skills, and the problem from the apartment's map, its belief graph and a task file
Solve four fetch tasks, and map each plan step back to a registered skill with its arguments as IRIs
A provided script replays every plan against the catalogue. One task shuts off the kitchen and has no plan.
Run four search configurations on two of the tasks, and explain what the table shows
In exercises/06-classical-planning/. Nothing in it needs Webots.
The project is marked on two things
Integration, meaning how far separately built parts have been made into one system
The understanding you can demonstrate of why your system is put together the way it is
The course page has stated both since week 1. The rest of the project's detail follows separately.