pddl

PDDL planner does not recognize types


I wrote a pddl code in a domain file that describes kitchen environment (eggs, coffee, receptacles, surfaces etc.) thus types were defined in hierarchical manner.

(define (domain robochef)

(:requirements :adl :strips :fluents :typing)

(:types 
    locatable surface - object
    cookable receptacle - locatable
    food liquid - cookable
    mug pan plate coffeeMachine - receptacle
    egg - food
    coffee water - liquid
    table - surface 
)

(:constants
    ROBOT
)

The predicates of this domain may be dependent on some of the types:

    (is-at ?y ?x) ;true iff an object ?y is in front of an object ?x
    (is-visible ?x ?r - ROBOT) ;true iff the object visible by the robot
    (is-held ?x ?r - ROBOT) ;true iff the robot holds ?x
    (contains ?y - receptacle ?x) ;true iff ?x is contained in ?y
    (on ?y - surface ?x - locatable) ;true iff ?x is on top of ?y
    (is-cooked ?x - cookable) ;true iff ?x is cooked
    (is-egg-cracked ?e - egg) ;true iff ?x is cracked
    (is-coffeMachine-available ?cm - coffeeMachine) ;true iff the coffee machine is free use
)

Running solver.planning.domains planner on this code resulted in errors of the format "predicate [X] is declared to use unknown or empty type [Y]". More in detail - the output was:

predicate IS-COFFEMACHINE-AVAILABLE is declared to use unknown or empty type COFFEEMACHINE


predicate IS-EGG-CRACKED is declared to use unknown or empty type EGG


predicate IS-COOKED is declared to use unknown or empty type COOKABLE


predicate ON is declared to use unknown or empty type SURFACE


predicate OCCUPIED is declared to use unknown or empty type RECEPTACLE


predicate CONTAINS is declared to use unknown or empty type RECEPTACLE


predicate IS-HELD is declared to use unknown or empty type ROBOT


predicate IS-VISIBLE is declared to use unknown or empty type ROBOT


Failed to parse the problem -- The types found in the problem file must be a subset of the types listed in the domain file
Domain types: set(['plate', 'coffee', 'coffeemachine', 'liquid', 'food', 'receptacle', 'object', 'locatable', 'surface', 'water', 'mug', 'table', 'cookable', 'egg', 'pan'])
Problem types: set(['default_object'])


predicate IS-COFFEMACHINE-AVAILABLE is declared to use unknown or empty type COFFEEMACHINE


predicate IS-EGG-CRACKED is declared to use unknown or empty type EGG


predicate IS-COOKED is declared to use unknown or empty type COOKABLE


predicate ON is declared to use unknown or empty type SURFACE


predicate OCCUPIED is declared to use unknown or empty type RECEPTACLE


predicate CONTAINS is declared to use unknown or empty type RECEPTACLE


predicate IS-HELD is declared to use unknown or empty type ROBOT


predicate IS-VISIBLE is declared to use unknown or empty type ROBOT

How come the types are explicitly written but not recognized?


Solution

  • You are missing the type ROBOT. Instead, you have defined a constant named ROBOT with no type specification; it is therefore defaulted to object.

    Try with:

    (:types 
        locatable surface ROBOT - object
        cookable receptacle - locatable
        food liquid - cookable
        mug pan plate coffeeMachine - receptacle
        egg - food
        coffee water - liquid
        table - surface 
    )
    
    (:constants
        self - ROBOT
    )
    

    And make sure that if ROBOT is used elsewhere in your domain to refer to the constant (and not the type), you replace it with self.