我目前正在尝试为 Game Kami制定计划。因此我需要用 PDDL 语言创建一个域和问题。
卡米规则:
规则很简单。您可以使用与您指定的颜色相同的颜色为一个图块和所有相邻图块着色。该调用是recusive,因此相邻瓦片的邻居也将获得相同的颜色。
目标:
通过使用上述递归函数,所有图块应具有相同的颜色。
我已经被卡米的 2x2 世界困住了,在这里你可以看到我的...
... 领域:
(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))
)
)
)
...和我的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)))))
而且我无法获得成功的计划,即使它只应用了一次功能color_tile。