Unit-2: Problems, State Space Search & Heuristic
Unit-2: Problems, State Space Search & Heuristic
Unit-2: Problems, State Space Search & Heuristic
3170716
Unit-2:
Problems, State Space
Search & Heuristic
Search Techniques
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 4
State and State Space Representation
A state is a representation of problem elements at a given moment.
A state space is the set of all possible states reachable from the initial state.
A state space forms a graph in which the nodes are states and the arcs between nodes are
actions.
In a state space, a path is a sequence of states connected by a sequence of actions.
The solution of a problem is a part of the graph formed by the state space.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 5
Define the Problem as State Space Search
To provide a formal description of a problem, we need to do the following:
1. Define a state space that contains all the possible configurations of the relevant objects.
2. Specify one or more states that describe possible situations, from which the problem solving process may
start. These states are called initial states.
3. Specify one or more states that would be acceptable solution to the problem. These states are called goal
states.
Specify a set of rules that describe the actions (operators) available.
The problem can then be solved by using the rules, in combination with an appropriate control
strategy, to move through the problem space until a path from an initial state to a goal state is
found. This process is known as ‘search’.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 6
State Space Representation - Play Chess
Consider the problem of “Playing Chess”, to build a program that could play chess, we have to
specify,
1. The starting position of the chess board,
2. The rules that define legal moves.
3. And the board position that represent a win.
1. Initial Position of the chess board : The starting position can be described by an 8 X 8 array
square in which each element square (x, y) describes the board position of an appropriate
piece in the official chess opening position.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 7
State Space Representation - Play Chess
2. The rules that define legal moves
The legal moves provide the way of getting from initial state of final state.
It can be described as a set of rules consisting of two parts: A left side that gives the current position and
the right side that describes the change to be made to the board position.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 8
State Space Representation – Water Jug
Problem Definition: You are given two jugs, a 4-gallon one and a 3-gallon one, a pump which has
unlimited water which you can use to fill the jug, and the ground on which water may be poured.
Neither jug has any measuring markings on it. How can you get exactly 2 gallons of water in the
4-gallon jug?
1. Initial State
We will represent a state of the problem as a tuple (x, y), where x represents the amount of water in the 4-
gallon jug and y represents the amount of water in the 3-gallon jug.
Note that 0 ≤ x ≤ 4, and 0 ≤ y ≤ 3.
Here the initial state is (0, 0). The goal state is (2, n) for any value of n.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 9
State Space Representation – Water Jug
2. Production Rules
3 (x, y) If x>0 (x-d, y) pour some water out of the 4- gallon jug
4 (x, y) If y>0 (x, y-d) pour some water out of the 3- gallon jug
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 10
State Space Representation – Water Jug
2. Production Rules
7 (x, y) If x + y >= 4 & y>0 (4,y-(4-x)) pour water from the 3- gallon jug
into the 4-gallon jug until the 4- gallon jug is full
8 (x, y) If x + y >= 3 & x>0 (x-(3-y),3)) pour water from the 4- gallon jug
into the 3-gallon jug until the 3- gallon jug is full
9 (x, y) If x + y <= 4 & y>0 (x+y,0) pour all the water from the 3-
gallon jug into the 4-gallon jug
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 11
State Space Representation – Water Jug
2. Production Rules
10 (x, y) If x + y <= 3 & x>0 (0,x+y) pour all the water from the 4 -
gallon jug into the 3-gallon jug
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 12
Water Jug – Solution
3. Productions for the water jug problem
0 0
0 3 2
3 0 9
3 3 2
4 2 7
0 2 5 or 12
2 0 9 or 11
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 13
State Space Representation – 8 Puzzle
Problem Definition: The 8 puzzle consists of eight numbered, movable tiles set in a 3x3 frame.
One cell of the frame is always empty thus making it possible to move an adjacent numbered
tile into the empty cell. Such a puzzle is illustrated in following diagram.
2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 14
State Space Representation – 8 Puzzle
A solution to the problem is an appropriate sequence of moves, such as “move tiles 5 to the
right, move tile 7 to the left ,move tile 6 to the down” etc…
2 8 3 2 8 3
1 6 4 1 4
7 5 7 6 5
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 15
1 2 8 3
1 6 4
7 5
2 8 3 2 2 8 3 2 8 3
8 Puzzle - Game Tree
1 6 4 1 4 1 6 4
7 5 7 6 5 7 5
3 2 8 3 4 2 3 2 8 3
1 4 1 8 4 1 4
7 6 5 7 6 5 7 6 5
8 3 2 8 3 5 2 3 2 3
2 1 4 7 1 4 1 8 4 1 8 4
7 6 5 6 5 7 6 5 7 6 5
6 1 2 3
8 4
7 6 5
7 1 2 3 1 2 3
8 4 7 8 4
7 6 5 6 5
Problem Characteristics
1. Is the problem decomposable into a set of independent smaller or easier sub-problems?
2. Can solution steps be ignored or at least undone if they prove unwise?
3. Is the problem’s universe predictable?
4. Is a good solution to the problem obvious without comparison to all other possible solutions?
5. Is the desired solution a state of the world or a path to a state?
6. Is a large amount of knowledge absolutely required to solve the problem or is knowledge
important only to constrain the search?
7. Can a computer that is simply given the problem return the solution or will the solution of the
problem require interaction between the computer and a person?
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 17
Chess Analysis with Respect to Seven Problem Characteristics
Can solution steps be ignored or at least undone No Wrong move can’t be undone
Is the problem’s universe predictable No Moves of other player can not be predicted
Is a good solution absolute or relative? Absolute Winning position need not be compared
Is the solution a state or a path? Path Not only solution but how it is achieved also matters
What is the role of knowledge? Domain specific knowledge is required to constrain search
Does the task require Interaction with a person? No Once all rules are defined, no need for interaction
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 18
8 Puzzle Analysis with Respect to Seven Problem Characteristics
Problem Characteristics Satisfied Justification
Can solution steps be ignored or at least undone Yes We can undo the previous move
Is the problem’s universe predictable Yes Problem Universe is predictable, it is a single person game
Is a good solution absolute or relative? Absolute Winning position need not be compared
Is the solution a state or a path? Path Not only solution but how it is achieved also matters
What is the role of knowledge? Domain specific knowledge is required to constrain search
Does the task require Interaction with a person? No In 8 puzzle additional assistance is not required
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 19
Production System
Production systems provide appropriate structures for performing and describing search
processes.
A production system has four basic components:
1. A set of rules each consisting of a left side that determines the applicability of the rule and a right side that
describes the operation to be performed if the rule is applied.
2. A database of current facts established during the process of inference.
3. A control strategy that specifies the order in which the rules will be compared with facts in the database
and also specifies how to resolve conflicts in selection of several rules or selection of more facts.
4. A rule applier.
Production systems provide us with good ways of describing the operations that can be
performed in a search for a solution to a problem.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 20
Production System Characteristics
1. A monotonic production system is a production system in which the application of a rule
never prevents the later application of another rule that could also have been applied at the
time the first rule was selected.
2. A non-monotonic production system is one in which this is not true. This production system
increases the problem-solving efficiency of the machine by not keeping a record of the
changes made in the previous search process.
3. A partially communicative production system is a production system with the property that if
the application of a particular sequence of rules transforms state P into state Q, then any
combination of those rules that is allowable also transforms state P into state Q.
4. A commutative production system is a production system that is both monotonic and partially
commutative. These type of production systems is used when the order of operation is not
important, and the changes are reversible.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 21
Issues in the Design of Search Programs
1. The direction in which to conduct the search (forward versus backward reasoning). If the
search proceeds from start state towards a goal state, it is a forward search or we can also
search from the goal, i.e., backward search.
2. How to select applicable rules (Matching). Production systems typically spend most of their
time looking for rules to apply. So, it is critical to have efficient procedures for matching rules
against states.
3. How to represent each node of the search process (knowledge representation problem).
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 22
Search Techniques
Introduction
Search Techniques can be classified as:
1. Uninformed/Blind Search Control Strategy:
Do not have additional information about states beyond problem definition.
Total search space is looked for the solution.
Example: Breadth First Search (BFS), Depth First Search (DFS), Depth Limited Search (DLS).
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 24
Uninformed Search Techniques
✓ A ✓ A
✓ B ✓ C ✓ B C✓
✓
✓ D ✓ E F✓ G ✓ D ✓ E F✓ G ✓
H✓ ✓ H
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 25
Difference Between DFS & BFS
Depth First Search Breath First Search
DFS requires less memory since only the nodes BFS guarantees that the space of possible moves is
on the current path are stored. systematically examined; this search requires
considerably more memory resources.
By chance, DFS may find a solution without The search systematically proceeds testing each
examining much of the search space at all. node that is reachable from a parent node before it
Then it finds a solution faster. expands to any child of those nodes.
If the selected path does not reach to the BFS will not get trapped exploring a blind alley.
solution node, DFS gets stuck into a blind alley.
Does not guarantee to find solution. If there is a solution, BFS is guaranteed to find it.
Backtracking is required if wrong path is
selected.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 26
Heuristic Search Techniques
Every search process can be viewed as a traversal of a directed graph, in which the nodes
represent problem states and the arcs represent relationships between states.
The search process must find a path through this graph, starting at an initial state and ending in
one or more final states.
Domain-specific knowledge must be added to improve search efficiency.
The Domain-specific knowledge about the problem includes the nature of states, cost of
transforming from one state to another, and characteristics of the goals.
This information can often be expressed in the form of Heuristic Evaluation Function.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 27
Visiting each District of Gujarat State
• Start with any random city.
• Go to the next nearest city.
Nearest Neighbor
Heuristic
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 28
Heuristic Search Techniques
Heuristic function maps from problem state descriptions to the measures of desirability,
usually represented as numbers.
The value of the heuristic function at a given node in the search process gives a good estimate
of whether that node is on the desired path to a solution.
Well-designed heuristic functions can play an important role in efficiently guiding a search
process toward a solution.
In general, heuristic search improves the quality of the path that is explored.
In such problems, the search proceeds using current information about the problem to predict
which path is closer to the goal and follow it, although it does not always guarantee to find the
best possible solution.
Such techniques help in finding a solution within reasonable time and space (memory).
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 29
Heuristic Search Techniques
Some prominent intelligent search algorithms are stated below:
1. Generate and Test Search
2. Best-first Search
3. A* Search
4. Constraint Search
5. Means-ends analysis
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 30
Generate and Test Strategy
Generate-and-test search algorithm is a very simple algorithm that guarantees to find a solution
if done systematically and there exists a solution.
Algorithm: Generate-And-Test
1.Generate a possible solution.
2.Test to see if this is the expected solution.
3.If the solution has been found quit else go to step 1.
Potential solutions that need to be generated vary depending on the kinds of problems.
For some problems the possible solutions may be particular points in the problem space and
for some problems, paths from the start state.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 31
Hill Climbing Example - Blocks World Problem
Start Goal
A D
0 4
D C
C B
B A
Local heuristic:
+1 for each block that is resting on the thing it is supposed to be resting on.
-1 for each block that is resting on a wrong thing.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 32
Hill Climbing Example - Blocks World Problem
Start Goal
A D
0 4
D D +1 C
2
C C +1 B
B -1 B A +1 A
0 A
D 0
C C D C 0
Local
heuristic: B B A B A D
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 33
Hill Climbing Example - Blocks World Problem
Start Goal
A -3 D +3
-6 6
D -2 C +2
C -1 B +1
B 0 A 0
Global heuristic:
For each block that has the correct support structure:
+1 to every block in the support structure.
For each block that has a wrong support structure:
-1 to every block in the support structure.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 34
Hill Climbing Example - Blocks World Problem
Start Goal
A D
-6 6
D D C
-3
C C B
B B A A
-6 A
D -2
C C D C -1
Global
heuristic: B B A B A D
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 35
Simple Hill Climbing - Algorithm
1. Evaluate the initial state. If it is also goal state, then return
it and quit. Otherwise continue with the initial state as the
current state.
2. Loop until a solution is found or until there are no new operators
left to be applied in the current state:
a. Select an operator that has not yet been applied to the current
state and apply it to produce a new state.
b. Evaluate the new state
i. If it is the goal state, then return it and quit.
ii. If it is not a goal state but it is better than the current state,
then make it the current state.
iii.If it is not better than the current state, then continue in the
loop.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 36
Drawbacks of Hill Climbing Local Maxima: a local maximum is a state that is better
than all its neighbors but is not better than some other
states further away.
To overcome local maximum problem: Utilize
backtracking technique. Maintain a list of visited states
and explore a new path.
Dr. Gopi Sanghani #3170716 (AI) Unit 2 –Problems, State Space Search & Heuristic Search Techniques 37
Steepest-Ascent Hill Climbing - Algorithm
1. Evaluate the initial state. If it is also a goal state, then return it
and quit. Otherwise, continue with the initial state as the current
state.
2. Loop until a solution is found or until a complete iteration produces no
change to current state:
a. Let S be a state such that any possible successor of the current state
will be better than S.
b. For each operator that applies to the current state do:
Apply the operator and generate a new state
Evaluate the new state. If it is a goal state, then return it and quit. If
not, compare it to S. If it is better, then set S to this state. If it is
not better, leave S alone.
c. If the S is better than the current state, then set current state to S.
In simple hill climbing, the first closer node is chosen, whereas in steepest ascent hill climbing all
successors are compared and the closest to the solution is chosen.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 38
Best First Search
DFS is good because it allows a solution to be found without expanding all competing
branches. BFS is good because it does not get trapped on dead end paths.
Best first search combines the advantages of both DFS and BFS into a single method.
One way of combining BFS and DFS is to follow a single path at a time, but switch paths
whenever some competing path looks more promising than the current one does.
At each step of the Best First Search process, we select the most promising of the nodes we
have generated so far.
This is done by applying an appropriate heuristic function to each of them.
We then expand the chosen node by using the rules to generate its successors.
If one of them is a solution, we can quit. If not, all those new nodes are added to the set of
nodes generated so far.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 39
Best First Search
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 40
How to find a better path
A Which Path is
p better?
q r s
B C D E
Compare
then is better
OR
a b c d If
then is better
Z
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 41
A* Example
h’(n): The function h’ is an estimate of the additional cost of
f’(n) = g(n) + h’(n) getting from the current node to a goal state.
A 6 4
6 E 4
13 6 1 0
5 3
17 S B 2
F G
7
10 4 D 6
C 6
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 42
A* Example
S
16 14
A
18
C
B
16 18
E D
31 17
B F
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 43
A* Example
S
16 14
A
18
C
B
16 18
E D
17
F
24 19
D G
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 44
A* Example
S
16 14
A
18
C
B
16 18
E D
23
36
17
B F
F
19
G
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 45
A* Example
S
16 14
A
18
C
B
16 18
14 15
E D E D
22 19
17
F C F
19
G
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 46
A* Example
S
16 14
A 18
C
B
16
14 15
E D E
16
27
17
F A F
19 23 18
G D G
# 3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 47
A* Example Solution
10
A 6 4
6 E 4
13 6 1 0
5 3
17 S B 2
F G
7
10 4 D 6
C 6
Total Cost = 18
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 48
The A* Algorithm
This algorithm uses following functions:
1. f’: Heuristic function that estimates the merits of each node we generate. f’ represents an estimate of the
cost of getting from the initial state to a goal state along with the path that generated the current node. f’ =
g + h’
2. g: The function g is a measure of the cost of getting from initial state to the current node.
3. h’: The function h’ is an estimate of the additional cost of getting from the current node to a goal state.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 49
The A* Algorithm
Step 1:
Start with OPEN containing only initial node.
Set that node’s g value to 0, its h’ value to whatever it is, and its f’ value to h’+0 or h’.
Set CLOSED to empty list.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 50
The A* Algorithm
Step 3: For each of the SUCCESSOR, do the following:
a. Set SUCCESSOR to point back to BESTNODE. These backwards links will make it possible to recover the
path once a solution is found.
b. Compute g(SUCCESSOR) = g(BESTNODE) + the cost of getting from BESTNODE to SUCCESSOR
c. See if SUCCESSOR is the same as any node on OPEN. If so call the node OLD.
i. Check whether it is cheaper to get to OLD via its current parent or to SUCESSOR via BESTNODE by comparing their
g values.
ii. If OLD is cheaper, then do nothing. If SUCCESSOR is cheaper then reset OLD’s parent link to point to BESTNODE.
iii. Record the new cheaper path in g(OLD) and update f‘(OLD).
iv. If SUCCESSOR was not on OPEN, see if it is on CLOSED. If so, call the node on CLOSED OLD and add OLD to the list
of BESTNODE’s successors.
v. If SUCCESSOR was not already on either OPEN or CLOSED, then put it on OPEN and add it to the list of BESTNODE’s
successors. Compute f’(SUCCESSOR) = g(SUCCESSOR) + h’(SUCCESSOR)
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 51
Problem Reduction
AND-OR graph (or tree) is useful for representing the solution of problems that can be solved by
decomposing them into a set of smaller problems, all of which must then be solved.
This decomposition or reduction generates arcs that we call AND arcs.
One AND arc may point to any numbers of successor nodes. All of which must then be solved in
order for the arc to point solution.
In order to find solution in an AND-OR graph we need an algorithm similar to best –first search
but with the ability to handle the AND arcs appropriately.
We define FUTILITY, if the estimated cost of solution becomes greater than the value of
FUTILITY then we abandon the search, FUTILITY should be chosen to correspond to a
threshold.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 52
AND-OR Graph
In following figure AND arcs are indicated with a line connecting all the components.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 53
AND – OR Graph
A A
(38)
(9) (18)
B D B C D
(5) (4)
C (17) (9)
(27)
(3) G H
E F (3) (4)
I J
(5) (10)
(15) (10)
# 3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 54
Heuristic Search Techniques for AO*
Traverse the graph starting at the initial node and following the current best path, and
accumulate the set of nodes that are on the path and have not yet been expanded.
Pick one of these unexpanded nodes and expand it. Add its successors to the graph and
computer f'(cost of the remaining distance) for each of them.
Change the f' estimate of the newly expanded node to reflect the new information produced by
its successors. Propagate this change backward through the graph. Decide which is the current
best path.
The propagation of revised cost estimation backward is in the tree is not necessary in A*
algorithm. This is because in AO* algorithm expanded nodes are re-examined so that the
current best path can be selected.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 55
Constraint Satisfaction
Many AI problems can be viewed as problems of constraint satisfaction.
For example, Crypt-arithmetic puzzle:
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 56
Initial state:
• Assign values between 0 to 9.
• No two letters have the same value.
Crypt-arithmetic Puzzle
1 1
S 9
9 5 6 7 E 5
N 6
1 0 8 5 D 7
M 1
1 0 6 5 2 O 0
R 8
Y 2
Iterative Deepening Search
Depth first search is incomplete if there is an infinite branch in the search tree.
Infinite branches can happen if:
paths contain loops
infinite number of states and/or operators.
For problems with infinite state spaces, several variants of depth-first search have been
developed: depth limited search, iterative deepening search.
Depth limited search expands the search tree depth-first up to a maximum depth 𝑙.
The nodes at depth 𝒍 are treated as if they had no successors.
Iterative deepening (depth-first) search (IDDS) is a form of depth limited search which
progressively increases the bound.
It first tries 𝑙 = 1, then 𝑙 = 2, then 𝑙 = 3, etc. until a solution is found at 𝑙 = 𝑑.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 58
Iterative Deepening Search
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 59
Means End Analysis
Most of the search strategies either reason forward of backward, Often a mixture of the two
directions is appropriate.
Such mixed strategy would make it possible to solve the major parts of problem first and solve
the smaller problems the arise when combining them together.
Such a technique is called Means - Ends Analysis.
The means -ends analysis process centers around finding the difference between current state
and goal state.
The problem space of means - ends analysis has
an initial state and one or more goal state,
a set of operate with a set of preconditions their application and difference functions that computes the
difference between two state a(i) and s(j).
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 60
Means End Analysis
The means-ends analysis process can be applied recursively for a problem.
Following are the main Steps which describes the working of MEA technique for solving a
problem.
First, evaluate the difference between Initial State and final State.
Select the various operators which can be applied for each difference.
Apply the operator at each difference, which reduces the difference between the current state and goal state.
In the MEA process, we detect the differences between the current state and goal state.
Once these differences occur, then we can apply an operator to reduce the differences.
But sometimes it is possible that an operator cannot be applied to the current state.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 61
Means End Analysis
So, we create the sub-problem of the current state, in which operator can be applied, such type
of backward chaining in which operators are selected, and then sub goals are set up to
establish the preconditions of the operator is called Operator Subgoaling.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 62
Algorithm : Means-Ends Analysis
1. Compare CURRENT to GOAL, if there are no differences between both
then return Success and Exit.
2. Else, select the most significant difference and reduce it by doing
the following steps until the success or failure occurs.
a. Select a new operator O which is applicable for the current difference, and
if there is no such operator, then signal failure.
b. Attempt to apply operator O to CURRENT. Make a description of two states.
i. O-Start, a state in which O?s preconditions are satisfied.
ii. O-Result, the state that would result if O were applied In O-start.
c. If (First-Part <------ MEA (CURRENT, O-START) And (LAST-Part <----- MEA (O-
Result, GOAL), are successful, then signal Success and return the result of
combining FIRST-PART, O, and LAST-PART.
#3170716 (AI) Unit 2 – Problems, State Space Search & Heuristic Search
Dr. Gopi Sanghani 63
Thank You!