我一直在从事有关狐狸-鹅豆-农民问题的项目。我正在尝试在基于浏览器的https://stripsfiddle.herokuapp.com/编译器上实现它。除moveFoxAcross和moveFoxBack以外的所有功能均有效。我看不到任何缺陷。有人可以指出我的错误或建议任何有效的语法来源。这是我的域代码:
(define (domain domain-FGB)
(:requirements :strips :typing)
(:types fox goose beans farmer onLeftBank)
(:action moveGooseAcross
:parameters (?g - goose ?l - onLeftBank ?f - farmer)
:precondition (and (not (at ?g ?l)) (not (at ?f ?l)))
:effect (and (at ?g ?l) (at ?f ?l))
)
(:action moveFoxAcross
:parameters (?fo - fox ?l - onLeftBank ?f - farmer ?b - beans ?g - goose)
:precondition (and (not (at ?fo ?l)) (not (at ?f ?l))(or (and (not (at ?b ?l)) (at ?g ?l)) (and (at ?b ?l) (not (?g ?l)))))
:effect (and (at ?fo ?l) (at ?f ?l))
)
(:action moveBeansAcross
:parameters (?b - beans ?fo - fox ?l - onLeftBank ?f - farmer ?g - goose)
:precondition (and (not (at ?b ?l)) (not (at ?f ?l))(or (and (not (at ?fo ?l)) (at ?g ?l)) (and (at ?fo ?l) (not (at ?g ?l)))))
:effect (and (at ?b ?l) (at ?f ?l))
)
(:action farmerAcrossRiver
:parameters (?f - farmer ?l - onLeftBank)
:precondition (not (at ?f ?l))
:effect (at ?f ?l)
)
(:action moveGooseBack
:parameters (?g - goose ?l - onLeftBank ?f - farmer)
:precondition (and (at ?g ?l) (at ?f ?l))
:effect (and (not (at ?g ?l)) (not (at ?f ?l))))
(:action moveFoxBack
:parameters (?fo - fox ?l - onLeftBank ?f - farmer ?b - beans ?g - goose)
:precondition (and (at ?fo ?l) (at ?f ?l) (or (and (not (at ?b ?l)) (at ?g ?l)) (and (at ?b ?l) (not (?g ?l)))))
:effect (and (not (at ?fo ?l)) (not (at ?f ?l))))
(:action moveBeansBack
:parameters (?b - beans ?fo - fox ?l - onLeftBank ?f - farmer ?g - goose)
:precondition (and (at ?b ?l) (at ?f ?l)(or (and (not (at ?fo ?l)) (at ?g ?l)) (and (at ?fo ?l) (not (at ?g ?l)))))
:effect (and (not (at ?b ?l)) (not (at ?f ?l))))
(:action farmerGoesBack
:parameters (?f - farmer ?l - onLeftBank)
:precondition (at ?f ?l)
:effect (not (at ?f ?l))
))
这是我的问题代码:
(define (problem FGB)
(:domain domain-FGB)
(:objects
FOX - fox
GOOSE - goose
BEANS - beans
FARMER - farmer
ONLEFTBANK - onLeftBank)
(:init
(and (not(at FOX ONLEFTBANK)) (not(at GOOSE ONLEFTBANK)) (not(at FARMER ONLEFTBANK)) (not(at BEANS ONLEFTBANK))))
(:goal (and (at FOX ONLEFTBANK) (at GOOSE ONLEFTBANK) (at FARMER ONLEFTBANK) (at BEANS ONLEFTBANK))))
您只需在域部分的列表中选择“创建自己的”,然后复制/粘贴我的代码即可自己尝试。
预先感谢
答案 0 :(得分:0)
问题是第二个或子句的第二个和子句中缺少“ at”。下面的大写字母AT。
:precondition (and
(not (at ?fo ?l))
(not (at ?f ?l))
(or (and
(not (at ?b ?l))
(at ?g ?l)
)
(and
(at ?b ?l)
(not (AT ?g ?l))
)
)
)
但是我无法通过此更正找到解决方案。 我会继续努力,并会通知您是否找到解决方案。