用在线的PDDL Editor编程。问题如下
domain.pddl
(define (domain block-world)
(:predicates
(On ?b ?obj)
(Block ?b)
(Clear ?b)
)
(:action Move
:parameters(?b ?x ?y)
:precondition
(and
(On ?b ?x)
(Clear ?b)
(Clear ?y)
(Block ?b)
(Block ?y)
; (not (?b == ?x)) 这里是想表达?b和?x不相等,但是不知道用pddl语法怎么写,索性删掉了
; (not (?b == ?y))
; (not (?x == ?y))
)
:effect
(and
(On ?b ?y)
(Clear ?x)
(not
(On ?b ?x)
)
(not
(Clear ?y)
)
)
)
(:action MoveToTable
:parameters (?b, ?x)
:precondition
(and
(On ?b ?x)
(Clear ?b)
(Block ?b)
; (not (?b == ?x)) 这里是想表达?b和?x不相等,但是不知道用pddl语法怎么写,索性删掉了
)
:effect
(and
(On ?b Table)
(not
(On ?b ?x)
)
(Clear ?x)
)
)
)
problem.pddl
(define (problem solve)
(:domain block-world)
(:objects
A B C Table
)
(:init
(Block A)
(Block B)
(Block C)
(Clear B)
(Clear C)
(On A Table)
(On B Table)
(On C A)
)
(:goal
(and
(On A B)
(On B C)
)
)
)
Failed to parse the problem - invalid syntax (, line 49)
PDDL problem description loaded:
Domain: BLOCK-WORLD
Problem: SOLVE
#Actions: 39
#Fluents: 16
Landmarks found: 2
Starting search with IW (time budget is 60 secs)
rel_plan size: 3
#RP_fluents 5
Caption
{#goals, #UNnachieved, #Achieved} -> IW(max_w)
{2/2/0}:IW(1) -> [2][3]rel_plan size: 1
#RP_fluents 2
{2/1/1}:IW(1) -> [2]rel_plan size: 0
#RP_fluents 0Plan found with cost: 3
Total time: 4.47035e-10
Nodes generated during search: 16
Nodes expanded during search: 5
IW search completed
给的思路里面有检验?b, ?x, ?y等变量不相等的步骤,但是我不知道怎么用pddl表示;尝试了很多种写法都是语法错误;后来注释掉又会出现现在这种错误。怀疑就是确实这几句话导致的。
成功推理出来