0% found this document useful (0 votes)
2 views

unit5_Planning

Chapter 5 discusses planning in artificial intelligence, emphasizing the importance of creating a sequence of actions to achieve specific goals. It covers types of planning, such as classical and nonclassical planning, and introduces the Block World problem as a practical example. Additionally, it explains components of planning systems, including the STRIPS approach and the use of expert systems like MYCIN.

Uploaded by

eeshasingh2501
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

unit5_Planning

Chapter 5 discusses planning in artificial intelligence, emphasizing the importance of creating a sequence of actions to achieve specific goals. It covers types of planning, such as classical and nonclassical planning, and introduces the Block World problem as a practical example. Additionally, it explains components of planning systems, including the STRIPS approach and the use of expert systems like MYCIN.

Uploaded by

eeshasingh2501
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Planning

Chapter 5:
Artificial Intelligence (UCS411)

Thapar Institute of Engineering and Technology, Patiala


[email protected]

Prof. Mukesh Singh (EIED) Artificial Intelligence 1 / 43


Chapter 5: Planning

Chapter Content
• Planning as search
• Partial order planning
• Construction and use of planning graphs
• Existing expert systems like MYCIN, RI, Expert system shells.

Prof. Mukesh Singh (EIED) Artificial Intelligence 2 / 43


Planning

• Planning is the task of coming up with a sequence of actions


that will achieve the goal.
• A plan is a sequence of actions and each action has its own set
of preconditions to be satisfied before performing the action
and also some effects which can be positive or negative.

Goal : To attend a class


1 Start from home.
2 Go to the college.
3 Attend the class.

Prof. Mukesh Singh (EIED) Artificial Intelligence 3 / 43


Planning in AI
• The planning is about the decision making performed by intelligent agents like robots,
humans, or computer programs when trying to achieve some goal.
• It involves choosing a sequence of actions that will (with a high likelihood) transform
the initial state to the goal state.
• The world is usually regarded as being made up of atomic facts (state variables), and
action(s) make some facts real and some facts false.

Summary
• Planning is arranging a sequence of actions to achieve a goal
• Each action has its own set of preconditions
• All the preconditions to be satisfied before performing the action
• Some effects can be either positive or negative

Prof. Mukesh Singh (EIED) Artificial Intelligence 4 / 43


Planning

Types of Planning in AI
1 Classical planning
• fully observable, deterministics, finite, static and discrete
2 Nonclassical planning
• Partially observable or stochastic ennvironment
• The nonclassical planning involves a different set of algorithms
and agent designs

Prof. Mukesh Singh (EIED) Artificial Intelligence 5 / 43


Block World to understand Planning

Objects
• Blocks: A,B,C
• Table: Table

Predicates
• (On A, B),(On C, table),Clear (B), (arm-empty), (holding C)
• (On table A), (On A, C), (top B),....

States-Conjunctive
• (On A, B) and (On B, C) and (clear A) and (on C table) and
(arm-empty)

Prof. Mukesh Singh (EIED) Artificial Intelligence 6 / 43


Example of Planning

Prof. Mukesh Singh (EIED) Artificial Intelligence 7 / 43


Block World Problem- Fundamental
• A flat surface such a table top
• An adequate set of identical blocks which are identified by letters
• The blocks can be stacked one upon another
• There is a robot arm that can manupulate the blocks
• The robot can hold one block at a time and only one block can be moved at a time
• Any number of blocks can be on the table

The actions it can perform include


UNSTACK(A, B)
• remove block A from block B
• The arm must be empty
• block A must have no blocks on top of it

STACK(A, B)
• put block A on block B
• The arm must already be holding A
• the surface of B must be clear

Prof. Mukesh Singh (EIED) Artificial Intelligence 8 / 43


Actions

PICKUP(A)
• pickup block A from the table
• The arm must be empty and there must be nothing on top of A
• the surface of B must be clear

PUTDOWN(A)
• put block A on the table
• The arm must have been holding block A

The following predicates are needed to perform an operation

• ON(A, B): Block A is on Block B


• ONTABLES(A): Block A is on the table
• CLEAR(A):There is nothing on the top of Block A
• HOLDING(A):The arm is holding Block A
• ARMEMPTY: The arm is holding nothing

Prof. Mukesh Singh (EIED) Artificial Intelligence 9 / 43


Notations
Logical Notations for block
[∃x:HOLDING(x)]→ ¬ARMEMPTY
If the arm is holding anything, then it is not empty

∀x: ONTABLE(x)→¬∃y:ON(x,y)
If a block is on the table, then it is not also on another block

∀x:[¬∃y:ON(y,x)]→CLEAR(x)
Any block with no blocks on it, is clear

Prof. Mukesh Singh (EIED) Artificial Intelligence 10 / 43


Components of a Planning system

In problem solving systems, it s necessary to perform each of the


following functions:
1 Choose the best rule based upon heuristic information
2 Apply this rule to create a new state
3 Detect when a solution has been found
4 Detect dead ends so that they can be avoided
5 Detect when almost correct solution has been found and
employ special techniques to make it totally correct.

