I've been asked to write a solution to the famous "Goat, Wolf and the Cabbage" scernario. The scenario goes as follows:
The farmer wants to transport all three across the river. However, if:
- The goat and the cabbage are left alone, the goat will eat the cabbage
- IF the wolf and the goat are left alone, the wolf will eat the goat!
So one solution to the problem is as follows:
- Take the goat across the river, and drop it on the other side
- Come back across the river
- Pick up EITHER the cabbage or the wolf, and bring it to the other side
- Drop off the wolf, pick up the goat, and go back to the other side
- Drop off the goat, pick up the cabbage, and go back to the other side
- Pick up the goat, and voila! All three are transported.
However, I'm having trouble projecting this into PDDL. I've been give the problem definition:
(define
(problem boat1)
(:domain boat)
; only needs two objects, namely representing
; either banke side of the river, [w]est and [e]ast
(:objects w e)
(:INIT
; wolf, goat, cabbage, boat are all on
; the west side to start with
(config w w w w)
; represent all valid states
; these two are the special case,
; representing that wolf and cabbage are
; safe together even if the boat is away
(valid w e w e)
(valid e w e w)
; these are all cases where two entities
; are always safe as long as the boat is
; with them. In other words, a single entity
; on the other side is also always safe
; for west side
(valid w w w w)
(valid w w e w)
(valid w e w w)
(valid e w w w)
; for east side
(valid e e e e)
(valid e e w e)
(valid e w e e)
(valid w e e e)
; these are all valid states that are
; ever allowed
)
(:goal (AND
; they all have to move to the east side
(config e e e e)
)
)
Finally, we've been given only 1 predicate, and have been told that this can be done with 4 actions. Move_empty, move_goat, move_wolf, move_cabbage.
The predicate is:
(config ?wolf ?goat ?cabbage ?boat) (valid ?wolf ?goat ?cabbage ?boat)
and I've tried to start on move_empty with:
(:action move_empty
:parameters (?from ?to)
:precondition (and (valid ?x ?y ?z ?w) (on_left ?from) (on_right ?to))
:effect (and (valid ?x ?y ?z ?w)))
I do not wish for answers, only help and advice on how to solve this as there is not a lot of information on PDDL, from what I can find.