2017-09-01 14 views
0

我是新来的PDDL,我一直在尝试blocksworld问题,但我得到了错误:PDDL错误编译

Failed to parse the problem -- Not args must be a list with only one element, got [Primitive sobre (default_object ?obj, default_object ?obj2), Primitive libre (default_object ?obj3), Primitive en (default_object ?obj, default_object ?from)] /tmp/solver_planning_domains_tmp_4BmsZdP37zJXS/domain.pddl: syntax error in line 16, '(': domain definition expected

我的文件是这些:

(define (domain blocly) 
    (:predicates (espacio ?e) 
     (ficha ?t) 
     (sobre ?t ?t) 
     (en ?t ?e) 
     (vacio ?e) 
     (libre ?t)) 


    (:action movefichaficha 
     :parameters (?ficha ?ficha2 ?ficha3 ?from ?to) 
     :precondition (and (ficha ?ficha) (ficha ?ficha2) (ficha ?ficha3) (espacio ?from) (espacio ?to) 
        (sobre ?ficha ?ficha2) (libre ?ficha) (libre ?ficha3) (en ?ficha ?from) (en ?ficha2 ?from) 
        (en ?ficha3 ?to)) 
     :effect (and (sobre ?ficha ?ficha3) (en ?ficha ?to) (libre ?ficha2) 
       (not (sobre ?ficha ?ficha2) (libre ?ficha3) (en ?ficha ?from)))) 

    (:action movefichaesp 
     :parameters (?ficha ?ficha2 ?from ?to) 
     :precondition (and (ficha ?ficha) (ficha ?ficha2) (espacio ?from) (espacio ?to) 
        (sobre ?ficha ?ficha2) (vacio ?to) (en ?ficha ?from) (en ?ficha2 ?from)) 
     :effect (and (libre ?ficha2) (en ?ficha ?to) (arriba ?ficha ?to) 
       (not (vacio ?to) (en ?ficha ?from) (sobre ?ficha ?ficha2)))) 

    (:action moveoespficha 
     :parameters (?ficha ?ficha2 ?from ?to) 
     :precondition (and (ficha ?ficha) (ficha ?ficha2) (espacio ?from) (espacio ?to) 
        (libre ?ficha) (libre ?ficha2) (en ?ficha ?from) (en ?ficha ?to)()) 
     :effect (and (vacio ?from) (en ?ficha ?to) (sobre ?ficha ?ficha2) 
      (not (libre ?ficha2) (en ?ficha ?from) (en ?ficha ?from))))) 

这些:

(define (problem blockly-world) 
    (:domain blocly) 
    (:objects t1 t2 t3 e1 e2 e3) 
    (:init (ficha t1) 
      (ficha t2) 
      (ficha t3) 
      (espacio e1) 
      (espacio e2) 
      (espacio e3) 
      (sobre t3 t2) 
      (sobre t2 t1) 
      (en t1 e1) 
      (en t2 e1) 
      (en t3 e1) 
      (libre t3) 
      (vacio e2) 
      (vacio e3)) 
    (:goal (and (sobre t1 t2) 
       (sobre t2 t3))) 

回答

0

源代码中有许多问题。

  • 问题文件缺乏最终)

  • 一元not逻辑运算符使用不当,例如

    (not (vacio ?to) (en ?ficha ?from) (sobre ?ficha ?ficha2)) 
    

    应该被重写为

    (not (vacio ?to)) 
    (not (en ?ficha ?from)) 
    (not (sobre ?ficha ?ficha2)) 
    
  • 域文件使用一个未申报谓词,arriba。由于它具有en的相同定义 - (:init ...)块中没有提及 - 我不确定这是否是由于将arriba重命名为en而忘记更改它的最后一次出现或不是。以防万一它不是错误,您可以通过将

    (arriba ?t ?e) 
    

    添加到谓词列表中。您应该自行检查是否需要向问题文件中的(:init ...)块添加内容。


