PDDL中Link和Path之间的区别是什么?

时间:2018-01-31 22:16:49

标签: artificial-intelligence planning pddl

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

路径和链接之间的区别是什么?我试图创建一个类似的问题,但省略了路径,我不断得到无法解决的问题。如何正确定义路径?

谢谢!

1 个答案:

答案 0 :(得分:1)

这些是用户定义的谓词:

(define (domain driverlog)
  ...
  (:predicates 
        ...
        (link ?x ?y - location) (path ?x ?y - location)
        ...
  )
 )

因此可以通过检查相应的模型推断出它们的语义。

linkpath都是二元谓词,与两个位置相关,可能是因为它可以从一个地方到另一个。此连接是单向的。

我从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)

由于s0s2之间的唯一连接是链接,因此驱动程序无法到达卡车(反之亦然)。这是因为DRIVE-TRUCK的前提条件是(driving ?driver ?truck),如果驱动程序位于卡车的同一位置,则仅由BOARD-TRUCK设置。

您可以通过在s0s2之间创建路径来解决此问题。但是,这似乎违反了模型的命名约定,该约定仅使用链接互连sX。更好的解决方案是更改初始状态并将卡车放在每个驱动程序的相同位置,或至少放在WALK操作可到达的位置。