Back to Lecture 9

Planning Problems and Examples

Classic planning problems with complete step-by-step solutions

Understanding Planning Through Examples

Why Study Classic Planning Problems?

Classic planning problems help us understand the fundamental concepts of automated planning through concrete, relatable examples.

We'll explore two canonical problems that illustrate key planning principles:

Spare Tire Problem

A simple problem about changing a flat tire. Perfect for understanding basic planning concepts!

Air Cargo Transport

Transporting cargo between Saudi cities. Illustrates multi-object, multi-location planning!

2
Complete Problems
3
Representations
Learning Insights

Problem 1: The Spare Tire Problem

Problem Statement

You have a flat tire on your car. You need to replace it with the spare tire.

Initial State:
  • Flat tire is on the axle
  • Spare tire is in the trunk
Goal State:
  • Spare tire is on the axle
STRIPS Representation
Initial State:
At(Flat, Axle) At(Spare, Trunk)
Goal:
At(Spare, Axle)
Actions:
Remove(obj, loc)
Precond: At(obj, loc)
Effect:
+ At(obj, Ground)
− At(obj, loc)
PutOn(tire, axle)
Precond: At(tire, Ground)
Effect:
+ At(tire, Axle)
− At(tire, Ground)
PDDL Representation
Domain File (tire-domain.pddl)
(define (domain spare-tire)
  (:requirements :strips)
  
  (:predicates
    (at ?obj ?loc)
  )
  
  (:action remove
    :parameters (?obj ?loc)
    :precondition (at ?obj ?loc)
    :effect (and
      (not (at ?obj ?loc))
      (at ?obj ground)
    )
  )
  
  (:action put-on
    :parameters (?tire)
    :precondition (at ?tire ground)
    :effect (and
      (not (at ?tire ground))
      (at ?tire axle)
    )
  )
)
Problem File (tire-problem.pddl)
(define (problem tire-change)
  (:domain spare-tire)
  
  (:objects
    flat spare - tire
    axle trunk ground - location
  )
  
  (:init
    (at flat axle)
    (at spare trunk)
  )
  
  (:goal
    (at spare axle)
  )
)
Step-by-Step Solution
0
Initial State
At(Flat, Axle) At(Spare, Trunk)
Starting configuration
Remove(Flat, Axle)
Why? We need to remove the flat tire first
1
After Remove(Flat, Axle)
At(Flat, Axle) At(Flat, Ground) At(Spare, Trunk)
Flat tire on ground
Remove(Spare, Trunk)
Why? Get the spare tire out
2
After Remove(Spare, Trunk)
At(Flat, Ground) At(Spare, Trunk) At(Spare, Ground)
Both tires on ground
PutOn(Spare, Axle)
Why? Install the spare tire!
3
Goal State Reached!
At(Flat, Ground) At(Spare, Ground) At(Spare, Axle) ⭐
Goal achieved!
Solution Summary
3
Total Actions
4
States Visited
3
Plan Length
100%
Success Rate
Optimal Plan:
  1. Remove(Flat, Axle)
  2. Remove(Spare, Trunk)
  3. PutOn(Spare, Axle)

Problem 2: Saudi Air Cargo Transport

Problem Statement

Transport cargo between Saudi cities using airplanes.

Initial State:
  • Cargo C1 is in Riyadh
  • Cargo C2 is in Jeddah
  • Plane P1 is in Riyadh
  • Plane P2 is in Jeddah
Goal State:
  • Cargo C1 is in Jeddah
  • Cargo C2 is in Riyadh
