PDDL+为PDDL中的域引入了两种新的结构,一种是过程,另一种是 Events,本质上可以分别看作是不可控制的持续行为( uncontrollable durative actions)和不可控制的瞬时行为( uncontrollable instantaneous actions respectively)。
引入一个实例:
(define
(domain ballphysics)
(:requirements :time :typing)
(:types
ball - object
)
(:predicates
(held ?b - ball)
)
(:functions
(velocity ?b - ball)
(distance-to-floor ?b - ball)
)
(:process FALLING
:parameters (?b - ball)
:precondition (and
(not (held ?b))
(< (velocity ?b) 100)
)
:effect (and
(increase (velocity ?b) (* #t 9.8))
(decrease (distance-to-floor ?b) (* #t (velocity ?b)))
)
)
(:event HIT-GROUND
:parameters (?b - ball)
:precondition (and
(not (held ?b))
(<= (distance-to-floor ?b) 0)
(> (velocity ?b) 0)
)
:effect (
(assign (velocity ?b) (* -0.8 (velocity ?b)))
)
)
; Actions omitted
)
内容:
-
Requirements
-
Process
-
Events
1、Requirements
(:requirements <requirement_name>)
为了同时包含过程和事件,只需要一个额外的 requirement ,这个 requirement 是 :time,如下所示
(:requirements :time)
2、Process
(:process FALLING
:parameters (?b - ball)
:precondition (and
(not (held ?b))
(< (velocity ?b) 100)
)
:effect (and
(increase (velocity ?b) (* #t 9.8))
(decrease (distance-to-floor ?b) (* #t (velocity ?b)))
)
)
流程由以下三个部分定义 :parameters、 :precondition和 :effect,它们定义了一个 process 在什么时候对其进行操作,以及该 process 在作用时具有什么效果。这些直接对应于在PDDL 1.2中找到的动作的定义,但是可以包括在PDDL 2.1中看到的数字的表达性。
令人困惑的是,尽管与持续性操作( durative action)具有类似的行为,但 process 条件在其持续时间内,因此可以将前提条件看作更像PDDL 2.1中的 over all条件
#t代表过程的时间,它是用来计算连续数字的影响,因此, 如果进程进行到一半左右,一些操作可能希望在进程影响的数值流上运行哪些条件,#t可用于计算中间值的数字流。
3、Events
(:event HIT-GROUND
:parameters (?b - ball)
:precondition (and
(not (held ?b))
(<= (distance-to-floor ?b) 0)
(> (velocity ?b) 0)
)
:effect (
(assign (velocity ?b) (* -0.8 (velocity ?b)))
)
)
event 定义为与 process 相同的三个部分, :parameters是效果作用的对象, :precondition 是为了让事件运行必须满足的条件, :effect是事件具有的效果。
请注意,一个 event 的独特性质是,虽然它可以发生不止一次,但通常不会连续发生。本质上, event 是时间上的离散时刻,而process 是时间间隔。
在上面的例子中,我们看到撞击地面的条件是速度大于0,结果是速度被抵消了,这就保证了——至少在一段时间内——这个事件不能再发生。
Reference
-
PDDL+: Modelling Continuous Time Dependent Effects [Fox, M. Long, D.]
原文github地址:https://github.com/nergmada/pddl-reference/blob/master/docs/reference/PDDL%2B/domain.md