Planning Volker Sorge Intro to AI: Logical Knowledge - - PowerPoint PPT Presentation

planning
SMART_READER_LITE
LIVE PREVIEW

Planning Volker Sorge Intro to AI: Logical Knowledge - - PowerPoint PPT Presentation

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World Planning Volker Sorge Intro to AI: Logical Knowledge Representation Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World


slide-1
SLIDE 1

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Planning

Volker Sorge

slide-2
SLIDE 2

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Logical Knowledge Representation

◮ Knowledge is represented as logical sentences. ◮ Each sentence is self-contained ◮ Representation is flat

slide-3
SLIDE 3

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Advantage of Logic KR

◮ We have reasoning/proof procedures for a knowledge

base.

◮ We can easily determine incosistency. ◮ We can infer new conclusions from the given knowledge

base or proof the correctness of new propositions.

slide-4
SLIDE 4

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Applications of Logic in AI

There are many applications of logic KR and reasoning. For example:

◮ Automated Theorem Proving ◮ Constraint Solving ◮ Satisfiability Solving ◮ Description logics for the Semantic Web

Some of these will be discussed in the second year module Reasoning. We will have a look at the use of Logic in reprsenting states and operators in AI planning.

slide-5
SLIDE 5

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Planning: Introduction

◮ Planning is a type of problem solving where states,

goals and actions are declaratively specified in logic.

◮ It generally is concerned with more abstract steps than

meticulous search, thereby modelling more closely real world actions and behaviour.

◮ Often subgoals are independent and problems can be

solved by divide and conquer.

slide-6
SLIDE 6

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Strips

◮ Initial state and goals logical sentences: conjunction of

(negated) predicates.

◮ Operators specify general actions by three sets of

predicates:

◮ Preconditions: have to hold for operator to be

applicable.

◮ Delete list: are deleted when operator is executed. ◮ Add list: are added when operator is executed.

◮ Operators usually contain variables that are instantiated

in current state.

◮ Find a sequence of instantiated operators that applied

to the start state delivers all the specified goals.

slide-7
SLIDE 7

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Plan Construction

We have two basic ways of constructing plans: Forward This is similar to regular search. We apply

  • perators to the start state until we fulfill all

the conditions of the goal state. Backward We apply operators inversely, to the goal state and then look to satisfy its preconditions. We do this until all the elements in the start state are represented as preconditions. In planning backward search is easier than in normal search, as the preconditions are generally given explicitly, hence we do not have to construct reverse actions first.

slide-8
SLIDE 8

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Algorithm: Forward (Progression) Planning

Input: Set of operators O, Start state s, Goal state g Output: Plan P

1 begin 2

let P = [];

3

while g ⊆ s do

4

let E = {a|a is ground instance of an operator in O, and Preconditions(a) hold in s};

5

if E = {} then

6

return failure

7

end

8

choose a ∈ E;

9

let s = s\ DeleteList(a)∪ AddList(a);

10

P = P@[a]

11

end

12

return P;

13 end

\

slide-9
SLIDE 9

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Algorithm: Backward (Regression) Planning

Input: Set of operators O, Start state s, Goal state g Output: Plan P

1 begin 2

let P = [];

3

while s ⊆ g do

4

let E = {a|a is ground instance of an operator in O, and AddList(a) hold in g};

5

if E = {} then

6

return failure

7

end

8

choose a ∈ E;

9

let g = g\ AddList(a)∪ Preconditions(a);

10

P = a :: P

11

end

12

return P;

13 end

slide-10
SLIDE 10

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Remarks on the Algorithms

◮ The notion of a ground instance refers to the

requirement that for an operator to be applicable all its variables have to be instantiated.

◮ Both algorithms contain a choose command, which

effectively is non-deterministic choice. Here we can backtrack to in search or apply heuristics to express preference.

◮ In Backward Planning we use the fact that the delete

list is a subset of the preconditions.

slide-11
SLIDE 11

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: Idea

◮ This is a classic example. We stack blocks on a table

using a robotic arm.

slide-12
SLIDE 12

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: First Attempt

Let’s formulate start state and goal state using logic predicates On and Handempty: Start State:

On(A,Table)∧On(D,A)∧On(C,D)∧On(Empty,C)∧On(B,Table)∧On(Empty,B)∧Handempty

Goal State:

On(B,Table)∧On(D,B)∧On(A,D)∧On(Empty,A)∧On(C,Table)∧On(Empty,C)∧Handempty

Note, that

◮ Empty and Table are used to represent explicitly that a

block is accessible or sitting on the table.

◮ we usually omit the formal conjunction ∧.

slide-13
SLIDE 13

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: Operators

We design operators for picking up a block and putting it down:

PICKUP(x,y) Preconditions: On(Empty,x), On(x,y), Handempty Delete List: On(Empty,x), On(x,y), Handempty Add List: On(Empty,y), Holds(x) PUTDOWN(x,y) Preconditions: Holds(x), On(Empty,y) Delete List: Holds(x), On(Empty,y) Add List: On(Empty,x), On(x,y), Handempty

