Skip to main content
We will use the Logistics domain to illustrate how to represent a planning task in PDDL. In logistics, there are trucks and airplanes that can move packages between different airports and cities. We assume that in the initial state there is a truck in Paris airport. An airplane and two packages are in London airport. Paris has two places: south and north. The goal is to have one package in the north location and the other one in the south location.

Defining the Domain

Let’s start by defining in the file logistics.pddl the domain and its components:
  • The requirements
  • The types
  • The predicates
  • The actions or operators
First, we define the name of the domain:
logistics.pddl

Requirements

The requirements for this logistics example are:
  • strips: The actions will only use positive preconditions (predicates that must be true in the current state to trigger actions) and deterministic effects (effects that necessarily follow action triggering).
  • typing: We will use “types” like in OO programming to represent sets of objects in the world.
logistics.pddl

Types

We will use the following types:
  • Places, cities and physical objects are considered as objects
  • Packages and vehicles are physical objects
  • Trucks and airplanes are vehicles
  • Airports and locations are places
logistics.pddl

Predicates

We will use the following predicates:
  • in-city(loc, city) - true iff a place loc is in the city city
  • at(obj, loc) - true iff a physical object obj is at place loc
  • in(pkg, veh) - true iff a package pkg is in a vehicle veh
In PDDL, question marks are used for variables:
logistics.pddl

Operators

We define the operators (actions) of the logistics domain. The domain has 6 operators: load-truck, load-airplane, unload-truck, unload-airplane, drive-truck and fly-airplane.

Load Truck

To load a truck, we need a package and a truck at the same place. The effect is that the package is now in the truck and no longer at the location.
logistics.pddl

Load Airplane

logistics.pddl

Unload Truck

logistics.pddl

Unload Airplane

logistics.pddl

Fly Airplane

logistics.pddl

Drive Truck

logistics.pddl
Action preconditions and effects can be more complex:
  • Quantified: (forall (?v1 ... ?vn) <effect>) requires the :adl requirement
  • Conditional: (when <condition> <effect>)
  • Actions can also have costs, duration, and time constraints

Defining the Problem

Now let’s define in the file problem.pddl the problem instance:
problem.pddl

Objects

problem.pddl

Initial State

The initial state is a set of ground predicates (all variables bound to objects). Facts not listed are assumed false:
problem.pddl

Goal Description

The goal is to have package p1 at north and package p2 at south:
problem.pddl

Solution

Running a PDDL planner produces the following plan:
Plan Output