0

I have problem understanding pddl, I'm trying to make a spaceship plan, spaceship can move to a region as long as captain and navigator is at the bridge.

This is my code for action from domain file

(:action travel :parameters (?x ?y)
        :precondition   (and (REGION ?x) (REGION ?y) ; travel between regions
                            (at-region ?x) (at-bridge ?x) (at-bridge ?y))
        :effect         (and (at-region ?y)
                        (not (at-region ?x)))
    ) 

when i try this problem file


(:init (SUBMARINE submarine) 
            (ROOM bridge) (ROOM sickbay) ; 2 rooms - bridge and sickbay
            (PERSONNEL captain) (PERSONNEL navigators)
            (REGION regionempty) (REGION seaport)
            (at-region seaport) (at-bridge captain) (at-bridge navigators)
    )
    
    (:goal (and (at-region regionempty))
    
    )

I get error : ff: goal can be simplified to FALSE. No plan will solve it

Pat
  • 21
  • 7

1 Answers1

1

The issue lies in the precondition of your action and its parameters. You declare only two parameters ?x and ?y. For those you require five things to hold in order for the travel action to be executable:

  1. (region ?x)
  2. (region ?y)
  3. (at-region ?x)
  4. (at-bridge ?x)
  5. (at-bridge ?y)

The problem are number 4 and 5. ?x and ?x should be the regions between you want to travel (that is what 1.-3.) express. But then you say that the region ?x must also be at the bridge (4.) and that the region ?y must be at the bride (5.). The point here is that for an instance of the travel action you have to select one value for each variable s.t. all preconditions hold at the same time.

What fixes your problem is to add two additional parameters:

(:action travel :parameters (?x ?y ?p1 ?p2)
        :precondition   (and (REGION ?x) (REGION ?y) ; travel between regions
                            (at-region ?x) (at-bridge ?p1) (at-bridge ?p1))
        :effect         (and (at-region ?y)
                        (not (at-region ?x)))
    )

Lastly, you are untyped PDDL and check types with unary predicates. This is quite outdated. For modelling purposes you should always use typed variables. I.e. introduce types region, personnel, submarine, ... The action definition then looks like this:

(:action travel :parameters (?x ?y - region ?p1 ?p2 - personnel)
        :precondition   (and (at-region ?x) (at-bridge ?p1) (at-bridge ?p1))
        :effect         (and (at-region ?y)
                        (not (at-region ?x)))
    )
  • I've tried this and output gives me this ` (:action travel :parameters (seaport regionempty captain captain) :precondition (and (at-region seaport) (at-bridge captain) (at-bridge captain) ) :effect (and (at-region regionempty) (not (at-region seaport) ) ) )` why does it output captain twice, rather than captain and navigator? – Pat Oct 15 '20 at 11:13
  • 1
    Oh that is kind-of my fault. In PDDL you can choose parameters to have the same value. In this case, ``?p1`` and ``?p2`` are both chosen to be ``captain`` as ``(at-bridge captain)`` holds. You can change this by adding a not-equals constraint ``(not (= ?p1 ?p2))`` to the precondition. For this to work you may have to add ``(:requirements :equality)`` to the domain (depends on the planner). – Gregor Behnke Oct 16 '20 at 06:53