slide-14
SLIDE 14

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: Operators (ctd.)

◮ Operators are parameterised with variables that have to

be grounded (i.e., instantiated) for the operator to be applicable.

◮ We introduce the predicate Hold to express that a the

robot arm holds a block.

◮ While in the above example preconditions and delete list

are the same for each operator, this is not always the

  • case. Consider an operator, to pick up red blocks only.

Precondition would include Red(x), which would not be deleted, as the block will stay red even after we have picked it up.

slide-15
SLIDE 15

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: Operator Application

Forward Planning: Start State: On(A,Table), On(D,A), On(C,D), On(Empty,C), On(B,Table), On(Empty,B), Handempty Matching Operator: PICKUP(C,D) Next State: On(A,Table), On(D,A), On(C,D), On(Empty,C), On(B,Table), On(Empty,B), Handempty, On(Empty,D), Holds(C) Backward Planning: Goal State: On(B,Table), On(D,B), On(A,D), On(Empty,A), On(C,Table), On(Empty,C), Handempty Matching Operator: PUTDOWN(C,Table) Previous State: On(B,Table), On(D,B), On(A,D), On(Empty,A), On(C,Table), On(Empty,C), Handempty, Holds(C), On(Empty, Table)

slide-16
SLIDE 16

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world: Some Problems

From the operator applications we can observe that our current domain formulation exhibits a couple of problems:

◮ When forward planning we would need to put the block

down onto the table, however, this is currently not possible, as we are missing an On(Empty, Table).

◮ In backward planning we get the desired On(Empty,

Table), however, the only realistic move is now to stack

  • n top of A, which leads to the planner being stuck.

◮ If we are not careful in defininig our operators, we

might be able to pickup empty or table, which we certainly would not want to do. We possibly could fix some of these problems, e.g., by adding a constant state On(Empty, Table), this would be rather messy.

slide-17
SLIDE 17

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world (2): Second Attempt

In the light of the shortcompings of our first attempt, let’s reformulate the problem, by only reifying blocks, and instead having predicates that explicitly state if a block is on the table and/or clear. Start State: Ontable(A), Ontable(B), On(D,A), On(C,D),

Clear(C), Clear(B), Handempty

Goal State: Ontable(B), Ontable(C), On(D,B), On(A,D),

Clear(A), Clear(C), Handempty

slide-18
SLIDE 18

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world (2): Operators

We now also reformulate our operators, with explicit stacking and unstacking operations.

PICKUP(x) Preconditions: Clear(x), Ontable(x), Handempty Delete List: Clear(x), Ontable(x), Handempty Add List: Holds(x) PUTDOWN(x) Preconditions: Holds(x) Delete List: Holds(x) Add List: Clear(x), Ontable(x), Handempty STACK(x,y) Preconditions: Holds(x), Clear(y) Delete List: Holds(x), Clear(y) Add List: Clear(x), On(x,y), Handempty UNSTACK(x,y) Preconditions: Clear(x), On(x,y), Handempty Delete List: Clear(x), On(x,y), Handempty Add List: Holds(x), Clear(y)

slide-19
SLIDE 19

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Blocks world (2): Example Operator Application

Start State: Ontable(A), Ontable(B), On(D,A), On(C,D), Clear(C), Clear(B), Handempty Matching Operator: UNSTACK(C, D) New State: Ontable(A), Ontable(B), On(D,A), On(C,D), Clear(C), Clear(B), Handempty, Holds(C), Clear(D) Matching Operator: PUTDOWN(C) New State: Ontable(A), Ontable(B), On(D,A), Clear(B), Holds(C), Clear(D), Clear(C), Ontable(C), Handempty . . . Plan: [ UNSTACK(C,D), PUTDOWN(C), UNSTACK(D,A), STACK(D,B), PICKUP(A), STACK(A,D) ]

slide-20
SLIDE 20

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

State Space vs Plan Space

◮ Strips effectively produces single, linear plans by

searching through reachable states.

◮ Often we are interested in whether there are

  • ther/better plans.

◮ Instead of painstakingly enumerating every solution, we

want to combine plans as much as possible.

◮ Find a solution that commits as little as possible to a

fixed order of operator applications.

◮ Moreover, problems can often be effectively

decomposed into independent subproblems.

slide-21
SLIDE 21

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Partial Order Planning

Searches through different possible plans by

◮ Division of problem into (partially) independent

subproblems

◮ Solve subproblems independently ◮ Derive final plans by adding ordering constraints and

combining partial solutions

slide-22
SLIDE 22

Intro to AI: Lecture 6 Volker Sorge Background Planning Example Domain: Blocks World

Other Planning Techniques

◮ Hierarchical Planning: Combine primitive operators into

more high level operators and plan top down.

◮ Graph Plan: Use a graph structure with nodes as

  • perators/actions and edges to indicate if they enable
  • r disable other actions.

◮ SAT Plan: Compile problem and operators into

propositional logic and solve a satisfiability problem.