The object of this class is to familiarize oneself with PDDL (Planning Domain Definition Language) — the standardized notation for representation of planning problems.
Before starting this class it is recommended to do all the exercises from previous class (Automated Planning 101). This class further develops this subject and will refer to the solution of the blocks world problem using STRIPS planner.
Due to the COVID-19 outbreak, all files related to this class are stored in the Gitlab repository. This class uses files stored in the 01_pddl
folder. Please refer to the Readme.md
on how to submit the solutions.
PDDL is designed to introduce uniform knowledge representation for the automated planning problems. The domain of a problem and its particular instances are separated from solvers, which are supposed to find a sequence of actions leading from given initial state to the goal state. Representation of a problem in PDDL consists of two files:
PDDL uses prefix notation, inspired by LISP (so-called S-expressions). In brief: every expression of the form (f a1 a2 a3)
should be interpreted as f(a1, a2, a3)
, e.g. (= ?x (+ 3 2))
is equivalent to 5 = 3 + 2
. Element of S-expression preceded by a question mark (e.g. ?x
) represents a variable, whereas the brackets group a function name with its arguments. In particular, the whole LISP program constitutes a S-expression — which ensures easy parsing of a file and processing of code (useful for metaprogramming).
The PDDL-file describing the domain of a problem consists of:
(define (domain <name>) …)
(:requirements <requirement1> <requirement2>)
. Some examples of such constructions are as follows::typing
enables grouping objects into categories :equality
checks if two names refer to the same object:strips
ensures support for describing problems according to STRIPS representation:adl
means that given domain exceeds capabilities of the STRIPS representation and uses ADL features:predicate (are_linked ?x ?y)
< predicate2> …)(:action …)
. Every action is defined using::parameters (?x ?y)
:preconditions (<condition>)
:effects (?effect1, ?effect2)
Please complete this model with three missing actions. You can refer to the definition of the blocks world problem, written using Prolog (see: preliminaries).
(define (domain blocksworld) (:requirements :strips) ; STRIPS required (:predicates (on ?x ?y) ; block ?x is on block ?y (ontable ?x) ; block ?x on the table (clear ?x) ; no block is on block ?x (handempty) ; robot’s arm is empty (holding ?x) ; robot’s arm is holding ?x ) (:action pick-up ; action „pick up from the table” :parameters (?block) :precondition (and (clear ?block) (ontable ?block) (handempty)) :effect (and (not (ontable ?block)) (not (clear ?block)) (not (handempty)) (holding ?block))) ; action „put on the table” ; action „put block A on block B” ; action „take block A off block B” )
The second PDDL file describes a specific problem instance and it consists of five sections:
(define (problem <name>) … )
(:domain <domain>)
(:objects a1 a2 a3 …)
(:init (predicate argument) …)
(:goal (predicate argument))
Please rewrite into PDDL two more difficult examples from the Prolog implementation of STRIPS (see: preliminaries), using the example given below:
(define (problem easy) (:domain blocksworld) (:objects a b c) (:init (ontable a) (ontable b) (ontable c) (clear a) (clear b) (clear c) (handempty)) (:goal (and (on b c) (on a b))) )
If you’re using a laptop in C2 316 classroom, Fast Forward solver should be already installed and added to PATH. It is then sufficient to run ff
in the console.
ff
(i.e. ff-win64.exe
on Windows 64bit) to solve problems defined in previous assignments. Also the 01_pddl
folder contains files related to this class. The solver is started by the command:./ff -s 0 -o <path to file with domain> -f <path to file with problem instance>
If you use your own laptop, or just love web based technologies, you can use online IDE instead,
By adding :typing
to the :requirements
section you can expand PDDL capabilities to add types to existing objects, or parameters to actions. This way you can easily eliminate a large number of illegal actions.
Types are defined after :requirements
section by adding: (:types name1 name2 …)
for types named name1
, name2
, etc. Then, each predicate and action parameter must be given appropriate annotation specifying its type, for example: ?x – type
means that the parameter ?x must be of type type
in the given action or predicate
Similarly, in defining problem instance, each object must be given appropriate annotation (- typename
) specifying its type.
Please complete blocks world file with annotation and test if everything still works.
As we have already tested the representation of blocks world problem, please generalise this problem by adding two additional elements:
Comments:
The STRIPS representation is very limited and, in order to expand actions conditions with new constructions, one should add additional requirement :adl
in :requirements
section. ADL differs from STRIPS in, among others:
(forall (?x1 ?x1 …) <condition>)
, (exists (?x1 ?x2 …) <condition>)
(not <condition>)
(or <condition1> <condition2>)
Eliminate clear
from the definition of blocks world domain using ADL.