artificial intelligence and lisp #8 state-space characterization of actions algorithmic planning

29
Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Post on 22-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Artificial Intelligence and Lisp #8

State-space Characterization of Actions

Algorithmic Planning

Page 2: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

State-space Ontology of Actions

• The structures in lab2 implement this ontology

• Purpose: unified treatment for several ways of representing the preconditions and effects of actions

• It is also the basis for planning algorithms

• Start from a set F of features and an assignment of a range for each feature

• Consider the space of all feature states R; each of them is a mapping from features to values, and there may be restrictions on what combinations of values are possible

• A complete feature state assigns a value to all members of F, a partial feature state does not. Complete is the default.

• A development D is a mapping from integers from 0 and up, to feature states. (Similar to episodes in Leonardo)

Page 3: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

State-space Ontology, continued

• Basic case: An action is a pair <pre, post> where pre and post are partial states over the same set of features

• The application of an action <pre, post> on a complete state R is defined iff pre R, and is then defined as the state (R – pre) + post

• A plan is a sequence of actions <... <pre.i, post.i>>

• The execution of such a plan from a state R is a development <R.0, R.1, … R.n> where R = R.0 and R.i is the application of <pre.i, post.i> on R.i-1. The plan is applicable to R iff all the applications are defined.

• More complex cases: An action as a set of pairs <pre, post> or as a probability distribution involving those

Page 4: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

The Classical Planning Problem

• Given:

• The base case of the state-space ontology for actions

• A space of feature states

• A set of actions in this space, often called Σ

• A specific member of the state space, called the starting state

• A specific partial state, called the goal state

• Desired:

• A finite sequence of actions whose execution from the starting state ends in a state having the goal state as a subset

Page 5: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

An example for classical planning

• In the zoo world, Groucho the gorilla has fallen from a tree and broken his leg

• The operation on the leg must be done under anaesthezia

• A sequence of steps must be taken in order to get Groucho out of his cage, taken to the animal hospital, anaesthesized, etc.

• This also requires him not to eat or drink during a certain period before the operation

Page 6: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

An example that is not suited for classical planning

• In the zoo world, the gorillas Groucho and Bronx have been in a fight over the beautiful Gredelina

• Groucho was bitten and the wound is infected and must be treated

• If Groucho is removed to the hospital then Bronx will be alone with Gredelina, which means the wardens have taken sides; this would be unwise

• Therefore, Gredelina must first be taken to another cage, then Groucho is to be removed, and the treatment can start

Page 7: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

An example that is not suited for classical planning

• In the zoo world, the gorillas Groucho and Bronx have been in a fight over the beautiful Gredelina

• Groucho was bitten and the wound is infected and must be treated

• If Groucho is removed to the hospital then Bronx will be alone with Gredelina, which means the wardens have taken sides; this would be unwise

• Therefore, Gredelina must first be taken to another cage, then Groucho is to be removed, and the treatment can start

• In this example, the first plan contained an undesirable side-effect, and the plan had to be modified in order to avoid that side-effect

Page 8: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Uses of Action Planning in Agents• Intelligent command execution: the “goal” was stated as a

command by the user

• Maintain good state: the “goal” characterizes the desired state of the agent; agent planning is used to correct deviations from this state

• Grasping opportunities: the agent has a capability for recognizing situations that can maybe be transformed to a rewarding situation using some of the available actions

• Resolution of precondition failure during the agent's operation. (Notice the possibility of organizing the overall operation of a software system in terms of actions)

• Some steps in some of the agent's programs are only defined in terms of goal state, e.g. concerning the needs for particular information in order to be able to proceed.

Page 9: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Limited expressivity of the basic case of the ontology for actions

• Or: Generalizations of the basic case that one must introduce in some applications

• Conditional effects of actions: several <pre,post> containing different pre

• Nondeterministic actions: several <pre, post> containing the same pre

• Probabilistic actions: several <pre,post> and a probability distribution over those having the same pre

• The definitions of action application and of a development has to be generalized accordingly

• But: the study of the base case is the necessary start before proceeding to the above

