AI基础 L27 Introduction to Automated Planning - III

Complexity Analysis
• Complexity analyses are done on decision problems or language-recognition
problems
— Problems that have yes-or-no answers
• A language is a set L of strings over some alphabet A
— Recognition procedure for L
◦ A procedure R(x) that returns “yes” iff the string x is in L
◦ If x is not in L, then R(x) may return “no” or may fail to terminate
• Translate classical planning into a language-recognition problem
• Examine the language-recognition problem’s complexity

复杂性分析的类型

  1. 决策问题

    • 这类问题可以回答“是”或“否”,例如“是否存在一条从初始状态到目标状态的路径?”
  2. 语言识别问题

    • 语言是一个字符串集合,这些字符串由某个字母表生成。
    • 识别程序是用来识别特定语言的算法或过程。
    • 识别程序 R(x) 如果字符串 x 在语言中,则返回“是”;否则,它可能返回“否”或可能无法终止。

经典规划到语言识别问题的转换

  • 经典规划

    • 它是一个决策问题,询问是否存在一个从初始状态到目标状态的路径。
  • 转换为语言识别问题

    • 我们可以将规划问题转换为一个语言识别问题,其中规划问题的解集对应于语言。
    • 例如,如果规划问题的解集是有限的,那么对应的规划语言是有限的。

语言识别问题的复杂性分析

  • 复杂性分析
    • 它关注于识别程序的效率,即在处理输入时所需的计算资源。
    • 复杂性分析可以帮助我们了解识别特定语言所需的计算量。

Planning as a Language-Recognition Problem
• Consider the following two languages
Plan-Existence = {P : P is the statement of a planning problem that has a solution}
Plan-Length = {(P, n) : P is the statement of a planning problem that has a solution
of length ≤ n}
• Look at complexity of recognizing Plan-Existence and Plan-Length under different conditions

Plan-Existence(规划存在性语言)

  • 定义:Plan-Existence 是由那些存在解决方案的规划问题陈述组成的集合。
  • 复杂性分析
    • 难易程度:Plan-Existence 是一个非确定性多项式时间(NP)语言。这是因为规划问题可能需要大量的计算资源来找到解决方案,但是如果有解决方案,我们可以用多项式时间验证它。
    • 验证:验证一个规划问题是否有解决方案是一个多项式时间问题。这可以通过检查所有可能的行动序列,看看是否存在一个序列将初始状态转换为目标状态来实现。

Plan-Length(规划长度语言)

  • 定义:Plan-Length 是由那些存在长度不超过 n 的解决方案的规划问题陈述组成的集合,其中 n 是一个给定的整数。
  • 复杂性分析
    • 难易程度:Plan-Length 是一个更复杂的语言,因为它要求找到最短的行动序列。这通常需要启发式搜索或更高级的搜索算法,如 A* 或遗传算法。
    • 验证:验证一个规划问题是否有长度不超过 n 的解决方案是一个更复杂的问题,因为它需要找到所有可能的解决方案,并确定哪个是最短的。

复杂性条件下的不同情况

  • 规划问题的复杂性

    • 规划问题的复杂性可以通过其状态空间的大小、行动空间的复杂性、目标结构的复杂性等因素来衡量。
    • 例如,一个规划问题可能具有非常复杂的初始状态和目标状态,这可能导致搜索空间非常大,从而增加规划问题的难度。
  • 计算资源

    • 规划问题的解决方案可能需要大量的计算资源,尤其是在状态空间非常大或目标结构非常复杂的情况下。
    • 规划问题的复杂性还受到可用计算资源的影响,例如,在有限的时间内找到解决方案的能力。

Complexity Classes
• Complexity classes:
NLOGSPACE (nondeterministic procedure, logarithmic space)
⊆ P (deterministic procedure, polynomial time)
⊆ NP (nondeterministic procedure, polynomial time)
⊆ PSPACE (deterministic procedure, polynomial space)
⊆ EXPTIME (deterministic procedure, exponential time)
⊆ NEXPTIME (nondeterministic procedure, exponential time)
⊆ EXPSPACE (deterministic procedure, exponential space)
• Let C be a complexity class and L be a language
— L is C-hard if for every language L′ ∈ C, L′ can be reduced to L in a polynomial
amount of time
NP-hard, PSPACE-hard, etc.
— L is C-complete if L is C-hard and L ∈ C
NP-complete, PSPACE-complete, etc.

