【PDDL语法学习】 了解领域文件(Domain)第五篇:PDDL3

本文介绍了PDDL3.0中的新要求和约束语法,包括requirements(偏好和约束)、多种状态轨迹约束如always、sometime等,并提醒读者在实际应用中需谨慎使用,因为支持PDDL3的规划器有限。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:https://planning.wiki/ref/pddl3/domain
推荐通过原文了解更多没有翻译到位的内容。​

译者前言

这是一篇PDDL3的Domain语法简介翻译,但在实际问题中我并不推荐使用PDDL3的语法来定义规划问题,最大的原因在于当前支持PDDL3语法的规划器太少了,即便支持也仅仅支持小部分语法,慎用!!!

简介

与PDDL以前的所有安装一样,PDDL 3.0引入了新的要求。它还引入了定义约束(constraints)的语法。约束是目标的一种形式,必须在计划的所有状态中得到满足。

另外,虽然约束可能会给状态空间增加更多的复杂性,但通常它允许我们通过增加无效状态的数量来显著减少状态空间。

老规矩,先引入一个简单的例子:

(define
    (domain logistics)
    (:requirements :preferences :constraints)
    (:types
        lorry package recipient location - object
    )
    (:predicates
        (deliver-to ?r - recipient ?p - package)
        (delivered ?p - package)
        (in ?p - package ?l - lorry)
        (at ?l - lorry ?loc - location)
    )
    (:constraints
        (and
            (forall (?l - lorry ?loc - location) (at-most-once (at ?l ?loc)))
            ... additional constraints omitted
        )
    )
    ; Actions omitted
)

内容

  • Requirements
  • Constraints
    • always
    • sometime
    • within
    • at-most-once
    • sometime-after
    • sometime-before
    • always-within
    • hold-during
    • hold-after

1、Requirements

(:requirements <requirement_name>)

这是PDDL3.0在PDDL语法中添加的 requirements

  • :preferences
  • :constraints

2、Constraints

(:constraints
    <logical_expression>
)

约束是各种 forall/exists语句的组合,这些语句可以使用为方便preference而设计的关键字。约束本质上是在一个有效计划的所有状态下都必须成立的事实。
本质上,约束表达了我们希望始终为真的东西,或者某种状态轨迹约束(关于状态如何随时间变化的约束)。如。

(:constraints
    (and
        (forall (?l - lorry ?loc - location) (at-most-once (at ?l ?loc)))
        ... additional constraints omitted ;; 额外的约束省略
    )
)

上面显示的单个约束表示,对于每个lorry 和位置,lorry 最多应该访问该位置一次。这些表达方式可以帮助规划器通过加强常识逻辑来减少他们需要探索的状态的数量。
现在看来, 如果可以以任何特定的顺序交付包裹,并且可能有多个包裹要交付到一个位置,这似乎合乎逻辑。 我们想要表达的是,我们只使用给定的lorry 访问任何给定的位置一次(从而防止我们两次前往相同的地方)。
使用此语法的用户应该谨慎,不要排除不明显的解决方案。如果例如我们规划基于燃料的lorry 成本, lorry可以两次到一个地方(如城市),一次是在旅程开始时运送包裹,并在旅途结束时在一个便宜的加油站补充燃料回家。

Always

always <predicate>

always状态轨迹约束表示计划执行过程中到达的每个状态都包含指定的谓词。
它实际上创建了一个常量谓词。在下面的例子中,我们说 package1lorry1 当计划达到每一个状态。

always (in package1 lorry1)

Sometime

sometime <predicate>

sometime 状态轨迹约束表示,计划到达的状态内的某个点,指定的谓词为true。
它本质上说,在某一时刻,这个事实是正确的。在下面的例子中,我们说在某个时刻, lorry1 应该在 glasgow(地名)

sometime (at lorry1 glasgow)

Within

within <number> <predicate>

within 状态轨迹约束表示,在指定的计划步骤数量内,某些谓词必须为真。
这是一个非常不寻常的约束,因为它在temporal domain 和(STRIPS domain之间变化。语句中的数字表示时间计划中的时间点。报表中的数字表示STRIPS的plans中的计划步骤数。

within 10 (at lorry1 collectionpoint)

At-most-once

at-most-once <predicate>

at-most-once状态轨迹约束表示,一个事实至多一次为真。在防止对同一事实的重复访问上面是有用的。如。

at-most-once (at lorry1 theendoftheworld)

Some-after

sometime-after <before_predicate> <after_predicate>

sometime-after状态轨迹约束表示,在另一个谓词为真之后,某个谓词为真

sometime-after (at lorry1 london) (at lorry1 pompey)

上面的陈述表明,一旦 lorry1 到达伦敦之后应该是在 pompey。

Sometime-before

sometime-before <after_predicate> <before_predicate>

sometime-before状态轨迹约束表示,在另一个谓词为真之前,某个谓词应该为真。如

sometime-before (delivering lorry1) (at lorry1 warehouse)

上述声明表明,在 lorry1 被标记为发货之前,它应该在 warehouse (即取货)。

Always-within

always-within <number> <condition> <predicate>

always-within表示 always 和 within的组合。本质上它表示,每当某个条件/谓词为true,那么在指定的步骤/时间内,其他谓词应该变为true。

Hold-during

hold-during <number> <number> <predicate>

hold-during状态过程约束表示,谓词在表示的两个时间点之间应该为真。本质上,动作总是有一个固定的起点和终点

hold-during 20 30 (at lorry1 lorrycarpark)

上面的声明表示 lorry1 应该停在时间 20 到 30点之间。假设题目中的时间代表小时,那么第一天晚上8点是 20 小时,第二天早上6点是 30小时。

Hold-after

hold-after <number> <predicate>

hold-after状态-轨迹约束表示,谓词在某个时间点之后应该为true。
注意,这个谓词在<number>之后必须永远保持为真。 这使得它在within 是不对称的,表示一个事件必须在某一点之前至少一次成为true,

hold-after 40 (empty lorry1)

上面的语句表明lorry1在40之后应该是空的,并且保持empty

Reference

  • PDDL - The Planning Domain Definition Language, [Ghallab, M. Howe, A. Knoblock, C. McDermott, D. Ram, A. Veloso, M. Weld, D. Wilkins, D.]
  • PDDL2.1: An Extension to PDDL for Expressing Temporal Planning Domains, [Fox, M. Long, D.]
  • PDDL2.2: The Language for the Classical Part of the 4th International Planning Competition[Edelkamp, S. Hoffmann, J.]
  • Plan Constraints and Preferences in PDDL 3 [Gerevini, A. Long, D.]
  • BNF Description of PDDL 3.0 [Gerevini, A. Long, D.]
  • PDDL Examples
  • OPTIC - Optimising Preferences and Time Dependent Costs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值