Prof. Mukesh Singh (EIED) Artificial Intelligence 11 / 43


Components of a Planning system....

1. Choose the best rule based upon heuristic information


• Finding the difference between the current and the goal states
• Then choose the best rules that reduce these differences most
effectively
• Ex: Means-Ends analysis
• Wishing to travel by car to visit a friend
• First→ fill up the car with fuel.
• If no car→ acquire one
• Largest difference must be tackled first

Prof. Mukesh Singh (EIED) Artificial Intelligence 12 / 43


Components of a Planning system
2. Apply this rule to create a new state
• In simple systems, applying rules is easy. Each rule simply specified problem state that
would result from its application
• In complex systems, we must be able to deal with rules that specify only a small part
of the complete problem state
• One way is to describe, for each action, each of the changes it makes to the state
description.
• A number of approaches have been used for this task.

I. Green Approach
Basically, a given state was described by a set of predicates representing the facts that were
true in that state. Each state was represented explicitly as part of the predicate. A simple
blocks world description

ON(A, B, S0 ) ∧ ONTABLE(B, S0 ) ∧ CLEAR(A, S0 )

Prof. Mukesh Singh (EIED) Artificial Intelligence 13 / 43


Green Approach...

If wanted to UNSTACK(A, B), the operation is expressed as follows:

[CLEAR(x, s)∧ ON(x, y, s)]→ [HOLDING(x, Do(UNSTACK(x, y), S)]∧ CLEAR(y, Do(UNSTACK(x, y),
S))

The ressult of applying this to state S0 to give S1 by applying UNSTACK is

HOLDING(A, S1 ) ∧ CLEAR(B, S1 )

One problem with this approach is, B is still on the table.


And this needs to be encoded into frame axioms that describes components of the state
not affected by the operator. So it must be

ONTABLE(Z, S)→ ONTABLE(Z, Do( UNSTACK(x, y), S))

If want to color the blocks, an axiom used is,

COLOR(x, c, s)→ COLOR(x, c, Do(UNSTACK(y, z), s))

Prof. Mukesh Singh (EIED) Artificial Intelligence 14 / 43


II. STRIPS Approach

STRIPS- Stanford Research Institute Planning System


• A mechannism that doesnot require a large number of explicit
frame axioms.
• Basically each operator has 3 lists of predicates associated
with it.
• Each operation is described by a
• List of new predicates that become TRUE called ADD
• List of old predicates that become FALSE called DELETE
• List contains those predicates that must be true for the operator
to be applied called as PRECONDITION
• Anything not in these lists is assumed to be unaffected by the
operation

Prof. Mukesh Singh (EIED) Artificial Intelligence 15 / 43


STRIPS...

PRECONDITION
PRECONDITION: list of predicates that must be true for an
operator to be applied.

Effect
ADD: list of new predicates that an operator causes to become
true.
DELETE: list of old ppredicates that an operator causes to become
false.

Predicates not in ADD nor DELETE are unaffacted.

Prof. Mukesh Singh (EIED) Artificial Intelligence 16 / 43


STRIPS

Prof. Mukesh Singh (EIED) Artificial Intelligence 17 / 43


STRIPS...

STACK(X,Y)
P: CLEAR(Y)∧ HOLDING(X)
D: CLEAR(Y)∧HOLDING(X)
A: ARMEMPTY ∧ON(x, y)

UNSTACK(X,Y)
P: ON(x, y)∧ CLEAR(X)∧ARMEMPTY
D: ON(x,y)∧ ARMEMPTY
A: HOLDING(x) ∧CLEAR(y)

PICKUP(X)
P: CLEAR(x)∧ONTABLE(x)∧ARMEMPTY
D: ONTABLE(x)∧ARMEMPTY
A: HOLDING(x)

PUTDOWN(X)
P: HOLDING(x)
D: HOLDING(x)
A: ONTABLE(x)∧ARMEMPTY

Prof. Mukesh Singh (EIED) Artificial Intelligence 18 / 43


STRIPS Example: For Action Puckup (C)

Precondition
Precondition: armempty ∧ clear(C)

Prof. Mukesh Singh (EIED) Artificial Intelligence 19 / 43


Asssignemnt 1

Example of Planning problem Air Cargo Transport

• Action (Fly(p,from,to))
• At(p,from)∧ Plane(p)∧Airport(from)∧ Airport(to)
• ¬At(p, from)∧At(p,to)

This is also known as an action schema. Please develop a STRIPS


method of Cargo handling at any Airport. Try to Keep three cargo
to be picked up and trasported to another city.

Prof. Mukesh Singh (EIED) Artificial Intelligence 20 / 43


Goal Stack Planning- Solving Compound Goals
• It is an important algorithm in Planning.
• STRIPS Language is used to complete the specified task.
• In the algorithm, a Stack is maintained with actions.
• A database is used to hold the current state and actions.
• A sequence of actions is gathered as a separated list.

Basic Idea to handle interactive compound goals uses goal stacks, Here the stack contains :
• Goals
• Operators- ADD, DELETE and PREREQUISITE lists
• A database maintaining the current situation for each operator used.

Prof. Mukesh Singh (EIED) Artificial Intelligence 21 / 43


GSP

start state
ON(B,A)∧ONTABLE(A) ∧ONTABLE(C)∧ONTABLE(D)∧ARMEMPTY

Goal State
ON(C,A)∧ON(B,D)∧ONTABLE(A)∧ONTABLE(D)

• Initially the goal stack is the goal state.


• We then split the problem into four subproblems
• Two are solved as they already are true in the initial state -ONTABLE(A), ONTABLE(D).

Prof. Mukesh Singh (EIED) Artificial Intelligence 22 / 43


With other two- there are two ways to proceed:

ON(C,A)
ON(B,D)
ON(C,A) ∧ ON(B,D) ∧ONTABLE(A) ∧ONTABLE(D)

ON(B,D)
ON(C,A)
ON(C,A) ∧ ON(B,D) ∧ONTABLE(A) ∧ONTABLE(D)

Prof. Mukesh Singh (EIED) Artificial Intelligence 23 / 43


Algorithm

Push the Goal state in to the Stack


Push the individual Predicates of the Goal State into the Stack
Loop till the Stack is empty
Pop an element E from the stack
IF E is a Predicate
IF E is True then
Do Nothing
ELSE
Push the relevant action into the Stack
Push the individual predicates of the Precondition of the action into the Stack
Else IF E is an Action
Apply the action to the current State.
Add the action ‘a’ to the plan

Prof. Mukesh Singh (EIED) Artificial Intelligence 24 / 43


Goal State Planning Example 2

Prof. Mukesh Singh (EIED) Artificial Intelligence 25 / 43


Goal State Planning Example 2...

Prof. Mukesh Singh (EIED) Artificial Intelligence 26 / 43


Goal State Planning Example 2...

Prof. Mukesh Singh (EIED) Artificial Intelligence 27 / 43


Goal State Planning Example 2...

Prof. Mukesh Singh (EIED) Artificial Intelligence 28 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 29 / 43


Goal State Planning Example 2...

Prof. Mukesh Singh (EIED) Artificial Intelligence 30 / 43


Goal State Planning Example 2.....

Prof. Mukesh Singh (EIED) Artificial Intelligence 31 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 32 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 33 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 34 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 35 / 43


Goal State Planning Example 2.....

Prof. Mukesh Singh (EIED) Artificial Intelligence 36 / 43


Goal State Planning Example 2....

Prof. Mukesh Singh (EIED) Artificial Intelligence 37 / 43


Final Plan

Prof. Mukesh Singh (EIED) Artificial Intelligence 38 / 43


Summary for Goal Stack Planning

• Goal state is like a node in a search tree, if there is a choice of


action, we create branches
• Planning helps the agent for fast and efficient execution of
the actions to achieve specified goals.

Prof. Mukesh Singh (EIED) Artificial Intelligence 39 / 43


Expert System
• An expert system tool, or shell, is a software development environment containing the
basic components of expert systems.
• Associated with a shell is a prescribed method for building applications by
configuring and instantiating these components.
• Expert system shells are basically used for the purpose of allowing
non-programmers to take advantage of the already developed templates or shells
and which have evolved because of the efforts of some pioneers in programming who
have solved similar problems before.
• The core components of an expert systems are the knowledge base and the
reasoning engine.

Prof. Mukesh Singh (EIED) Artificial Intelligence 40 / 43


MYCIN

Mycin was one of the earliest expert systems, and its design has strongly influenced the
design of commercial expert systems and expert system shells.

Intro
• Mycin was an expert system developed at Stanford in the 1970s.
• Its job was to diagnose and recommend treatment for certain blood infections.
• To do the diagnosis “properly”, it involves growing cultures of the infecting
organism.
• Unfortunately this takes around 48 hours, and if doctors waited until this was
complete their patient might be dead!
• So, doctors have to come up with quick guesses about likely problems from the
available data, and use these guesses to provide a “covering” treatment where
drugs are given which should deal with any possible problem.
• Mycin was developed partly in order to explore how human experts make these
rough (but important) guesses based on partial information.

Prof. Mukesh Singh (EIED) Artificial Intelligence 41 / 43


MYCIN

Mycin represented its knowledge as a set of IF-THEN rules with certainty factors. The
following is an English version of one of Mycin’s rules:

Mycin Rules
IF the infection is pimary-bacteremia
AND the site of the culture is one of the sterile sites
AND the suspected portal of entry is the gastrointestinal tract
THEN there is suggestive evidence (0.7) that infection is bacteroid.

The 0.7 is roughly, the certainty that the conclusion will be true given the evidence.
If the evidence is uncertain the certainties of the bits of evidence will be combined with the
certainty of the rule to give the certainty of the conclusion.

Prof. Mukesh Singh (EIED) Artificial Intelligence 42 / 43


Assignements

Assignement
1 Discuss the role of RI Expert System Shell along with its logic.
2 Provide the benefits of Expert System Shell and its application
area.
3 Discuss the role of Tuple in planning with 3 examples.
4 Discuss the role of planning graph for block world problem.

Prof. Mukesh Singh (EIED) Artificial Intelligence 43 / 43

You might also like