Classic planning problems with complete step-by-step solutions
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:
A simple problem about changing a flat tire. Perfect for understanding basic planning concepts!
Transporting cargo between Saudi cities. Illustrates multi-object, multi-location planning!
You have a flat tire on your car. You need to replace it with the spare tire.
(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) ) ) )
(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) ) )
Remove(Flat, Axle)Remove(Spare, Trunk)PutOn(Spare, Axle)Transport cargo between Saudi cities using airplanes.
(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)) ) ) )
(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) )) )
Load(C1, P1, RUH)Fly(P1, RUH, JED)Unload(C1, P1, JED)Load(C2, P2, JED)Fly(P2, JED, RUH)Unload(C2, P2, RUH)| 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) |
Break complex goals into steps
Some actions must happen before others
Track changes through the plan
Ensure all goals are met