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
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:(region ?x)
(region ?y)
(at-region ?x)
(at-bridge ?x)
(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:
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: