1

下面是用 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

谁能帮我弄清楚我遗漏的地方?提前致谢,

4

1 回答 1

1

我发现问题不是在设置下一个情况(OnRightBank)之后否定之前的情况(OnLeftBank)。以下是我应用于所有效果的示例校正;

(:action crossRiverLR
    :parameters (?f - Farmer)
    :precondition (  and (onLeftBank ?f))
    :effect(  and (onRightBank ?f) 
                  (not (onLefttBank ?f)) ; **** adding this solved the problem. ****
     )
)
于 2018-12-21T15:20:27.637 回答