Search code examples
artificial-intelligenceplanningpddl

What's the difference between Link and Path in PDDL?


In the driverlog domain in PDDL we have specified links and paths.

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

And the way that it's defined in the problem is:

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

What's the difference between paths and links? I've tried to create a similar problem but omitting the path and I keep getting Unsolvable Problem. How can I properly define a path?

Thanks!


Solution

  • These are user-defined predicates:

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

    so their semantics can be deduced by inspecting the corresponding model.

    Both link and path are binary predicates that put in relation two locations, presumably when it's possible to move from one place to the other. This connection is unidirectional.

    I read, from the source code, that the following actions are defined:

    (: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)))
    

    So it seems that two locations have a link if it is possible to DRIVE-TRUCK from one place to the other, and two locations have a path if it is possible to WALK from one place to the other.

    There is really nothing else to say about it.

    The reason why you keep getting UNSAT is because you placed the drivers and the trucks in two different locations:

    (at driver1 s2)
    (at driver2 s2)
    (at truck1 s0)
    (at truck2 s0)
    

    Since the only connection among s0 and s2 is a link, the drivers cannot possibly reach the truck (and vice-versa). This is because a precondition of DRIVE-TRUCK is (driving ?driver ?truck), which is only set by BOARD-TRUCK if the driver is in the same location of the truck.

    You can solve this issue by creating a path among s0 and s2. However, this seems to be against the naming convention of the model, which interconnects sX using links only. A better solution is to change the initial state and put a truck in the same location of each driver, or at least in a location that is reachable by the WALK action.