我正在尝试创建一个领域和问题文件作为练习。
简短的领域描述:我有几辆车,可以从A地取走并放到B地。任务很简单:将所有车从A地移到B地。我创建了以下领域文件:
(define (domain test) ; 领域名称必须与问题匹配 ; 定义规划器必须支持的功能来执行此领域 ; 目前仅支持领域要求 ( :requirements :strips :negative-preconditions :equality :typing :adl ) (:types car place ) (:predicates (at ?o - car ?p - place ) (taken ?o - car ) ) (:action take :parameters (?o1 - car ?o2 - place ) :precondition (and (at ?o1 ?o2) (not (taken ?o1)) ) :effect (and (not (at ?o1 ?o2 )) (taken ?o1) ) ) (:action put :parameters (?o1 - car ?o2 - place ) :precondition (and (not (at ?o1 ?o2)) (taken ?o1) ) :effect (and (at ?o1 ?o2) (not (taken ?o1) ) ) ) (:action takeAll :parameters () :precondition (forall (?c - car ?p - place) (and (at ?c ?p) (not (taken ?c)) ) ) :effect (forall (?c - car) (taken ?c) ) ) )
问题文件如下所示:
(define (problem test) (:domain test) (:objects c1 - car c2 - car c3 - car A - place B - place ) (:init (at c1 A) (at c2 A) (at c3 A) (not (taken c1)) (not (taken c2)) (not (taken c3)) ) (:goal (and (at c1 B) (at c2 B) (at c3 B) ) ) )
我使用的是这里提供的在线规划器和求解器,我想知道为什么它输出我有几个无效的谓词
test takeall precondition contains ["forall", ["?c", "-", "car", "?p", "-", "place"], ["and", ["at", "?c", "?p"], ["not", ["taken", "?c"]]]], not a valid predicate takeall effect contains ["forall", ["?c", "-", "car"], ["taken", "?c"]], not a valid predicate :equality requirement is unnecessarytest Initial state contains ["not", ["taken", "c1"]], not a valid predicate Initial state contains ["not", ["taken", "c2"]], not a valid predicate Initial state contains ["not", ["taken", "c3"]], not a valid predicate
能有人解释一下我到底做错了什么吗?使用takeAll
动作,我想尝试一下forall
。它的解释应该是这样的:前提条件说明所有类型为车的对象都未处于被取走的状态,并且在某个地方。效果应该是所有车都处于被取走的状态。根据我的常识,最短的解决方案应该是 takeAll, put(c1, B), (put c2, B), (put c3, B)
回答:
你在做经典规划,这意味着初始状态只需要指定什么是真的(其他一切都被假定为假)。从你的初始状态中删除那些负流体,它可能会正常工作。