为什么我的 PDDL 没有编译?解析错误

Why isn't my PDDL compiling? Parsing error

我是 PDDL 的新手,我正在尝试解决机器人清洁器问题,但我不明白为什么我会遇到这个问题。

reading input... [t=0s] Simplifying transitions... done! done reading input! [t=0s] building causal graph...done! [t=0s] packing state variables...done! [t=0s] Variables: 1 Facts: 2 Bytes per state: 4 done initalizing global data [t=0s] Conducting best first search with reopening closed nodes, (real) bound = 2147483647 Initializing FF heuristic... Initializing additive heuristic... Simplifying 0 unary operators... done! [0 unary operators] Initial state is a dead end. Completely explored state space -- no solution! Actual search time: 0s [t=0s] Expanded 0 state(s). Reopened 0 state(s). Evaluated 1 state(s). Evaluations: 1 Generated 0 state(s). Dead ends: 0 state(s). Number of registered states: 1 Search time: 0s Total time: 0s Search stopped without finding a solution. Peak memory: 2936 KB

    (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 clear

          :parameters (?r - robot?x - tile ?y - tile)

          :precondition (and (robot-at ?r ?x) (clear ?x))

          :effect (when (cleaned ?x) (not(clear ?x)))
    )


    (:action clean-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 clean-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 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)))
    )
    )

问题:


    (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)
    ))

    )

没有仔细查看所有内容,但您的 PDDL 有一些明显的问题可以解决。例如,

  • and 和下一个元素之间保留一个 space(即 (and(pred 可能会导致错误)
  • 确保保留中缀符号。这将是一个错误:(when and(cleaned ?x) (not(clear ?x)))。正确的形式应该是 (when (and (cleaned ?x)) (not(clear ?x))),甚至更好,(when (cleaned ?x) (not(clear ?x)))

问题无法解决,因为瓷砖永远无法清洁。

如果您查看这些操作的效果,none 个操作会导致清洁瓷砖。所以这个目标是无法实现的。我假设您对 clearclean 谓词感到困惑?