Page 10: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Technical simplificationsfor defining planning algorithms

• Assume that features can only have the values true or false

• Assume atomic features, i.e. written as a single symbol and not a composite expression

• A feature state {[: a true][: b false][: c false]} is abbreviated as {a, -b, -c}

• None of these is an essential restriction

Page 11: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Formal definition of the classical planning problem

• Let F be the set of features in the planning problem

• Let R(0) be the starting state and G the goal state

• Let Σ be the set of actions and, for each a in Σ,

• S(a) = <p, e> = <p(a), e(a)>

• where p (precond) and e (effect) are partial states over the same subset of F

• For a plan (composite action) <a1, a2, … an>, let

• R(k) = (R(k-1) - p(a)) + e(a) if p(a) R(k-1)

• A plan is a solution to the planning problem iff all R(i) are well defined and G R(k)

• Variants of the problem will be addressed later on.

Page 12: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Planning as state-space search

• Most obvious approach: search the tree of possible action applications. (Progressive planning)

• Alternative: search ’backwards’ from the (complete) goal state. (Regressive planning)

• Related idea: middle-out planning (try to identify natural intermediate steps)

• Other related idea: hierarchical planning (use actions on several levels)

• All of these approaches are based on search in the state space

Page 13: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Many other aspects of the planning problem

• Integrating planning and prediction (requires progressive planning; leads to an agenda architecture)

• More sophisticated action descriptions, e.g. probabilistic ones, allowing side-effects, or allowing concurrency

• Plan revision• Combine with path planning (continuous movement)• Combine with scheduling• Planning of conversation and other social interactions• Algorithms that exploit particular characteristics of the planning

problem as stated above• Complexity analysis of planning algorithms with particular restrictions

on action descriptions• Adding further information that has the effect of constraining the

search• Color: requires extended ontology, will be addressed here

Page 14: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Partial-Order Planning (POP)

• Basic idea: Make a search in the space of partial plans.

• Start with the empty partial plan• Transform to successively larger partial plans

until a satisfactory one has been found• Maintain annotation of the partial plan during

this process, in order to make it efficient• .

Page 15: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

The annotated partial plan

• A set N of actions, taken from the set Σ of all available actions

• A set of ordering constraints on members of N, written as in A < B

• A set of causal links written as in A [u]-> B where u is an assignment of a value to a feature

• A set of open preconditions of the actions in N, each of which is an assignment of a value to a feature

• Restriction: each open precondition element must appear in the precond of some action to which there is no causal link

• One more restriction…

Page 16: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Start and Finish

• Two artificial actions are added to the set Σ of actions:

• Start = <0, starting state>• Finish = <goal state, 0>• where 0 is the empty set• The ordering constraints must contain Start < A A < Finish for all members of N except themselves.

Page 17: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Initial partial plan

• {Start, Finish}• { Start < Finish }• Empty set of causal links• Goal state

Page 18: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Causal links and conflicts

• A [u]-> B means that ”A achieves u for B”, i.e. u is one of the postconditions of A, it is a precondition of B, and there is no action between A and B that changes the value of u.

• The causal link A [u]-> B conflicts with an action C iff C overrides u and neither C<A nor B<C is in the ordering

• The conflict can be resolved by adding C<A or B<C to the ordering constraints, provided that this does not create a circularity for the < relation

Page 19: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Consistency and solution

• A partial plan is consistent iff (1) there are no cycles in its ordering <, (2) its causal links do not have any conflicts

• A consistent partial plan is a solution to the POP planning problem iff its set of open preconditions is empty.

Page 20: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

An example of POP(classical planning problem)

• R.0 = {u,v,w,x}

• G = {-u, -w}

• A = <{u,v},{-u,v}>

• B = <{w,x},{-w,-x}>

• C = <{u,-x},{u,x}>

• The following two actions are added:

• Start = <0, {u,v,w,x}>

• Finish = <{-u, -w}, 0>

• Choose N = {Start, Finish}

• Initial partial plan: <N, {Start < Finish}, {}, G>

Page 21: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Solution partial plan

• Set of actions: {Start, A, B, Finish}

