I'm new to working with PDDL
. I use an online editor. I have this problem: there are 3 agents, 3 cannibals and a boat with its maximum capacity of 2 people. There are also 2 shores and a river between them. All of the people are on one shore initially. There can't be more cannibals than agents on a shore and I need to find a way to move all of them to the other shore.
When I tried to solve it I got this error:
"Suspected timeout. arity of VALID_STATE to high! increase MAX_ARITY (currently 5)"
I would really appreciate it if someone could find what I did wrong or at least tell me more about this error and how to solve it. This is the problem:
(define (problem traversare)
(:domain problema1)
(:objects stg dr)
(:init
(current_position stg stg stg stg stg stg)
(valid_state stg stg stg stg stg stg)
(valid_state dr dr dr stg stg stg)
(valid_state stg stg stg dr dr stg)
(valid_state dr dr stg dr dr stg)
(valid_state dr stg dr dr dr stg)
(valid_state stg dr dr dr dr stg)
(valid_state dr dr dr dr dr stg)
(valid_state stg stg stg dr stg dr)
(valid_state dr dr stg dr stg dr)
(valid_state dr stg dr dr stg dr)
(valid_state stg dr dr dr stg dr)
(valid_state dr dr dr dr stg dr)
(valid_state stg stg stg stg dr dr)
(valid_state dr dr stg stg dr dr)
(valid_state dr stg dr stg dr dr)
(valid_state stg dr dr stg dr dr)
(valid_state dr dr dr stg dr dr)
(valid_state stg stg stg stg stg dr)
(valid_state dr stg stg stg stg dr)
(valid_state stg dr stg stg stg dr)
(valid_state stg stg dr stg stg dr)
(valid_state dr dr dr stg stg dr)
(valid_state stg stg stg stg dr stg)
(valid_state dr stg stg stg dr stg)
(valid_state stg dr stg stg dr stg)
(valid_state stg stg dr stg dr stg)
(valid_state dr dr dr stg dr stg)
(valid_state stg stg stg dr stg stg)
(valid_state dr stg stg dr stg stg)
(valid_state stg dr stg dr stg stg)
(valid_state stg stg dr dr stg stg)
(valid_state dr dr dr dr stg stg)
(valid_state dr dr dr dr dr dr)
)
(:goal
(current_position dr dr dr dr dr dr))
)
Here I've written all the possible states given the requirements of the exercise.
And this is the domain:
(define (domain problema1)
(:predicates
(current_position ?m1 ?m2 ?m3 ?c1 ?c2 ?c3)
(valid_state ?m1 ?m2 ?m3 ?c1 ?c2 ?c3)
)
(:action moveM1SD
:parameters (?m2 ?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position stg ?m2 ?m3 ?c1 ?c2 ?c3)
(valid_state dr ?m2 ?m3 ?c1 ?c2 ?c3)
)
:effect (and (current_position dr ?m2 ?m3 ?c1 ?c2 ?c3)
(not (current_position stg ?m2 ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM2SD
:parameters (?m1 ?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 stg ?m3 ?c1 ?c2 ?c3)
(valid_state ?m1 dr ?m3 ?c1 ?c2 ?c3)
)
:effect (and (current_position ?m1 dr ?m3 ?c1 ?c2 ?c3)
(not (current_position ?m1 stg ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM3SD
:parameters (?m1 ?m2 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 stg ?c1 ?c2 ?c3)
(valid_state ?m1 ?m2 dr ?c1 ?c2 ?c3)
)
:effect (and (current_position ?m1 ?m2 dr ?c1 ?c2 ?c3)
(not (current_position ?m1 ?m2 stg ?c1 ?c2 ?c3)))
)
(:action moveC1SD
:parameters (?m1 ?m2 ?m3 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 stg ?c2 ?c3)
(valid_state ?m1 ?m2 ?m3 dr ?c2 ?c3)
)
:effect (and (current_position ?m1 ?m2 ?m3 dr ?c2 ?c3)
(not (current_position ?m1 ?m2 ?m3 stg ?c2 ?c3)))
)
(:action moveC2SD
:parameters (?m1 ?m2 ?m3 ?c1 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 stg ?c3)
(valid_state ?m1 ?m2 ?m3 ?c1 dr ?c3)
)
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 dr ?c3)
(not (current_position ?m1 ?m2 ?m3 ?c1 stg ?c3)))
)
(:action moveC3SD
:parameters (?m1 ?m2 ?m3 ?c1 ?c2)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 ?c2 stg)
(valid_state ?m1 ?m2 ?m3 ?c1 ?c2 dr)
)
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 ?c2 dr)
(not (current_position ?m1 ?m2 ?m3 ?c1 ?c2 stg)))
)
(:action moveM1DS
:parameters (?m2 ?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position dr ?m2 ?m3 ?c1 ?c2 ?c3)
(valid_state stg ?m2 ?m3 ?c1 ?c2 ?c3)
)
:effect (and (current_position stg ?m2 ?m3 ?c1 ?c2 ?c3)
(not (current_position dr ?m2 ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM2DS
:parameters (?m1 ?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 dr ?m3 ?c1 ?c2 ?c3)
(valid_state ?m1 stg ?m3 ?c1 ?c2 ?c3)
)
:effect (and (current_position ?m1 stg ?m3 ?c1 ?c2 ?c3)
(not (current_position ?m1 dr ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM3DS
:parameters (?m1 ?m2 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 dr ?c1 ?c2 ?c3)
(valid_state ?m1 ?m2 stg ?c1 ?c2 ?c3)
)
:effect (and (current_position ?m1 ?m2 stg ?c1 ?c2 ?c3)
(not (current_position ?m1 ?m2 dr ?c1 ?c2 ?c3)))
)
(:action moveC1DS
:parameters (?m1 ?m2 ?m3 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 dr ?c2 ?c3)
(valid_state ?m1 ?m2 ?m3 stg ?c2 ?c3)
)
:effect (and (current_position ?m1 ?m2 ?m3 stg ?c2 ?c3)
(not (current_position ?m1 ?m2 ?m3 dr ?c2 ?c3)))
)
(:action moveC2DS
:parameters (?m1 ?m2 ?m3 ?c1 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 dr ?c3)
(valid_state ?m1 ?m2 ?m3 ?c1 stg ?c3)
)
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 stg ?c3)
(not (current_position ?m1 ?m2 ?m3 ?c1 dr ?c3)))
)
(:action moveC3DS
:parameters (?m1 ?m2 ?m3 ?c1 ?c2)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 ?c2 dr)
(valid_state ?m1 ?m2 ?m3 ?c1 ?c2 stg)
)
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 ?c2 stg)
(not (current_position ?m1 ?m2 ?m3 ?c1 ?c2 dr)))
)
(:action moveM1M2SD
:parameters (?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position stg stg ?m3 ?c1 ?c2 ?c3)
(valid_state dr dr ?m3 ?c1 ?c2 ?c3))
:effect (and (current_position dr dr ?m3 ?c1 ?c2 ?c3)
(not (current_position stg stg ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM1M3SD
:parameters (?m2 ?c1 ?c2 ?c3)
:precondition (and (current_position stg ?m2 stg ?c1 ?c2 ?c3)
(valid_state dr ?m2 dr ?c1 ?c2 ?c3))
:effect (and (current_position dr ?m2 dr ?c1 ?c2 ?c3)
(not (current_position stg ?m2 stg ?c1 ?c2 ?c3)))
)
(:action moveM1C1SD
:parameters (?m2 ?m3 ?c2 ?c3)
:precondition (and (current_position stg ?m2 ?m3 stg ?c2 ?c3)
(valid_state dr ?m2 ?m3 dr ?c2 ?c3))
:effect (and (current_position dr ?m2 ?m3 dr ?c2 ?c3)
(not (current_position stg ?m2 ?m3 stg ?c2 ?c3)))
)
(:action moveM1C2SD
:parameters (?m2 ?m3 ?c1 ?c3)
:precondition (and (current_position stg ?m2 ?m3 ?c1 stg ?c3)
(valid_state dr ?m2 ?m3 ?c1 dr ?c3))
:effect (and (current_position dr ?m2 ?m3 ?c1 dr ?c3)
(not (current_position stg ?m2 ?m3 ?c1 stg ?c3)))
)
(:action moveM1C3SD
:parameters (?m2 ?m3 ?c1 ?c2)
:precondition (and (current_position stg ?m2 ?m3 ?c1 ?c2 stg)
(valid_state dr ?m2 ?m3 ?c1 ?c2 dr))
:effect (and (current_position dr ?m2 ?m3 ?c1 ?c2 dr)
(not (current_position stg ?m2 ?m3 ?c1 ?c2 stg)))
)
(:action moveM2M3SD
:parameters (?m1 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 stg stg ?c1 ?c2 ?c3)
(valid_state ?m1 dr dr ?c1 ?c2 ?c3))
:effect (and (current_position ?m1 dr dr ?c1 ?c2 ?c3)
(not (current_position ?m1 stg stg ?c1 ?c2 ?c3)))
)
(:action moveM2C1SD
:parameters (?m1 ?m3 ?c2 ?c3)
:precondition (and (current_position ?m1 stg ?m3 stg ?c2 ?c3)
(valid_state ?m1 dr ?m3 dr ?c2 ?c3))
:effect (and (current_position ?m1 dr ?m3 dr ?c2 ?c3)
(not (current_position ?m1 stg ?m3 stg ?c2 ?c3)))
)
(:action moveM2C2SD
:parameters (?m1 ?m3 ?c1 ?c3)
:precondition (and (current_position ?m1 stg ?m3 ?c1 stg ?c3)
(valid_state ?m1 dr ?m3 ?c1 dr ?c3))
:effect (and (current_position ?m1 dr ?m3 ?c1 dr ?c3)
(not (current_position ?m1 stg ?m3 ?c1 stg ?c3)))
)
(:action moveM2C3SD
:parameters (?m1 ?m3 ?c1 ?c2)
:precondition (and (current_position ?m1 stg ?m3 ?c1 ?c2 stg)
(valid_state ?m1 dr ?m3 ?c1 ?c2 dr))
:effect (and (current_position ?m1 dr ?m3 ?c1 ?c2 dr)
(not (current_position ?m1 stg ?m3 ?c1 ?c2 stg)))
)
(:action moveM3C1SD
:parameters (?m1 ?m2 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 stg stg ?c2 ?c3)
(valid_state ?m1 ?m2 dr dr ?c2 ?c3))
:effect (and (current_position ?m1 ?m2 dr dr ?c2 ?c3)
(not (current_position ?m1 ?m2 stg stg ?c2 ?c3)))
)
(:action moveM3C2SD
:parameters (?m1 ?m2 ?c1 ?c3)
:precondition (and (current_position ?m1 ?m2 stg ?c1 stg ?c3)
(valid_state ?m1 ?m2 dr ?c1 dr ?c3))
:effect (and (current_position ?m1 ?m2 dr ?c1 dr ?c3)
(not (current_position ?m1 ?m2 stg ?c1 stg ?c3)))
)
(:action moveM3C3SD
:parameters (?m1 ?m2 ?c1 ?c2)
:precondition (and (current_position ?m1 ?m2 stg ?c1 ?c2 stg)
(valid_state ?m1 ?m2 dr ?c1 ?c2 dr))
:effect (and (current_position ?m1 ?m2 dr ?c1 ?c2 dr)
(not (current_position ?m1 ?m2 stg ?c1 ?c2 stg)))
)
(:action moveC1C2SD
:parameters (?m1 ?m2 ?m3 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 stg stg ?c3)
(valid_state ?m1 ?m2 ?m3 dr dr ?c3))
:effect (and (current_position ?m1 ?m2 ?m3 dr dr ?c3)
(not (current_position ?m1 ?m2 ?m3 stg stg ?c3)))
)
(:action moveC1C3SD
:parameters (?m1 ?m2 ?m3 ?c2)
:precondition (and (current_position ?m1 ?m2 ?m3 stg ?c2 stg)
(valid_state ?m1 ?m2 ?m3 dr ?c2 dr))
:effect (and (current_position ?m1 ?m2 ?m3 dr ?c2 dr)
(not (current_position ?m1 ?m2 ?m3 stg ?c2 stg)))
)
(:action moveC2C3SD
:parameters (?m1 ?m2 ?m3 ?c1)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 stg stg)
(valid_state ?m1 ?m2 ?m3 ?c1 dr dr))
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 dr dr)
(not (current_position ?m1 ?m2 ?m3 ?c1 stg stg)))
)
(:action moveM1M2DS
:parameters (?m3 ?c1 ?c2 ?c3)
:precondition (and (current_position dr dr ?m3 ?c1 ?c2 ?c3)
(valid_state stg stg ?m3 ?c1 ?c2 ?c3))
:effect (and (current_position stg stg ?m3 ?c1 ?c2 ?c3)
(not (current_position dr dr ?m3 ?c1 ?c2 ?c3)))
)
(:action moveM1M3DS
:parameters (?m2 ?c1 ?c2 ?c3)
:precondition (and (current_position dr ?m2 dr ?c1 ?c2 ?c3)
(valid_state stg ?m2 stg ?c1 ?c2 ?c3))
:effect (and (current_position stg ?m2 stg ?c1 ?c2 ?c3)
(not (current_position dr ?m2 dr ?c1 ?c2 ?c3)))
)
(:action moveM1C1DS
:parameters (?m2 ?m3 ?c2 ?c3)
:precondition (and (current_position dr ?m2 ?m3 dr ?c2 ?c3)
(valid_state stg ?m2 ?m3 stg ?c2 ?c3))
:effect (and (current_position stg ?m2 ?m3 stg ?c2 ?c3)
(not (current_position dr ?m2 ?m3 dr ?c2 ?c3)))
)
(:action moveM1C2DS
:parameters (?m2 ?m3 ?c1 ?c3)
:precondition (and (current_position dr ?m2 ?m3 ?c1 dr ?c3)
(valid_state stg ?m2 ?m3 ?c1 stg ?c3))
:effect (and (current_position stg ?m2 ?m3 ?c1 stg ?c3)
(not (current_position dr ?m2 ?m3 ?c1 dr ?c3)))
)
(:action moveM1C3DS
:parameters (?m2 ?m3 ?c1 ?c2)
:precondition (and (current_position dr ?m2 ?m3 ?c1 ?c2 dr)
(valid_state stg ?m2 ?m3 ?c1 ?c2 stg))
:effect (and (current_position stg ?m2 ?m3 ?c1 ?c2 stg)
(not (current_position dr ?m2 ?m3 ?c1 ?c2 dr)))
)
(:action moveM2M3DS
:parameters (?m1 ?c1 ?c2 ?c3)
:precondition (and (current_position ?m1 dr dr ?c1 ?c2 ?c3)
(valid_state ?m1 stg stg ?c1 ?c2 ?c3))
:effect (and (current_position ?m1 stg stg ?c1 ?c2 ?c3)
(not (current_position ?m1 dr dr ?c1 ?c2 ?c3)))
)
(:action moveM2C1DS
:parameters (?m1 ?m3 ?c2 ?c3)
:precondition (and (current_position ?m1 dr ?m3 dr ?c2 ?c3)
(valid_state ?m1 stg ?m3 stg ?c2 ?c3))
:effect (and (current_position ?m1 stg ?m3 stg ?c2 ?c3)
(not (current_position ?m1 dr ?m3 dr ?c2 ?c3)))
)
(:action moveM2C2DS
:parameters (?m1 ?m3 ?c1 ?c3)
:precondition (and (current_position ?m1 dr ?m3 ?c1 dr ?c3)
(valid_state ?m1 stg ?m3 ?c1 stg ?c3))
:effect (and (current_position ?m1 stg ?m3 ?c1 stg ?c3)
(not (current_position ?m1 dr ?m3 ?c1 dr ?c3)))
)
(:action moveM2C3DS
:parameters (?m1 ?m3 ?c1 ?c2)
:precondition (and (current_position ?m1 dr ?m3 ?c1 ?c2 dr)
(valid_state ?m1 stg ?m3 ?c1 ?c2 stg))
:effect (and (current_position ?m1 stg ?m3 ?c1 ?c2 stg)
(not (current_position ?m1 dr ?m3 ?c1 ?c2 dr)))
)
(:action moveM3C1DS
:parameters (?m1 ?m2 ?c2 ?c3)
:precondition (and (current_position ?m1 ?m2 dr dr ?c2 ?c3)
(valid_state ?m1 ?m2 stg stg ?c2 ?c3))
:effect (and (current_position ?m1 ?m2 stg stg ?c2 ?c3)
(not (current_position ?m1 ?m2 dr dr ?c2 ?c3)))
)
(:action moveM3C2DS
:parameters (?m1 ?m2 ?c1 ?c3)
:precondition (and (current_position ?m1 ?m2 dr ?c1 dr ?c3)
(valid_state ?m1 ?m2 stg ?c1 stg ?c3))
:effect (and (current_position ?m1 ?m2 stg ?c1 stg ?c3)
(not (current_position ?m1 ?m2 dr ?c1 dr ?c3)))
)
(:action moveM3C3DS
:parameters (?m1 ?m2 ?c1 ?c2)
:precondition (and (current_position ?m1 ?m2 dr ?c1 ?c2 dr)
(valid_state ?m1 ?m2 stg ?c1 ?c2 stg))
:effect (and (current_position ?m1 ?m2 stg ?c1 ?c2 stg)
(not (current_position ?m1 ?m2 dr ?c1 ?c2 dr)))
)
(:action moveC1C2DS
:parameters (?m1 ?m2 ?m3 ?c3)
:precondition (and (current_position ?m1 ?m2 ?m3 dr dr ?c3)
(valid_state ?m1 ?m2 ?m3 stg stg ?c3))
:effect (and (current_position ?m1 ?m2 ?m3 stg stg ?c3)
(not (current_position ?m1 ?m2 ?m3 dr dr ?c3)))
)
(:action moveC1C3DS
:parameters (?m1 ?m2 ?m3 ?c2)
:precondition (and (current_position ?m1 ?m2 ?m3 dr ?c2 dr)
(valid_state ?m1 ?m2 ?m3 stg ?c2 stg))
:effect (and (current_position ?m1 ?m2 ?m3 stg ?c2 stg)
(not (current_position ?m1 ?m2 ?m3 dr ?c2 dr)))
)
(:action moveC2C3DS
:parameters (?m1 ?m2 ?m3 ?c1)
:precondition (and (current_position ?m1 ?m2 ?m3 ?c1 dr dr)
(valid_state ?m1 ?m2 ?m3 ?c1 stg stg))
:effect (and (current_position ?m1 ?m2 ?m3 ?c1 stg stg)
(not (current_position ?m1 ?m2 ?m3 ?c1 dr dr)))
)
)
Here I defined all the possible actions, including:
- every person can cross the river alone from one shore to the other.
- every person can cross the river with someone else from one shore to the other.
I've made these notations:
moveXSD
is when someone is crossing the river from left to right alone on the boat
moveXYSD
is when someone is crossing the river from left to right with another person
moveXSD
is when someone is crossing the river from left to right alone on the boat
moveXYDS
is when someone is crossing the river from right to left with another personmoveXSD
is when someone is crossing the river from left to right alone on the boat
moveXYDS
is when someone is crossing the river from right to left with another person
m1 m2 m3
are the agents and c1 c2 c3
are the cannibals
stg
stands for left
dr
stands for right
Considering the fact that I just started using this programming language, I hope I've made no newbie mistakes. Please, let me know if I missed something, or haven't given you all the details needed.