Locations: Riyadh (RUH), Jeddah (JED), Dammam (DMM)
STRIPS Representation
Initial State:
At(C1, RUH) At(C2, JED) At(P1, RUH) At(P2, JED)
Goal:
At(C1, JED) At(C2, RUH)
Actions:
Load(c, p, loc)
Precond:
At(c, loc), At(p, loc)
Effect:
+ In(c, p)
− At(c, loc)
Unload(c, p, loc)
Precond:
In(c, p), At(p, loc)
Effect:
+ At(c, loc)
− In(c, p)
Fly(p, from, to)
Precond:
At(p, from)
Effect:
+ At(p, to)
− At(p, from)
PDDL Representation
Domain File (cargo-domain.pddl)
(define (domain air-cargo)
  (:requirements :strips :typing)
  
  (:types
    cargo plane airport
  )
  
  (:predicates
    (at ?obj ?loc)
    (in ?cargo ?plane)
  )
  
  (:action load
    :parameters (?c - cargo
                 ?p - plane
                 ?loc - airport)
    :precondition (and
      (at ?c ?loc)
      (at ?p ?loc)
    )
    :effect (and
      (in ?c ?p)
      (not (at ?c ?loc))
    )
  )
  
  (:action unload
    :parameters (?c - cargo
                 ?p - plane
                 ?loc - airport)
    :precondition (and
      (in ?c ?p)
      (at ?p ?loc)
    )
    :effect (and
      (at ?c ?loc)
      (not (in ?c ?p))
    )
  )
  
  (:action fly
    :parameters (?p - plane
                 ?from - airport
                 ?to - airport)
    :precondition (at ?p ?from)
    :effect (and
      (at ?p ?to)
      (not (at ?p ?from))
    )
  )
)
Problem File (cargo-problem.pddl)
(define (problem cargo-saudi)
  (:domain air-cargo)
  
  (:objects
    c1 c2 - cargo
    p1 p2 - plane
    ruh jed dmm - airport
  )
  
  (:init
    ;; Initial cargo locations
    (at c1 ruh)
    (at c2 jed)
    
    ;; Initial plane locations
    (at p1 ruh)
    (at p2 jed)
  )
  
  (:goal (and
    (at c1 jed)
    (at c2 ruh)
  ))
)
Step-by-Step Solution
0
Initial State
Cargo:
At(C1, RUH) At(C2, JED)
Planes:
At(P1, RUH) At(P2, JED)
Load(C1, P1, RUH)
Why? Load C1 onto P1 in Riyadh
1
After Load(C1, P1, RUH)
Cargo:
At(C1, RUH) In(C1, P1) At(C2, JED)
Planes:
At(P1, RUH) At(P2, JED)
Fly(P1, RUH, JED)
Why? Fly P1 (with C1) to Jeddah
2
After Fly(P1, RUH, JED)
Cargo:
In(C1, P1) At(C2, JED)
Planes:
At(P1, RUH) At(P1, JED) At(P2, JED)
Unload(C1, P1, JED)
Why? Unload C1 in Jeddah (first goal!)
3
After Unload(C1, P1, JED) - Goal 1 Achieved! ⭐
Cargo:
In(C1, P1) At(C1, JED) ⭐ At(C2, JED)
Planes:
At(P1, JED) At(P2, JED)
Load(C2, P2, JED)
Why? Load C2 onto P2 in Jeddah
4
After Load(C2, P2, JED)
Cargo:
At(C1, JED) ⭐ At(C2, JED) In(C2, P2)
Planes:
At(P1, JED) At(P2, JED)
Fly(P2, JED, RUH)
Why? Fly P2 (with C2) to Riyadh
5
After Fly(P2, JED, RUH)
Cargo:
At(C1, JED) ⭐ In(C2, P2)
Planes:
At(P1, JED) At(P2, JED) At(P2, RUH)
Unload(C2, P2, RUH)
Why? Unload C2 in Riyadh (second goal!)
6
All Goals Reached!
Cargo:
At(C1, JED) ⭐ In(C2, P2) At(C2, RUH) ⭐
Planes:
At(P1, JED) At(P2, RUH)
Solution Summary
6
Total Actions
7
States Visited
6
Plan Length
2
Goals Achieved
Optimal Plan:
  1. Load(C1, P1, RUH)
  2. Fly(P1, RUH, JED)
  3. Unload(C1, P1, JED)
  4. Load(C2, P2, JED)
  5. Fly(P2, JED, RUH)
  6. Unload(C2, P2, RUH)

Key Insights from These Examples

What We Learned
  • Problem Formulation: Clear initial state, goal, and actions
  • Sequential Reasoning: Actions build on each other
  • State Transitions: Each action changes the world
  • Goal Achievement: Plans satisfy all goal conditions
  • Scalability: From simple (tire) to complex (cargo)
Comparing the Problems
Spare Tire Air Cargo
Objects 2 tires, 3 locations 2 cargo, 2 planes, 3 cities
Actions 2 types (Remove, PutOn) 3 types (Load, Unload, Fly)
Plan Length 3 steps 6 steps
Complexity Simple (linear) Moderate (parallel possible)
Planning Principles Illustrated
Decomposition

Break complex goals into steps

Dependencies

Some actions must happen before others

State Management

Track changes through the plan

Goal Satisfaction

Ensure all goals are met