0

我目前正在从事一个 pddl 项目,但我在语法上遇到了一些困难。现在,我正试图用 forall 将一个楼层的所有工人填满电梯。我不确定这是否是正确的实现,但这是我的代码。先感谢您!

(define (domain company)

(:requirements
  :strips                 
  :negative-preconditions 
  :equality               
)

(:predicates
  (worker ?x)
  (floor ?x)
  (elevator ?x)
  (controller ?x)
  (goes ?x )
  (at ?x ?y)  
  (in ?x ?y)
  (free ?x)
  (call ?x ?y)
)

****

(:action insert_elevator
  :parameters (?w ?el ?f)
  :precondition (and (worker ?w) (floor ?f) (elevator ?el) (at ?w ?f) (at ?el ?f) (free ?el))
  :effect (and(not (free ?el))(forall (?w)(in ?w ?el)))
)

****

)



(define (problem pb)
   (:domain company)

   (:objects floorg floor1 floor2
             elevator1
             elevator2
             worker1 worker2
             controller1)

   (:init
     (floor floorg)
     (floor floor1)
     (floor floor2)
     (worker worker1)
     (worker worker2)
     (elevator elevator1)
     (elevator elevator2)
     (controller controller1)
     (at elevator1 floor1)
     (at elevator2 floor2)
     (at worker1 floorg)
     (at worker2 floorg)
     (free elevator1)
     (free elevator2)
   )

   (:goal
     (and(at worker1 floor1)
     (at worker2 floor2))
   )
 )
4

1 回答 1

1

所以显然你也在这里发布了......仍然有效的评论:

  • 您可以使用editor.planning.domains和保存的“会话”来更好地共享您的代码。(使用只读链接)
  • 你真的应该为这样的域使用类型。
  • insert_elevator动作有点乱 :
    • forall可能需要包含一个条件效应,即“如果工人在地板上,那么他们就在电梯里” 。
    • 您不应在forall子句中使用与参数中相同的变量。
于 2020-05-14T00:03:16.737 回答