为什么pddl发现解决方案不完整

时间:2018-12-20 22:33:44

标签: pddl

以下是用pddl编写的跨河问题的一小部分。我试图在两个不同的工具(editor.planning.domains和stripsfiddle.herokuapp.com)中找到解决方案,但是它们给出的结果都是相同的。

;domain;
(define (domain RiverCrossing)
(:requirements :strips :typing)
(:types 
    Farmer Fox - passengers
)

(:predicates 
     (onLeftBank ?p - passengers)
     (onRightBank ?p - passengers)
)

(:action crossRiverLR
    :parameters (?f - Farmer)
    :precondition (  and (onLeftBank ?f))
    :effect(  and (onRightBank ?f)  )
)
(:action crossRiverRL
    :parameters (?f - Farmer)
    :precondition (  and (onRightBank ?f))
    :effect(  and (onLeftBank ?f)  )
)
(:action crossRiverLRf
    :parameters ( ?fx - Fox ?f - Farmer)
    :precondition (  and (onLeftBank ?f) (onLeftBank ?fx) )
    :effect(  and (onRightBank ?fx) (onRightBank ?f) )
)
(:action crossRiverRLf
    :parameters (?f - Farmer ?fx - Fox)
    :precondition (  and (onRightBank ?f) (onRightBank ?fx) )
    :effect(  and (onLeftBank ?f) (onLeftBank ?fx)  )
)

)

问题

(define (problem RCP)
(:domain RiverCrossing)
(:objects
    farmer - Farmer
    fox - Fox
    )

(:init
    (onRightBank farmer) (onLeftBank fox)
)

(:goal 
  (and
    (onLeftBank farmer) (onRightBank fox)
  )
)
)

两个编译器都给出相同的结果;农民不去左岸:

Solution found in 2 steps!
1. crossRiverRL farmer

2. crossRiverLRf fox farmer

有人可以帮我弄清楚我想念的重点吗? 预先感谢,

1 个答案:

答案 0 :(得分:1)

我发现问题出在设置下一个情况(OnRightBank)后并没有否定上一个情况(OnLeftBank)。 以下是我应用于所有效果的样本校正;

(:action crossRiverLR
    :parameters (?f - Farmer)
    :precondition (  and (onLeftBank ?f))
    :effect(  and (onRightBank ?f) 
                  (not (onLefttBank ?f)) ; **** adding this solved the problem. ****
     )
)