Today in class, we will look at a classical planning algorithms that use a language for defining plans called PDDL (Planning Domain Definition Language). PDDL and classic planning are all defined in the Russell and Norvig textbook AI A Modern Approach, in chapter 11. I also recommend this tutorial by Kory Becker: Artificial Intelligence Planning with STRIPS, A Gentle Introduction. She has an online demo that lets you upload your own PDDL-specified problems, and find solutions to them.
We will use this Python library:
In PDDL, we can define action schema to represent actions. Here is an example of an action schema for flying a plane from one location to another:
(:action fly
:parameters (?p - plane ?from - airport ?to - airport)
:precondition (and (plane ?p) (airport ?from) (airport ?to) (at ?p ?from))
:effect (and (at ?p ?to)) (not (at ?p ?from)))
)
This defines an action called fly, which takes 3 arguments: a plane p, a starting airport from and a destination airport to. In order for this action to be applied, several preonditions must be satisified:
Once the action is applied, then it has the effect of changing several states in the world.
In general, a schema consists of:
Note: The enforcement of argument types like (plane ?p)
can be left out of the action schema if we specify types in the domain PDDL file.
move-item-to-location
go-fishing
feed-troll
If you’ve got extra time, you’re welcome to work on PDDL definitions for other parts of the Action Castle game.