I'm currently trying my luck on creating a Plan for the Game Kami. Therefore I need to create a Domain and the Problem in the PDDL language.
Rules of Kami:
The rules are simple. You can color one tile and all neighboring tiles with the same color as you inted. The call is recusive so the neighbours of the neighboring tiles also will get the same color.
Goal:
All tiles should have the same color by using the recursice function described above.
I already got stuck at a 2x2 world of Kami, here you can see my...
... Domain:
(define (domain kami-dom)
(:requirements :strips :typing :disjunctive-preconditions :negative-preconditions :conditional-effects)
(:types c - tile
brown red green - color
)
(:predicates
(color_value ?t - tile ?c - color)
(is_neighbour ?t ?sec_t - tile)
)
(:action color_tile
:parameters (?t - tile ?old_c ?new_c - color)
:precondition (and (not (color_value ?t ?new_c)) (color_value ?t ?old_c))
:effect (and
(forall (?acc - tile)
(when (and (is_neighbour ?t ?acc) (color_value ?acc ?old_c))
(and (color_value ?acc ?new_c) (not (color_value ?acc ?old_c)))
)
)
(color_value ?t ?new_c)
(not (color_value ?t ?old_c))
)
)
)
... and my Problem.pddl:
(define (problem kami-prob-x-1)
(:domain kami-dom)
(:objects
tile11 tile12 tile21 tile22 - tile
red green brown - color)
(:init
(color_value tile11 red)
(color_value tile12 red)
(color_value tile21 red)
(color_value tile22 brown)
(is_neighbour tile11 tile12)
(is_neighbour tile11 tile21)
(is_neighbour tile12 tile11)
(is_neighbour tile12 tile22)
(is_neighbour tile21 tile11)
(is_neighbour tile21 tile22)
(is_neighbour tile22 tile12)
(is_neighbour tile22 tile21)
)
(:goal (or (and (color_value tile11 red) (color_value tile12 red) (color_value tile21 red) (color_value tile22 red))
(and (color_value tile11 green) (color_value tile12 green) (color_value tile21 green) (color_value tile22 green))
(and (color_value tile11 brown) (color_value tile12 brown) (color_value tile21 brown) (color_value tile22 brown)))))
And I can't get a successful plan, even when it is only apllying the function color_tile once.
The problem is in the :types description in the domain file. You should replace it by something like:
After doing that, if you run some planner, it will return a valid plan. For example, I used Fast Downward (http://www.fast-downward.org/) and got the following output (I removed some irrelevant parts):
So it does find a plan with a single action that consists of painting tile11.