Вы находитесь на странице: 1из 41

Lectures on Planning

Chris Handy Centre for Knowledge Management March 2004

PLANNING
Definition Planning is an important topic in artificial intelligence, cognitive psychology, neurobiology, business management, manufacturing science and engineering, satellite control, and a host of other subjects.
2

PLANNING
Definition In AI, planning involves the generation of an action sequence or action program for an agent, such as a robot or a software system or a living artefact, that can alter its surroundings.
3

PLANNING
Definition For instance, the purpose of a plan may be to guide and enable a robot to fetch an object, say A, and place on top of another object, say B.

PLANNING
Definition
For instance, the purpose of a plan may be to guide and enable a robot to fetch an object, say A, and place on top of another object, say B.

Note that in the above example: the action -- fetching -- has been defined
explicitly, the initial state is clearly described -- an object A and an object B, such that A can be placed on top of B, the goal for the robot or the software system is 5 clearly outlined.

PLANNING
Definition Planning has also been described as one of the reliable method for controlling the behaviour of living and artificial agents, which may not be the fastest of the methods and, perhaps, not the only one.
6

PLANNING
Definition

Planning implies the notion of synthesis: synthesis of actions, goals, initial states.
7

PLANNING
Definition
Planning is sometimes contrasted with the retrieval and application of stored behaviour programs.
The later includes a number of 'routine' activities performed by humans: for example, handling hot surfaces and utensils; opening and closing doors and windows etc. In familiar situations little or no overt planning is in evidence, however the predominance of stored behaviour is quite noticeable.
8

PLANNING It is in the handling of novel situations or critical situations that we see the a substantial planning-related activities: examination of initial states, a collection of actions for transforming the initial states and a set of goals.
9

PLANNING
Definitions of a plan, a planning system, and an operator in a planning context
Definition a: A plan is a defined as a prescription for a sequence of actions that, if followed, will change the relations among objects so as to achieve a desired goal.
10

PLANNING
Definition b A planning system performs the following functions:

1. Choice

The system can choose the best rule to apply next based on the best available heuristic information The system can apply the chosen rule to compute the new problem state that arises from its application. The system can detect when a solution has been found The system can abandon deadends and can direct its efforts to more fruitful avenues.

2. Application

3. Detection 4. Abandonment

11

PLANNING
Definition c An operator in planning is essentially a if-then-delete rule; the if conditions of each operator are called prerequisites. The operator can, for example, used to describe an action moving a block, clearing some space and so on.

12

THE BLOCKS WORLD


The 'blocks world' was amongst the favourite topics in AI: there were Ph D theses, there were learned papers, conferences and so on during the late sixties and the early seventies. The 'blocks world' is an imaginary two-dimensional world comprising: A number of (usually distinctly labelled) square blocks; The square blocks can be arranged to form stacks; A table of unbounded size.
13

THE BLOCKS WORLD


The BLOCKS world states can be described by three kinds of literals

CLEAR (x)

There is no block on top of x

ON (x, y)

Block x rests directly on block y

HOLDING A hand of an agent holding (x) block x The initial state description for a completely known world consists of a conjunction of these 14

THE BLOCKS WORLD - EXAMPLE 1


Consider the following initial and final states of a 'world' that comprises a table and three blocks: A, B, C:

A C A
Initial State

B B C
Goal State
15

THE BLOCKS WORLD - EXAMPLE 1


The initial state of the above 'world' can be described in terms of the literals as follows: CLEAR (C) ON (C, A) ON (A, Table) CLEAR (B) ON (B, Table)
16

THE BLOCKS WORLD - EXAMPLE 2 Consider blocks A, B, C, and D which are on a table.
The initial situation is as follows: Block A is on block C, and block D on block B. The goal situation is: Block A is on top of block B, B is on C, and C is on the table; block D is also on the table. In the following generic operators the mapping 17 to the above is: A x, C y and D z

THE BLOCKS WORLD - EXAMPLE 2


Three operators: The operators are made up of the literals explained above and are shown below:

Operator 1:

/* Move block x from block y to block z */

IF

ADD LIST DELETE LIST

ON (x, y) CLEAR (x) CLEAR (z) ON (x, z) CLEAR (y) On (x, y) CLEAR (z)
18

THE BLOCKS WORLD - EXAMPLE 2


Operator 2: /* Move block x from block y to Table*/ IF

ON (x, y) ON (x, Table) CLEAR (y)

ADD LIST

DELETE LIST

ON (x, y)

19

THE BLOCKS WORLD - EXAMPLE 2


Operator 3:

/* Move block x from Table to block z */ IF

ADD LIST DELETE LIST

ON (x, Table) CLEAR (x) CLEAR (z) ON (x, z) CLEAR (y) ON (x, Table) CLEAR (z).

20

Search strategy not breadth first but backward chaining