下面,你可以找到一个适当的缩进版本有足够的修复了前两个发现的问题的源代码,并试图解决的第三个问题:

块状-prob.pddl:

(define (problem blockly-world) 
    (:domain blocly) 
    (:objects t1 t2 t3 e1 e2 e3) 
    (:init 
      (ficha t1) 
      (ficha t2) 
      (ficha t3) 
      (espacio e1) 
      (espacio e2) 
      (espacio e3) 
      (sobre t3 t2) 
      (sobre t2 t1) 
      (en t1 e1) 
      (en t2 e1) 
      (en t3 e1) 
      (libre t3) 
      (vacio e2) 
      (vacio e3) 
    ) 
    (:goal (and 
       (sobre t1 t2) 
       (sobre t2 t3) 
     ) 
    ) 
) 

块domain.pddl:

(define (domain blocly) 
    (:predicates 
     (espacio ?e) 
     (ficha ?t) 
     (sobre ?t ?t) 
     (en ?t ?e) 
     (arriba ?t ?e) 
     (vacio ?e) 
     (libre ?t) 
    ) 

    (:action movefichaficha 
     :parameters (?ficha ?ficha2 ?ficha3 ?from ?to) 
     :precondition 
      (and 
       (ficha ?ficha) 
       (ficha ?ficha2) 
       (ficha ?ficha3) 
       (espacio ?from) 
       (espacio ?to) 
       (sobre ?ficha ?ficha2) 
       (libre ?ficha) 
       (libre ?ficha3) 
       (en ?ficha ?from) 
       (en ?ficha2 ?from) 
       (en ?ficha3 ?to) 
      ) 
     :effect 
      (and 
       (sobre ?ficha ?ficha3) 
       (en ?ficha ?to) 
       (libre ?ficha2) 
       (not (sobre ?ficha ?ficha2)) 
       (not (libre ?ficha3)) 
       (not (en ?ficha ?from)) 
      ) 
    ) 

    (:action movefichaesp 
     :parameters (?ficha ?ficha2 ?from ?to) 
     :precondition 
      (and 
       (ficha ?ficha) 
       (ficha ?ficha2) 
       (espacio ?from) 
       (espacio ?to) 
       (sobre ?ficha ?ficha2) 
       (vacio ?to) 
       (en ?ficha ?from) 
       (en ?ficha2 ?from) 
      ) 
     :effect 
      (and 
       (libre ?ficha2) 
       (en ?ficha ?to) 
       (arriba ?ficha ?to) 
       (not (vacio ?to)) 
       (not (en ?ficha ?from)) 
       (not (sobre ?ficha ?ficha2)) 
      ) 
    ) 

    (:action moveoespficha 
     :parameters (?ficha ?ficha2 ?from ?to) 
     :precondition 
      (and 
       (ficha ?ficha) 
       (ficha ?ficha2) 
       (espacio ?from) 
       (espacio ?to) 
       (libre ?ficha) 
       (libre ?ficha2) 
       (en ?ficha ?from) 
       (en ?ficha ?to) 
      ) 
     :effect 
      (and 
       (vacio ?from) 
       (en ?ficha ?to) 
       (sobre ?ficha ?ficha2) 
       (not (libre ?ficha2)) 
       (not (en ?ficha ?from)) 
       (not (en ?ficha ?from)) 
      ) 
    ) 
) 

该代码是正确PDDL我的机器,其也发现的溶液上解析求解器fast-downward.py。既然我不知道你想要建模什么,我无法验证它是否符合你想要的模型。


注:即使你刚开始学习的个人原因,考虑让使用为您的谓词,对象和变量英语名字的习惯。此外,考虑缩减源代码并恰当地描述你正在处理的情况具有吸引你的问题和答案的双重好处。

+0

谢谢!我回家后会试试看。对不起新手的错误。我会确保从这里学习:) – Jamidd