• Ordering: Start < A < Finish, Start < B < Finish

• Causal links: Start [u]-> A, Start [v]-> A,

• Start [x]-> B, Start [w]-> B,

• A [-u]-> Finish, B [-w]-> Finish

• Final state after executing the plan: {-u,v,-w,-x}

Page 22: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Algorithm of Partial-Order Planning

• Given R.0, Σ and G as above, select N = {Start, Finish}, Σ' = Σ u N, and initial partial plan as

• <N, {Start < Finish}, {}, G>

• In each cycle until termination:

• Pick one of the nodes, i.e. available partial plans, call it PP

• In that node, pick an open precondition u in the fourth element of PP. Let B be the action where u is a precond.

• Pick an action A that has u as an effect

• If A is not yet in N then add A to N and Start < A to ordering

• Always add A < B to the ordering

• Add A [u]-> B to the causal links [continued]

Page 23: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Continued

• If necessary, add ordering constraints to < so that the resulting PP is consistent i.e. it does not contain any conflicts

• Revise the fourth element of PP so that it is the set of all preconditions that are not supported by a causal link

• If a consistent PP can be constructed in this way then add it to the search graph (unless it is already there)

• Termination conditions:

• If the new node is a solution, the terminate with success

• If no new node can be added then terminate with failure

• Special consideration:

• If selected action is already in N then create duplicate

Page 24: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Simple extensions of planning problem and of state-space ontology

• Allow each action to be mapped to a set of precondition-postcondition pairs. Consequently:

• If an action is mapped to several pairs containing different preconditions then it is deterministic with conditional effects

• If an action is mapped to several pairs containing the same precondition then it is nondeterministic

• Allow the starting state to be partial

Page 25: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Effects of these generalizations

• If all the actions are deterministic, and the starting state is complete, then the problem can be reduced to (i.e. transformed to) the original action planning problem

• A partial starting state means that plans must be written so that they can accommodate to the situation at hand, e.g. using information-acquiring actions

• Nondeterministic actions suggest a need for conditional actions

Page 26: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Ways of characterizing action laws

• Directly in terms of the state-space ontology, as has been the case in this lecture

• Using precondition/ effect rules, as has been done in lab 2b

• Define each action as a causal net of the kinds used in lab 3

• Define each action as a script whereby it is reduced to assignment statements

• Define as a script also allowing other types of statements, e.g. occlusion statements

Page 27: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Elimination of arguments of actions[Do .t [pour .fr .to]] = [if [and [H- .t (substance-in: .to) empty] (not [H- .t (substance-in: .fr) empty ])] [coact [H! .t (substance-in: .to) (cv (substance-in: .fr)) ] [H! .t (substance-in: .fr) empty ]] ]

Precondition:{[: (substance-in: glass1) milk] [: (substance-in: glass2) empty]}Postcondition:{[: (substance-in: glass1) empty] [: (substance-in: glass2) milk]}

This must be repeated for all choices of glasses and contents!

Page 28: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Elimination of arguments of actions

• One action law expressed as a script may correspond to many precond/postcond pairs in the state-transition ontology

• Computationally, there are algorithms that are able to process very large sets of such elementary action descriptions, but...

• Expressivity remains an issue

• On the theoretical side, the state transition ontology serves as a semantics for other representations, in particular for those using logic formulas or scripts

Page 29: Artificial Intelligence and Lisp #8 State-space Characterization of Actions Algorithmic Planning

Strengths and weaknesses of state-space-based action planning

• Strength: systematic algorithms exist

• Strength: complexity results exist for some restricted cases, and some of them are computationally tractable

• Strength: progressive planning integrates well with prediction, which is needed in many cognitive-robotics applications

• Strength and weakness: actions with arguments must (and often, can) be converted to variable-free form, large size

• Weakness: expressivity is insufficient for many practical situations

• Weakness: computational properties are not always good enough in practice for large problems

• Use of logic-based methods is a way of obtaining higher expressivity

• Use of constraint-based methods often obtains better results for very large planning problems

• These approaches will be addressed in the next three lectures