A simple breadth-first search will mean that every operator will have to be tried and instantiated in every possible way, as long as the operators' pre-requisites are satisfied. This approach will lead to an exponential tree growth in the search space.
21

Search strategy not breadth first but backward chaining


In order to conduct a more intelligent search for the final situation in that the sequencing of the operators has to be more carefully organised the breadth-first search. The goal is described here by only a few assertions that must hold for the problem to be solved, whereas any full description of a situation involves many more assertions. Backward chaining search is, therefore, more appropriate than a forward chaining search.
22

Search strategy
Initial Situation On (A, C) Clear (A) On (D, B) Clear (D) On (C, Table) On (B, Table)

not breadth first but backward chaining


Operator 1 If On (A, C) Clear (A) Clear (B) Add On (A, B) Clear (C) Delete On (A, C) Clear (B) Goals On (A, B)

Initial Situation On (A, C) Clear (A) On (D, B) Clear (D) On (C, Table) On (B, Table)

Operator 2 If On (D, B) Clear (D) Add On (D, Table) Clear (B) Delete On (D, B)

Operator 1 If On (A, C) Clear (A) Clear (B) Add On (A, B) Clear (C) Delete On (A, C) Clear (B) Operator 1

Goals On (A, B)

Initial Situation On (A, C) Clear (A) On (D, B) Clear (D) ON (C, Table) ON (B, Table)

Operator 2 If On (D, B) Clear (D) Add On (D, Table) Clear (B) Delete On (D, B)

Goals On (A, B)

If

On (A, C) Clear (A) Clear (B)

Add

On (A, B) Clear (C)

Delete

On (A, C) Clear (B)

Three steps toward constructing a plan for achieving a simple goal using backward chaining. All links shown are Establishes links. Most of them tie an addition in one instantiated operator to a prerequisite .in another instantiated operator, thus creating an ordering constraint between the tow operators. Other Establishes links are connected to initial-situation 23 assertions or goal assertions.

Search strategy

not breadth first but backward chaining

24

Search strategy
Initial Situation On (A, C) Clear (A) On (D, B) Clear (D) On (C, Table) On (B, Table) Add

not breadth first but backward chaining


Operator 1 Operator 2 If On (D, B) Clear (D) On (D, Table) Clear (B) Delete On (D, B) Delete Add If On (A, C) Clear (A) Clear (B) On (A, B) Clear (C) On (A, C) Clear (B) Goals On (A, B On (B, C))

Initial Situation On (A, C) Clear (A) On (D, B) Clear (D) On (C, Table) On (B, Table) Delete Add Operator 2 If On (D, B) Clear (D) On (D, Table) Clear (B) On (D, B)

Operator 1 If On (A, C) Clear (A) Clear (B) Add On (A, B) Clear (C) Delete On (A, C) Clear (B)

Goals On (A, B) On (B, C)

Operator 3 If On (B, Table) Clear (B) Clear (C) Add Delete On (B, C) On (B, Table) Clear (C)

Construction of a plan for achieving tow goal assertions using backward chaining. All links shown are Establishes links. The top portion deals with moving block A onto block B; the bottom portion adds an operation intended to move block B onto block 25 C. The plan is flawed because operator 1 interferes with an Establishes link between operator 2 and operator 3.

CONDITIONAL PLANNING
Conditional planning, also known as contingency planning, deals with incomplete information by constructing a conditional pllan that accounts for each possible situation or contingency that may arise. Conditional planning differs from the ideal planning and execution discussed in the beginning of this lecture. We dealt with cases where we were dealing worlds that are accessible, static and deterministic and the action descriptions must be correct and complete describing all the consequences exactly. Contingencies are dealt on a one by one basis and the planning program finds out which part of the plan to execute by including sensing actions in the plan to test for the 26 appropriate conditions.

CONDITIONAL PLANNING
A worked example Consider the problem of repairing the flat tyre of a car. The following literals describe the location and the state of the malfunctioning tyre: Tyre x is on (the car) On (x) Off(x) Intact (x) Inflated (x) Flat(x) ClearHub (x) Tyre x is off (the car) Tyre x is intact Tyre x is inflated Tyre X is Flat Tyre x is not on the hub
27

CONDITIONAL PLANNING
The following operators will help in fixing the tyre:
Table 1

Operator 1:

/* Remove Tyre x*/ IF Add list On (x) Off (x) ClearHub (x) Delete list On (x)

28

CONDITIONAL PLANNING
Table 2

Operator 2:

/* Put Tyre x On */ IF Off (x) ClearHub(x) Add list Delete list On (x) ClearHub(x) Off(x)

29

CONDITIONAL PLANNING
Table 3

Operator 3:

/* Inflate Tyre x*/ IF Intact (x) Flat(x) Add list Delete list Inflated (x) Flat(x)

30

CONDITIONAL PLANNING
The typical goal can be described as: On(x) ^ Inflated (x), with the initial conditions: Inflated (Spare) ^ Intact (Spare) ^ Off(Spare) ^ On(Tyre1) ^ Flat (Tyre1) The standard plan to repair the car will be as follows: [Remove (Tyre1), PutOn(Spare)]

