Docsity

Planning - Artificial Intelligence Programming - Lecture Slides | CS 662, Study notes of Computer Science

Partial preview of the text

Download Planning - Artificial Intelligence Programming - Lecture Slides | CS 662 and more Study notes Computer Science in PDF only on Docsity!

Artificial Intelligence

Programming

Planning

Chris Brooks Department of Computer Science University of San Francisco

Planning

So far, we’ve looked at how to infer new knowledgeabout a problem, but we haven’t talked about using thisto select actions to take. Planning

is the task of selecting a sequence of actions

that will achieve a goal. Challenges:

Representing actions Dealing with large search spaces Taking advantage of problem decomposition

Department of Computer Science — University of San Francisco – p.1/

The Planning Problem

For example, a “Travel to Hawaii” plan can be brokeninto:

Buying tickets stage Packing stage Getting to the airport stage Flying on the plane stage

These problems are independent - the order in which Ipack things shouldn’t affect how I get to the airport. This means that we don’t need to solve these problemsin the order they’ll be executed.

Department of Computer Science — University of San Francisco – p.3/

Applications of Planning

Planning has been one of the most successful AItechnologies.

NASA’s Remote Agent, MARS rovers Autopilots Home Health Assistants Logistics coordination Beer factory production

Department of Computer Science — University of San Francisco – p.4/

Representation

A

goal

is a partially specified state.

A conjunction of positive literals, with not every statefeature specified. e.g.

In

Brooks, Hawaii

Has

Brooks, Suitcase

In

HawaiianShirt, Suitcase

(no mention of where my ticket is in the goal state)

Department of Computer Science — University of San Francisco – p.6/

Representing Actions

An action is specified in terms of

preconditions

and

effects

Preconditions indicate what must hold in order for theaction to be taken. Effects indicate how the action changes the world. Both may contain variables.

Action

BuyT icket

person, price, ticket

P reconditions

Costs

ticket, price

HasM oney

person, price

Ef f ects

Has

ticket, person

Has

person, price

Action

DriveT oAirport

person, loc

P reconditions

At

person, loc

Dif f erent

loc, Airport

Ef f ects

At

person, loc

At

person, Airport

Department of Computer Science — University of San Francisco – p.7/

Formulating a Planning Problem

Specify actions

RemoveT ire

tire

P reconditions

On

tire, Axle

Ef f ect

Clear

Axle

On

tire, Axle

On

tire, Ground

P utOnT ire

tire

P reconditions

On

tire, Ground

Clear

Axle

Ef f ect

On

tire, Axle

On

tire, Ground

Clear

Axle

T akeF romT runk

tire

P reconditions

In

tire, T runk

Ef f ect

On

tire, Ground

In

tire, T runk

P utInT runk

tire

P reconditions

On

tire, Ground

Ef f ect

In

tire, T runk

On

tire, Ground

Department of Computer Science — University of San Francisco – p.9/

Solving a Planning Problem

Now that we have a formalization for the problem, wecan try to apply our standard search techniques. We can search forward from the initial state to the goalstate. At each state, consider what actions are possible. Each potential action generates a new state. This is called progression planning.

Very similar to forward chaining.

Problem: Lots of irrelevant actions are considered. Doesn’t scale to complex domains.

Department of Computer Science — University of San Francisco – p.10/

Partial-order Planning

One problem with progression and regression planningis that they search for linear sequences of actions.

Often, subgoals can be solved in more than oneorder. It really doesn’t matter whether I buy my ticket beforeI pack.

Partial-order planning solves subgoals independently(as much as possible) and then combines subplans. No need to select steps in chronological order. Example: in planning my trip, I know I’ll need to buy aticket, pack, and get to the airport. I’ll figure out how todo each of those, then decide on an order later. This is called a

least commitment

strategy.

Department of Computer Science — University of San Francisco – p.12/

Partial-order Planning

Partial-order planning searches in the space of partially-completed plans

This is different from A*, BFS, regression planning, etc,which search in a space of

states

In search, our successor function returned allpossible actions and their resulting states. In planning, our successor function returns all morehighly refined plans. In other words, we only consider actions that can beseen to help us reach our goal.

Department of Computer Science — University of San Francisco – p.13/

Partial-order Planning

A

conistent plan

is one in which there are no cycles in

the ordering constraints. A consistent plan with no open preconditions is a solution

We can then

linearize

this plan to get a sequence of

actions. Any linearization of a partial-order plan will reach thegoal state.

Some linearizations might be more efficient thanothers.

Department of Computer Science — University of San Francisco – p.15/

POP algorithm

Initial plan contains

Start

F inish

Start

F inish

While (no solution)

Select an open precondition

p

on an action

B

Find each action

A

that satisfies that precondition;

generate a new plan for each action. for each of these plans:

Add ordering constraints

A

B

, plus causal links

A

p

B

Resolve any conflicts between causal links. If noconsistent plan exists, discard.

Department of Computer Science — University of San Francisco – p.16/

POP example

Open preconditions: On

SpareT ire, Axle

In

F latT ire, T runk

Pick

On

SpareT ire, Axle

, select

P utOnT ire

Add causal links, ordering constraints between P utOnT ire

and

F inish

New preconditions: In

F latT ire, T runk

, On

SpareT ire, Ground

, Clear

Axle

Pick

In

F latT ire, T runk

, select

P utInT runk

Add causal links, ordering constraints between P utInT runk

and

F inish

New Preconditions: On

SpareT ire, Ground

, Clear

Axle

, On

F latT ire, Ground

Department of Computer Science — University of San Francisco – p.18/

POP example

Pick

On

SpareT ire, Ground

, select

T akeF romT runk

Add ordering constraints and causal links between T akeF romT runk

and

P utOnT ire

, also between

Start

and

T akeF romT runk

New Preconditions:

Clear

Axle

, On

F latT ire, Ground

Select

RemoveT ire

Add ordering constraints and causal links between RemoveT ire

and

P utInT runk

We have a solution.

Department of Computer Science — University of San Francisco – p.19/