【问题标题】:STRIPS Planner Doesn't CompileSTRIPS Planner 无法编译
【发布时间】:2018-12-16 02:14:36
【问题描述】:

我一直在从事一个关于众所周知的问题 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 个解决方案。
  • 有什么例子可以帮助我解决这个问题吗?

您可以从域部分的列表中选择“创建您自己的”,然后复制/粘贴我的代码以自己尝试。

提前致谢

【问题讨论】:

    标签: breadth-first-search microsoft-distributed-file-system first-order-logic pddl


    【解决方案1】:

    问题是第二个 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))
                       )
                    )
                  )
    

    但我无法通过此更正找到解决方案。 我会继续工作,如果找到任何解决方案会通知。

    【讨论】:

      猜你喜欢
      • 2015-11-25
      • 2015-06-07
      • 2013-03-06
      • 2016-08-24
      • 2018-10-18
      • 2014-02-16
      • 2015-03-31
      • 2015-10-29
      • 1970-01-01
      相关资源
      最近更新 更多