复杂性类

  • NLOGSPACE:非确定性多项式空间复杂性类。它包含那些可以在对数空间内解决的问题,即使是在非确定性情况下。
  • P:确定性多项式时间复杂性类。它包含那些可以在多项式时间内解决的问题。
  • NP:非确定性多项式时间复杂性类。它包含那些可以在非确定性情况下在多项式时间内解决的问题。
  • PSPACE:确定性多项式空间复杂性类。它包含那些可以在多项式空间内解决的问题。
  • EXPTIME:确定性指数时间复杂性类。它包含那些可以在指数时间内解决的问题。
  • NEXPTIME:非确定性指数时间复杂性类。它包含那些可以在非确定性情况下在指数时间内解决的问题。
  • EXPSPACE:确定性指数空间复杂性类。它包含那些可以在指数空间内解决的问题。

复杂性类的包含关系

  • 这些复杂性类之间存在包含关系,其中每个复杂性类都是其前一个复杂性类的子集。
    • 例如,NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE。

C-hard 和 C-complete

  • C-hard:如果对于每个属于复杂性类 C 的语言 L’,L’ 都可以在多项式时间内被简化为语言 L,那么 L 是 C-hard 的。
  • C-complete:如果 L 是 C-hard 的并且 L 属于 C,那么 L 是 C-complete 的。

例子

  • NP-hard:这意味着对于任何 NP 语言,都可以在多项式时间内将其简化为该语言。
  • NP-complete:这意味着该语言是 NP-hard 的,并且它本身也是 NP 类的一部分。


Possible Conditions
1 Complexity of Classical Planning
• Do we give the operators as input to the planning algorithm, or fix them in advance?
• Do we allow infinite initial states? ← Not-classical planning
• Do we allow function symbols? ← Not-classical planning
• Do we allow negative effects?
• Do we allow negative preconditions?
• Do we allow more than one precondition?
• Do we allow operators to have conditional effects?*
i.e., effects that only occur when additional preconditions are true
→ These take us outside classical planning.

规划算法的输入

  • 操作符作为输入
    • 操作符(operators)是规划问题中定义的动作。如果操作符作为输入提供给规划算法,那么算法的复杂性可能会增加,因为规划器需要处理和评估更多的操作符。

初始状态的限制

  • 无限初始状态
    • 如果不允许无限初始状态,那么规划问题的复杂性可能会降低,因为规划器不需要处理无限多的初始状态。

谓词和符号

  • 允许函数符号
    • 允许函数符号可能会增加规划问题的复杂性,因为函数符号可以引入更复杂的对象关系和状态描述。

动作效果和前提条件

  • 允许负效果
    • 负效果意味着动作执行后,某些条件将不再成立。这可能会增加规划问题的复杂性,因为规划器需要考虑更多的状态变化。
    • 允许负前提条件
      • 负前提条件意味着动作执行前,某些条件必须不成立。这可能会增加规划问题的复杂性,因为规划器需要考虑更多的状态约束。
    • 允许多个前提条件
      • 多个前提条件意味着一个动作需要满足多个条件才能执行。这可能会增加规划问题的复杂性,因为规划器需要处理更复杂的动作执行条件。

条件效果

  • 允许操作符具有条件效果
    • 条件效果意味着动作的效果仅在满足额外前提条件时才会发生。这可能会增加规划问题的复杂性,因为规划器需要考虑更多的状态约束和动作效果。

Decidability of Planning


 Forward Search
• Progression planning is similar to the approaches seen in search
• Start with initial state, consider sequences of actions until we find a sequence that
reaches the goal state
• Specifying this type of planning problem requires
        — The initial state
        — The possible actions
        — The goal test
        — The step cost (typically 1 per action)• Without functions symbols →finite state space
        — Any graph search algorithm is complete
• But the state space is huge!
        — Until late 90s it was thought that this approach would fail
        — Very accurate heuristics needed to make this type of search work

状态空间

  • 无函数符号
    • 如果规划问题中不包含函数符号,那么状态空间是有限的。
    • 这是因为函数符号会增加状态空间的大小,导致状态空间无限增长。

Backward Search
• Regression planning moves from goals to initial states
• With STRIPS, it is easy to generate the possible predecessors of a set of goal states
— Consider only relevant actions,
i.e. actions that achieve one of the conjuncts of a goal
• Any existing solution can be found by backwards search allowing only relevant
actions
• Air cargo transportation with 10 airports, 5 planes (per airport) and 20 pieces of
cargo (per airport)
— Thousands of actions leading out of the initial state
— Only 20 actions working back from the goal.
• We ask what the states could be in which applying an action leads to the goal
• Computing these states is called regressing the goal through the action
At(C1, J F K) ∧ At(C2, S F O)
• The relevant action Unload(C1, p, J F K) achieves the first conjunct
• For this action to work, the preconditions have to be satisfied
• So any predecessor state must include In(C1, p) ∧ At(p, J F K)
• Intuitively, At(C1, J F K) should not be true in the predecessor state (else the action
would be irrelevant)
• The predecessor is thus: In(C1, p) ∧ At(p, J F K) ∧ At(C2, S F O)

 - Consistency
