Eric
Eric

Reputation: 1

PDDL doesn't compile

Trying to figure out this PDDL problem of getting robots to clean tiles but I'm stuck with what I'm doing wrong as far as I understand, I have the movements actions and clean actions only for up and down yet it still doesnt compile. It just gives me an error that says could not parse domain file.

This is the domain:

(define (domain floor-tile)

    (:requirements :typing)

    ;; We have two types: robots and the tiles, both are objects
    (:types robot tile - object)

    ;; define all the predicates as they are used in the probem files
    (:predicates  

    ;; described what tile a robot is at
    (robot-at ?r - robot ?x - tile)

    ;; indicates that tile ?x is above tile ?y
    (up ?x - tile ?y - tile)

    ;; indicates that tile ?x is below tile ?y
    (down ?x - tile ?y - tile)

    ;; indicates that tile ?x is right of tile ?y
    (right ?x - tile ?y - tile)

    ;; indicates that tile ?x is left of tile ?y
    (left ?x - tile ?y - tile)

    ;; indicates that a tile is clear (robot can move there)
    (clear ?x - tile)

    ;; indicates that a tile is cleaned
    (cleaned ?x - tile)
    )




(:action clean-up

  :parameters (?r - robot ?x - tile ?y - tile )
  :precondition (and (up ?y ?x) (robot-at ?r ?x) (clear ?y))
  :effect (and (not (clear ?y))  (cleaned ?y) 
                 
)


 (:action clean-down

  :parameters (?r - robot?x - tile ?y - tile)
  :precondition (and (down ?y ?x) (robot-at ?r ?x) (clear ?y))
  :effect (and (not (clear ?y))  (cleaned ?y) 
                
)


 
(:action up 
    :parameters (?r - robot?x - tile ?y - tile)
    :precondition (and (up ?y ?x) (robot-at ?r ?x) (clear ?y))
    :effect (and (robot-at ?r ?y) (not(robot-at ?r ?x))) 
)


(:action down 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (down ?y ?x) (robot-at ?r ?x)(clear ?y))
     :effect (and (robot-at ?r ?y) 
            (not(robot-at ?r ?x))) 
)

(:action right 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (right ?y ?x) (robot-at ?r ?x) (clear ?y))
     :effect (and (robot-at ?r ?y) 
            (not(robot-at ?r ?x)))    
)

(:action left 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (left ?y ?x) (robot-at ?r ?x) (clear ?y))
     :effect (and (robot-at ?r ?y ) 
            (not(robot-at ?r ?x)))
)
)

Here is the problem:

(define (problem prob001)
 (:domain floor-tile)
 (:objects tile_0-1 tile_0-2  
           tile_1-1 tile_1-2  
           tile_2-1 tile_2-2  - tile
           robot1 - robot
)
 (:init 
   (robot-at robot1 tile_1-1)
   (clear tile_0-1)
   (clear tile_0-2)
   (clear tile_1-2)
   (clear tile_2-1)
   (clear tile_2-2)
   (up tile_1-1 tile_0-1)
   (up tile_1-2 tile_0-2)
   (up tile_2-1 tile_1-1)
   (up tile_2-2 tile_1-2)
   (down tile_0-1 tile_1-1)
   (down tile_0-2 tile_1-2)
   (down tile_1-1 tile_2-1)
   (down tile_1-2 tile_2-2)
   (right tile_0-2 tile_0-1)
   (right tile_1-2 tile_1-1)
   (right tile_2-2 tile_2-1)
   (left tile_0-1 tile_0-2)
   (left tile_1-1 tile_1-2)
   (left tile_2-1 tile_2-2)
)
 (:goal (and
    (cleaned tile_0-1)
    (cleaned tile_0-2)
    (cleaned tile_1-1)
    (cleaned tile_2-2)
))

)

Upvotes: 0

Views: 176

Answers (1)

haz
haz

Reputation: 790

Brackets are missing on the :effect of both clean-up and clean-down. After adding those brackets, the online editor's solver indicates that the goal trivially can't be reached, but at least it parses.

Upvotes: 1

Related Questions