STRIPS Planner 无法编译
STRIPS Planner Doesn't Compile
我一直在做一个关于众所周知的问题 fox-goose-beans-farmer 的项目。我正在尝试在基于浏览器的编译器 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))))
这是我的问题:
- 只有 moveFoxAcross 和 moveFoxBack 函数不起作用并给出编译错误你能帮我看看为什么吗?
- 即使我在没有它们的情况下编译,它也给了我 0 个解决方案。
- 有什么例子可以帮助我解决这个问题吗?
您可以从域部分的列表中 select "Create your own" 和 copy/paste 我的代码自己尝试。
提前致谢
问题是第二个or子句的第二个and子句中缺少"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))
)
)
)
但我无法通过此更正找到解决方案。
我继续工作,如果找到任何解决方案,我会通知。
我一直在做一个关于众所周知的问题 fox-goose-beans-farmer 的项目。我正在尝试在基于浏览器的编译器 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))))
这是我的问题:
- 只有 moveFoxAcross 和 moveFoxBack 函数不起作用并给出编译错误你能帮我看看为什么吗?
- 即使我在没有它们的情况下编译,它也给了我 0 个解决方案。
- 有什么例子可以帮助我解决这个问题吗?
您可以从域部分的列表中 select "Create your own" 和 copy/paste 我的代码自己尝试。
提前致谢
问题是第二个or子句的第二个and子句中缺少"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))
)
)
)
但我无法通过此更正找到解决方案。 我继续工作,如果找到任何解决方案,我会通知。