在PDDL的driverlog域中,我们指定了链接和路径。
(define (domain driverlog)
(:requirements :typing)
(:types location locatable - object
driver truck obj - locatable
)
(:predicates
(at ?obj - locatable ?loc - location)
(in ?obj1 - obj ?obj - truck)
(driving ?d - driver ?v - truck)
(link ?x ?y - location) (path ?x ?y - location)
(empty ?v - truck)
)
它在问题中定义的方式是:
(define (problem DLOG-2-2-2)
(:domain driverlog)
(:objects
driver1 - driver
driver2 - driver
truck1 - truck
truck2 - truck
package1 - obj
package2 - obj
s0 - location
s1 - location
s2 - location
p1-0 - location
p1-2 - location
)
(:init
(at driver1 s2)
(at driver2 s2)
(at truck1 s0)
(empty truck1)
(at truck2 s0)
(empty truck2)
(at package1 s0)
(at package2 s0)
(path s1 p1-0)
(path p1-0 s1)
(path s0 p1-0)
(path p1-0 s0)
(path s1 p1-2)
(path p1-2 s1)
(path s2 p1-2)
(path p1-2 s2)
(link s0 s1)
(link s1 s0)
(link s0 s2)
(link s2 s0)
(link s2 s1)
(link s1 s2)
)
路径和链接之间的区别是什么?我试图创建一个类似的问题,但省略了路径,我不断得到无法解决的问题。如何正确定义路径?
谢谢!
答案 0 :(得分:1)
这些是用户定义的谓词:
(define (domain driverlog)
...
(:predicates
...
(link ?x ?y - location) (path ?x ?y - location)
...
)
)
因此可以通过检查相应的模型推断出它们的语义。
link
和path
都是二元谓词,与两个位置相关,可能是因为它可以从一个地方到另一个。此连接是单向的。
我从source code读到,定义了以下行动:
(:action DRIVE-TRUCK
:parameters
(?truck
?loc-from
?loc-to
?driver)
:precondition
(and (TRUCK ?truck) (LOCATION ?loc-from) (LOCATION ?loc-to) (DRIVER ?driver)
(at ?truck ?loc-from)
(driving ?driver ?truck) (link ?loc-from ?loc-to))
:effect
(and (not (at ?truck ?loc-from)) (at ?truck ?loc-to)))
(:action WALK
:parameters
(?driver
?loc-from
?loc-to)
:precondition
(and (DRIVER ?driver) (LOCATION ?loc-from) (LOCATION ?loc-to)
(at ?driver ?loc-from) (path ?loc-from ?loc-to))
:effect
(and (not (at ?driver ?loc-from)) (at ?driver ?loc-to)))
因此,如果可以DRIVE-TRUCK
从一个地方到另一个地方,并且两个地点的路径,则两个地点似乎有链接可以WALK
从一个地方到另一个地方。
没有什么可说的。
您持续获得UNSAT
的原因是因为您将司机和卡车放置在两个不同的位置:
(at driver1 s2)
(at driver2 s2)
(at truck1 s0)
(at truck2 s0)
由于s0
和s2
之间的唯一连接是链接,因此驱动程序无法到达卡车(反之亦然)。这是因为DRIVE-TRUCK
的前提条件是(driving ?driver ?truck)
,如果驱动程序位于卡车的同一位置,则仅由BOARD-TRUCK
设置。
您可以通过在s0
和s2
之间创建路径来解决此问题。但是,这似乎违反了模型的命名约定,该约定仅使用链接互连sX
。更好的解决方案是更改初始状态并将卡车放在每个驱动程序的相同位置,或至少放在WALK
操作可到达的位置。