-2

We have a problem with this code. We are not getting the solution when running the planner. We don't know what the problem is. There is no error on debug console.

DOMAIN.PDDL

(define (domain pacientes4)

(:requirements :typing :negative-preconditions)

(:types paciente localizacion)


(:predicates 
    (vacia-ambulancia)
    (llena-ambulancia)
    (ambulancia ?l - localizacion)
    (ubicacion ?p - paciente ?l - localizacion)
    (hospital ?l - localizacion)
    (hospitalp ?p - paciente)
    (adjacent ?l1 - localizacion  ?l2 - localizacion)
)


(:action mover
    :parameters (?x - localizacion ?y - localizacion ?p - paciente)
    :precondition 
       ( and (ambulancia ?x) 
             (adjacent ?x ?y)
             (not (hospitalp ?p)) )
    :effect
     (and (not (ambulancia ?x))   
          (ambulancia ?y))

)


(:action subir
    :parameters (?p - paciente ?l - localizacion)
    :precondition 
        (and (vacia-ambulancia)
             (ambulancia ?l) 
             (ubicacion ?p ?l))
    :effect 
       (and (not (vacia-ambulancia))  
            (not (ambulancia ?l))  
            (not (ubicacion ?p ?l))
            (llena-ambulancia)) 
)


(:action bajar
    :parameters (?p - paciente  ?l - localizacion)
    :precondition 
         (and (llena-ambulancia) 
              (ambulancia ?l)
              (not (hospitalp ?p) ))    
         
    :effect 
        (and  (vacia-ambulancia) 
              (not (llena-ambulancia)) 
              (ubicacion ?p ?l) 
              (hospitalp ?p) 
              (hospital ?l) )
)
)

AND THE PROBLEM IS:

(define (problem Trasladopacientes) 
(:domain pacientes4)
(:objects  p1  p2 - paciente    l1  l2  l3  l4 - localizacion)

(:init  
        (hospital l1)  
        (ambulancia l1) 
        (not(llena-ambulancia))
        (vacia-ambulancia)
        (ubicacion p1 l3)  (ubicacion p2 l4)
        (not(hospitalp p1))  (not(hospitalp p2))
        (adjacent l1 l2)  (adjacent l2 l1)
        (adjacent l2 l4)  (adjacent l4 l2)
        (adjacent l3 l4)  (adjacent l4 l3)
)

(:goal 
   (and (ubicacion p1 l1)  (ubicacion p2 l1)
        (vacia-ambulancia)  
        (ambulancia l1)
        (hospitalp p1)   (hospitalp p2)  (hospital l1))
)


)
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103

1 Answers1

1

Tested on http://editor.planning.domains, it says the goal state is not reachable. Perhaps it could because the effect of your action subir makes the ambulancia statement disappear ((not (ambulancia ?l))). Once the ambulancia has disappeared, there is nothing more you can do to move people around.

Victor Paléologue
  • 2,025
  • 1
  • 17
  • 27