PDDL文件未编译

时间:2019-05-02 15:58:11

标签: pddl

我想演示使用PDDL的推箱子游戏。 我写了代码,但是没有编译。 这是我的文件:

(define (domain sokoban)
    (:predicates (Worker ?x)
        (Box ?x)
        (isLeft?x ?y)
        (isDown?x ?y)
        (at ?x ?y)
        (clear ?x)
    (:action moveLeft
        :parameters (?Worker ?x ?y)
        :precondition (and (Worker ?Worker)
                            (at ?Worker ?x)
                            (isLeft ?y ?x)
                            (clear ?y))
        :effect (and (at ?Worker ?y) (clear ?x)
                    (not (at ?Worker ?x)) (not (clear ?y))))
    (:action moveRight
        :parameters (?Worker ?x ?y)
        :precondition (and (Worker ?Worker)
                            (at ?Worker ?x)
                            (isLeft ?x ?y)
                            (clear ?y))
        :effect (and (at ?Worker ?y) (clear ?x)
                    (not (at ?Worker ?x)) (not (clear ?y))))
    (:action moveUp
        :parameters (?Worker ?x ?y)
        :precondition (and (Worker ?Worker)
                            (at ?Worker ?x)
                            (isDown ?y ?x)
                            (clear ?y))
        :effect (and (at ?Worker ?y) (clear ?x)
                    (not (at ?Worker ?x)) (not (clear ?y))))
    (:action moveDown
        :parameters (?Worker ?x ?y)
        :precondition (and (Worker ?Worker)
                            (at ?Worker ?x)
                            (isDown ?x ?y)
                            (clear ?y))
        :effect (and (at ?Worker ?y) (clear ?x)
                    (not (at ?Worker ?x)) (not (clear ?y))))
    (:action pushLeft
        :parameters (?Worker ?x ?y ?z ?Box)
        :precondition (and (Worker ?Worker)
                            (Box ?Box)
                            (isLeft ?y ?x)
                            (isLeft ?z ?y)
                            (at ?Worker ?x)
                            (at ?Box ?y)
                            (clear ?z))
        :effect (and (at ?Worker ?y) (at ?Box ?z)
                    (clear ?x)
                    (not (at ?Worker ?x))
                    (not (at ?Box ?y))
                    (not (clear ?z))
                    (not (clear ?y))))
    (:action pushRight
        :parameters (?Worker ?x ?y ?z ?Box)
        :precondition (and (Worker ?Worker)
                            (Box ?Box)
                            (isLeft ?x ?y)
                            (isLeft ?y ?z)
                            (at ?Worker ?x)
                            (at ?Box ?y)
                            (clear ?z))
        :effect (and (at ?Worker ?y) (at ?Box ?z)
                    (clear ?x)
                    (not (at ?Worker ?x))
                    (not (at ?Box ?y))
                    (not (clear ?z))
                    (not (clear ?y))))
    (:action pushDown
        :parameters (?Worker ?x ?y ?z ?Box)
        :precondition (and (Worker ?Worker)
                            (Box ?Box)
                            (isDown ?y ?x)
                            (isDown ?z ?y)
                            (at ?Worker ?x)
                            (at ?Box ?y)
                            (clear ?z))
        :effect (and (at ?Worker ?y) (at ?Box ?z)
                    (clear ?x)
                    (not (at ?Worker ?x))
                    (not (at ?Box ?y))
                    (not (clear ?z))
                    (not (clear ?y))))
    (:action pushUp
        :parameters (?Worker ?x ?y ?z ?Box)
        :precondition (and (Worker ?Worker)
                            (Box ?Box)
                            (isDown ?x ?y)
                            (isDown ?y ?z)
                            (at ?Worker ?x)
                            (at ?Box ?y)
                            (clear ?z))
        :effect (and (at ?Worker ?y) (at ?Box ?z)
                    (clear ?x)
                    (not (at ?Worker ?x))
                    (not (at ?Box ?y))
                    (not (clear ?z))
                    (not (clear ?y))))
))

(define (problem test)
    (:domain sokoban)
    (:objects W,B1,B2,B3,B4,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12)
    (:init (Worker W)
            (Box B1)
            (Box B2)
            (Box B3)
            (Box B4)

            (isDown l2 l1)
            (isDown l3 l2)
            (isLeft l3 l4)
            (isLeft l4 l5)
            (isLeft l5 l6)
            (isLeft l7 l8)
            (isLeft l8 l9)
            (isLeft l9 l10)
            (isDown l9 l3)
            (isDown l10 l4)
            (isDown l11 l10)
            (isDown l12 l11)
            (at B1 l3)
            (at B2 l5)
            (at B3 l9)
            (at B4 l11)
            (at W l10)
            (clear l1)
            (clear l2)
            (clear l4)
            (clear l6)
            (clear l7)
            (clear l8)
            (clear l12))
    (:goal (and 
            (at B1 l1)
            (at B2 l6)
            (at B3 l7)
            (at B4 l12))))

我得到的错误是:

  

可能超时。

     

/tmp/solver_planning_domains_tmp_491MKeRINWIiT/domain.pddl:语法   第8行中的错误:“:action”:需要域定义

我是PDDL的新手,由于我缺乏经验,我认为这是一个简单的错误,但我无法在互联网上找到解释。 我正在使用http://editor.planning.domains/编写和编译代码。

1 个答案:

答案 0 :(得分:-1)

您尚未关闭“谓词”括号。