31

Dealing with incomplete information


In the above example we have assumed that the tyre was not intact: the description of the initial conditions does not use the operator intact. It is quite possible that when the tyre of a car is flat it may be due to the fact tyres need to be pumped at regular intervals in that they always leak air, albeit very slowly.
32

STAGES OF THE PLANNING PROCESS


The planning process can be described through six stages: Stage1 : The plan has the typical Start and Finish states. The initial condition suggests that Tyre1 is a Flat tyre and that we have an Inflated spare tyre to replace the Flat tyre.

Start

On(Tyre1) Flat (Tyre1) Inflated (Spare)

On(x) Inflated (x)

Finish

33

STAGES OF THE PLANNING PROCESS


Stage2 : There are two open conditions to be resolved: On(x) and Inflated(x). The first is satisfied by unifying the literal On in both the initial and final state by the variable Tyre1 . The second is satisfied by adding the step Inflate(Tyre1). Recall that the Inflate operator has antecedent conditions Flat and Intact. The first antecedent literal (Flat) is satisfied by linking it with the same literal in the Start state. However, we have a problem with the Intact literal. There is no action schema with the effect Intact, that is in the statement of the problem 34 there are no actions that can make the tire intact.

STAGES OF THE PLANNING PROCESS


Start
On(Tyre1) Flat (Tyre1) Inflated (Spare) On(x) Inflated (x)

Finish

Flat (Tyre1) Intact ((Tyre1)

Inflate(Tyre1)

35

STAGES OF THE PLANNING PROCESS


Stage3 : In the conditional planning systems, as opposed to conventional planning systems which will abandon Stage2 now and pursue other goals if they can, one can add an action Check(x) : Operator 4: /* Check Tyre x*/ IF Add list Tyre (x) KnowsWhether(Intact(x))

This operator helps in determining the truth value of the proposition that unifies with Intact(x). The check tyre operation helps in conditional planning through the addition of a conditional link to the Inflate(Tyre1) operation. Such a step is called a conditional step because it will become a branch point in the final plan.
36

STAGES OF THE PLANNING PROCESS


Start
On(Tyre1) Flat (Tyre1) Inflated (Spare) On(Tyre1) Inflated (Tyre1)

Finish
(Intact (Tyre1))

Check(Tyre1 )

Intact (Tyre1)

Flat (Tyre1) Intact ((Tyre1)

Inflate(Tyre1)
(Intact (Tyre1))

37

STAGES OF THE PLANNING PROCESS


Stage4 : This involves planning for the eventuality that Tyre1 may not be Intact. Therefore, the tyre cannot be Inflated and has to be replaced by the Spare tyre. There are now two alternative Finish states depending upon whether or not Tyre1 was intact or not Start
On(Tyre1) Flat (Tyre1) Inflated (Spare) Flat (Tyre1) Intact Intact (Tyre1) 1) ((Tyre On(Tyre1) Finish Inflated (Tyre1)

(Intact (Tyre1))

Inflate(Tyre1)
(Intact (Tyre1))

Check(Tyre1)

On(x) Inflated (x)

Finish

( Intact (Tyre1))
38

STAGES OF THE PLANNING PROCESS


Stage5: The Inflated (Spare) literal in the Start state can be unified with the alternative Finish states literal of the same name but comprising a variable ) On(Tyre1 x. On(Tyre1) Finish Start Flat (Tyre1) Inflated (Tyre )
Inflated (Spare)
1

(Intact (Tyre1))

Flat (Tyre1) Inflate(Tyre1) Intact ((Tyre1)

Check(Tyre1)

Intact (Tyre1)

(Intact (Tyre1))

On(Spare) Inflated (Spare)

Finish
( Intact (Tyre1))

39

STAGES OF THE PLANNING PROCESS


Stage6: The final stage of planning now involves the addition of the operators Remove(Tyre1) and PutOn(Tyre1). The PutOn operator has the consequent (literal) On and this can be unified by its counterpart in the second of the two Finish states. Our plan to fix the Tyre is now complete. On(Tyre1) On(Tyre1) Finish Start Flat (Tyre )
1

Inflated (Spare)

Inflated (Tyre1) (Intact (Tyre )) 1

Check(Tyre1)

Flat (Tyre1) Inflate(Tyre ) 1 Intact ((Tyre1) (Intact (Tyre1)) Intact (Tyre )


1

Intact (Tyre1)
Remove(Tyre1)
( Intact (Tyre1))

On(Spare) Finish Inflated ( Intact (Tyre1)) (Spare)

PutOn(Tyre1)
(

Intact (Tyre1))

40

STAGES OF THE PLANNING PROCESS


Such an algorithm is called Conditional Partial-Order Planner or CPOP for short.

41

Вам также может понравиться