• An action should be consistent, i.e. they should not undo any desired literal
• Given a goal description G, and a relevant and consistent action A, we compute the
predecessor as follows:
1 Delete any positive effects of A from G
2 All precondition literals of A are added (unless they appear in G).
• Terminates when a predecessor is generated that is satisfied by the initial state
• In the first order case, substitution is required, e.g. the initial state
In(C1, P12) ∧ At(P12, J F K) ∧ At(C2, S F O)
is obtained via the substitution {p/P 12}
This substitution must be applied to actions leading from the state to the goal.

反向搜索的过程

  1. 从目标状态开始

    • 反向搜索从规划问题的目标状态开始,并尝试找到导致这些目标状态的初始状态。
  2. 生成可能的前驱状态

    • 使用STRIPS(Stanford Research Institute Problem Solver)风格,可以轻松生成一组目标状态的可能前驱状态。
    • 只考虑与目标相关的动作,即那些能够实现目标的一个合取项的动作。
  3. 前驱状态的计算

    • 反向搜索询问哪些状态在应用一个动作后可以导致目标状态。
    • 计算这些状态的过程称为通过动作反向推导目标。
    • 例如,给定目标状态 At(C1, JFK) ∧ At(C2, SFO),相关动作 Unload(C1, p, JFK) 实现了第一个合取项。
    • 要使这个动作起作用,前提条件必须得到满足。
    • 因此,任何前驱状态都必须包括 In(C1, p) ∧ At(p, JFK)
    • 直观上,目标状态中的 At(C1, JFK) 应该在前驱状态中为假(否则动作就无关紧要了)。
    • 因此,前驱状态是 In(C1, p) ∧ At(p, JFK) ∧ At(C2, SFO)

一致性

  • 动作的一致性
    • 动作应该是一致的,即它们不应该撤销任何我们想要的文字(literal)。
    • 给定一个目标描述 G 和一个相关且一致的动作 A,我们计算前驱状态如下:
      1. 从 G 中删除 A 的任何正效果。
      2. 将 A 的所有前提条件文字添加到 G 中(除非它们已经在 G 中)。
    • 这些步骤会持续进行,直到生成一个由初始状态满足的前驱状态。

初始状态的获取

  • 替换
    • 在一阶情况下,可能需要进行替换。例如,通过替换 {p/P12} 从初始状态 In(C1, P12) ∧ At(P12, JFK) ∧ At(C2, SFO) 得到。
    • 同样,对于从该状态到目标的动作,也需要应用这个替换。

Heuristics
• Neither search is efficient without a good heuristic
• In STRIPS planning
— actions cost 1
— distance is plan-length (number of actions)
• Possible heuristic:
— Look at the effects of actions and number of goals
— Guess how many actions needed to achieve goal
— Difficult, but reasonable estimates are possible
• With an admissible heuristic, use A∗ to find the optimal solution

Creating Heuristics

Hamming Distance

汉明距离(Hamming Distance)是信息论中用来衡量两个等长字符串(在自动规划中通常是规划问题的状态描述)之间差异的一种方法。它是通过比较两个字符串对应位置的字符是否相同,以此来计算它们之间的差异数量。

以下是关于汉明距离的详细解释:

定义

  • 汉明距离
    • 两个字符串之间的汉明距离是这两个字符串对应位置的字符不同的数量。
    • 例如,对于字符串 “1010” 和 “1001”,它们之间的汉明距离是2,因为第二个字符和第四个字符不同。

计算方法

  • 逐位比较
    • 计算汉明距离的方法是逐位比较两个字符串,统计不同的字符数量。
    • 例如,对于字符串 “1010” 和 “1001”,比较过程如下:
      • 第一位:都是1,相同。
      • 第二位:0和0,相同。
      • 第三位:1和0,不同。
      • 第四位:0和1,不同。
    • 因此,汉明距离是2。

应用

  • 自动规划
    • 在自动规划中,汉明距离可以用来比较两个状态描述之间的差异。
    • 如果两个状态的汉明距离较小,那么它们之间的差异较小,这可能意味着从一个状态到达另一个状态所需的行动序列较短。
    • 因此,汉明距离可以作为启发式方法,帮助规划器在搜索过程中选择更接近目标状态的状态。

Planning Graphs
• All heuristics we’ve seen so far have limitations
— Most fast heuristics are inadmissible (but can be really fast)
• Many planning approaches use a data structure called Planning Graph from which
we can derive very efficient (and accurate) heuristics

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值