0% found this document useful (0 votes)
9 views78 pages

IT 228 Chapter3

The document discusses problem-solving through searching, outlining four general steps: goal formulation, problem formulation, search, and execution. It covers various uninformed search strategies such as breadth-first search, depth-first search, and uniform cost search, detailing their characteristics, completeness, optimality, and time and space complexities. Additionally, it introduces depth-limited search and iterative deepening search, highlighting their advantages and performance metrics.

Uploaded by

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

IT 228 Chapter3

The document discusses problem-solving through searching, outlining four general steps: goal formulation, problem formulation, search, and execution. It covers various uninformed search strategies such as breadth-first search, depth-first search, and uniform cost search, detailing their characteristics, completeness, optimality, and time and space complexities. Additionally, it introduces depth-limited search and iterative deepening search, highlighting their advantages and performance metrics.

Uploaded by

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

IT 228

Artificial
Intelligence
Unit 3: Informed and Uninformed Search
Problem Solving by Searching
Four general steps of problem Solving.
Goal Formulation: what are the world successful states?
Problem Formulation: the process of deciding what actions and states
to consider, and follows goal
Search: Determine the possible sequence of actions that lead to the
states of known values and then choosing the best sequence.
Execute: Give the solution perform the actions.

02/19/2025 Unit-3, Informed and Uninformed Search 2


Map of Bagmati Province

How can you travel to Chitwan from Ramechhap?

02/19/2025 Unit-3, Informed and Uninformed Search 3


Example: Romania
• On holiday in Romania; currently in Arad.
• Flight leaves tomorrow from Bucharest
• Formulate goal:
• be in Bucharest
• Formulate problem:
• states: various cities
• actions: drive between cities
• Find solution:
• sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

02/19/2025 Unit-3, Informed and Uninformed Search 4


Example: Romania

02/19/2025 Unit-3, Informed and Uninformed Search 5


02/19/2025 Unit-3, Informed and Uninformed Search 13
02/19/2025 Unit-3, Informed and Uninformed Search 14
Problem Formulation
A problem is defined by:

An initial state: state from which agent start.

Successor Function: description of possible actions available to the


agent.
Goal test: determine whether the given state is goal state or not.

Path Cost: sum of cost of each path from initial state to goal state.
A solution is a path from initial state to goal state.

02/19/2025 Unit-3, Informed and Uninformed Search 15


Measuring problem solving performance
Completeness: complete, if it definitely finds solution to the problem, if
exist.
Time Complexity: Time take to find a solution. Usually measured in
terms of the number of nodes expanded.
Space Complexity: Space is used by the algorithm. Usually measured in
terms of the maximum numbers of nodes in memory at a time.
Optimality/Admissibility: if a solution is found, is it guaranteed to be
an optimal?

02/19/2025 Unit-3, Informed and Uninformed Search 16


02/19/2025 Unit-3, Informed and Uninformed Search 17
Blind Search (Un-informed
Search)
Also known as “blind search,” uninformed search strategies use no
information about the likely “direction” of the goal node(s).
While searching you have no clue whether one non-goal state is
better than any other. Your search is blind. You don’t know if your
current exploration is likely to be fruitful.
Uninformed search methods: Breadth-first, depth-first, depth-limited,
uniform-cost, depth-first iterative deepening, bidirectional.
We call search algorithms that do not use any extra information
regarding the problem or our representation of the problem, “blind”.

02/19/2025 Unit-3, Informed and Uninformed Search 18


Un- Informed Search
• Breadth First Search
• Uniform Cost Search
• Depth First Search
• Depth Limited Search
• Iterative Deepening Search
• Bidirectional Search

02/19/2025 Unit-3, Informed and Uninformed Search 19


BFS (Breadth First Search)
Expand shallowest unexpanded node.
Fringe: node waiting in a queue to be explored.
Fringe is a FIFO queue, i.e., new successors got at the end of the
queue.

02/19/2025 Unit-3, Informed and Uninformed Search 20


02/19/2025 Unit-3, Informed and Uninformed Search 21
BFS : Example 1
1 2 3

4 5 6 7

BFS Solution: 1,2,4,5,7,3,6

02/19/2025 Unit-3, Informed and Uninformed Search 22


BFS : Example 2
1

2 3

4 5 6 7

Solution ?
BFS Solution: 1,2,3,4,5,6,7

02/19/2025 Unit-3, Informed and Uninformed Search 23


BFS Evaluation
Complete: Yes , if (b) is finite
Optimal: Yes (if cost=1 per step), not optimal in general
Time Complexity: O(bd)
Space Complexity: O(bd)

0=1, 1=2,2=4,3=8,4=16,5=32
20, 21, 22, 23, 24, 25
Time complexity: 0(bd)

Space is the big problem . (will discuss later)

02/19/2025 Unit-3, Informed and Uninformed Search 24


Cont..

02/19/2025 Unit-3, Informed and Uninformed Search 25


BFS Evaluation
Assuming branching factor=10, 1000 node/second; 1000s byte/ node :
TC and S O(bd)
Depth Nodes Time Space (memory)
bfs
0 100 1/1000 sec 1000 byte
2 100+101+102 111/1000 sec 1000*111
4 100+101+102+103+104 ? ?

6 ? ? ?
16 1016 350 years 10 Exabyte's

02/19/2025 Unit-3, Informed and Uninformed Search 26


Uniform Cost Search
• Breadth-first search finds the shallowest goal state, but this may not
always be the least-cost solution for a general path cost function.
• Uniform cost search modifies the breadth-first strategy by always
expanding the lowest-cost node on the fringe (as measured by the
path cost g(n)), rather than the lowest-depth node.
• Uniform cost search finds the cheapest solution provided a simple
requirement is met: the cost of a path must never decrease as we go
along the path. In other words, we insist that g(SUCCESSOR(n)) > g(n)
for every node n.

02/19/2025 Unit-3, Informed and Uninformed Search 27


Uniform Cost Search
Visited: S,A,B
Goal : S—B-- G

02/19/2025 Unit-3, Informed and Uninformed Search 28


Home work : Uniformed Cost Search 1
Find optimal path from Initial State to Goal state

S 6

D
5
9 6
2
A
3 2
C E
B 1
9
2 7 2 7
5
G1 G
3
G2

F 8
Depth-first search
Depth-first search always expands one of the nodes at the deepest
level of the tree.
Only when the search hits a dead end (a non-goal node with no
expansion) does the search go back and expand nodes at shallower
levels.
For a state space with branching factor b and maximum depth m
depth-first search requires storage of only (bm) nodes, in contrast to
the (bd) that would be required by breadth-first search in the case
where the shallowest goal is at depth d.
Expand deepest unexpanded note. Fringe is implemented as LIFO.
(=stack)

02/19/2025 Unit-3, Informed and Uninformed Search 30


Example:1
• DFS Traversal ?
1

2 3

4 5 6 7

02/19/2025 Unit-3, Informed and Uninformed Search 31


Solution
1

2 3

4 5 6 7

DFS Solution is: 1,2,4,5,3,6,7 (like preorder traversal)

02/19/2025 Unit-3, Informed and Uninformed Search 32


DFS Evaluation
Completeness: (Does it always find a solution if one exist?)
No , if search space is infinite and search spaces contains loop then
DFS may not find solutions.
Time Complexity:
Let m is the maximum depth of the search tree. In the worst case
scenario, solution may exist in depth m.
Root has b successors, each node at the next level has again b
successors (total b2).
Worst case; expand all the node except node at the depth m.
Total no of node generated: b +b2+b3+b4..........+bm= O(bm)

02/19/2025 Unit-3, Informed and Uninformed Search 33


Cont...
Space Complexity:
It needs to store only a single path from the root node to a leaf node,
along with remaining unexpanded sibling node for each node on the
path.
Total no. of nodes in memory: 1+b+b+b.....b m times O(bm)
Optimal:
DFS expand deepest node first, if expand entire left sub-tree even if right
sub-tree contains goal nodes at level 2 or 3. Thus we can say DFS may
not always give optimal solution

02/19/2025 Unit-3, Informed and Uninformed Search 34


DFS to solve Mazes

02/19/2025 Unit-3, Informed and Uninformed Search 35


DFS to solve Mazes

02/19/2025 Unit-3, Informed and Uninformed Search 36


Depth limited Search
 Depth-limited search avoids the pitfalls of depth-first search by
imposing a cutoff on the maximum depth of a path.
Depth first search with depth limit L.
i.e note at depth level L has assumed to have no successor.
Problem knowledge can be used to guess the value of L.
With new depth limit set, we are guaranteed to find the solution if it
exists, but we are still not guaranteed to find the shortest solution
first: depth-limited search is complete but not optimal.
If we choose a depth limit that is too small, then depth-limited search
is not even complete.

02/19/2025 Unit-3, Informed and Uninformed Search 37


Depth Limited search
Completeness:
 The limited path introduces another problem which is the case when we
choose l < d, in which is our DLS will never reach a goal, in this case we can say
that DLS is not complete.
Optimality:
One can view DFS as a special case of the depth DLS, that DFS is DLS with l =
infinity.
DLS is not optimal even if l > d.
Time Complexity: O(bl)
Space Complexity: O(bl)

02/19/2025 Unit-3, Informed and Uninformed Search 38


DLS Example
• DLS Traversal =? If limit is 2
Depth 0
1
Depth 1
2 3

Depth 2
4 5 6 7

Depth 3
8 9 10 11 12 13 14 15

02/19/2025 Unit-3, Informed and Uninformed Search 39


Solution
1

2 3

4 5 6 7

Do not go to depth of 4 because depth limit is 2


DLS Solution is: 1,2,4,5,3,6,7 (like preorder traversal)

02/19/2025 Unit-3, Informed and Uninformed Search 40


Iterative Deepening Search
It is a search strategy resulting when you combine BFS and DFS, thus
combining the advantages of each strategy, taking the completeness
and optimality of BFS and the modest memory requirements of DFS.
IDS works by looking for the best search depth d, thus starting with
depth limit 0 and make a BFS and if the search failed it increase the
depth limit by 1 and try a BFS again with depth 1 and so on – first d = 0,
then 1 then 2 and so on – until a depth d is reached where a goal is
found.

02/19/2025 Unit-3, Informed and Uninformed Search 41


Completeness:
• IDS is like BFS, is complete when the branching factor b is finite.
Optimality:
• IDS is also like BFS optimal when the steps are of the same cost.
Time complexity
N(IDS) = (d)b + (d – 1)b2 + (d – 2)b3 + …. + (2)bd-1 + (1)bd = O(bd)
Space Complexity
O(bd)

02/19/2025 Unit-3, Informed and Uninformed Search 42


Cont...
Time Complexity:
One may find that it is wasteful to generate nodes multiple times, but
actually it is not that costly compared to BFS, that is because most of the
generated nodes are always in the deepest level reached, consider that we
are searching a binary tree and our depth limit reached 4, the nodes
generated in last level = 24 = 16, the nodes generated in all nodes before last
level = 20 + 21 + 22 + 23= 15
Imagine this scenario, we are performing IDS and the depth limit reached
depth d, now if you remember the way IDS expands nodes, you can see that
nodes at depth d are generated once, nodes at depth d-1 are generated 2
times, nodes at depth d-2 are generated 3 times and so on, until you reach
depth 1 which is generated d times, we can view the total number of
generated nodes in the worst case as:
• N(IDS) = (d)b + (d – 1)b2 + (d – 2)b3 + …. + (1)bd
02/19/2025 Unit-3, Informed and Uninformed Search 43
Time Complexity
• If we consider a realistic numbers, and use b = 10 and d = 5, then
number of generated nodes in BFS and IDS will be like
• N(BFS) = 50 + 400 + 3000 + 20000 + 100000 = 123450
• N(IDS) = 10 + 100 + 1000 + 10000 + 100000 = 111110
• BFS generates like 9 time nodes to those generated with IDS.
Conclusion
• We can conclude that IDS is a hybrid search strategy between BFS and
DFS inheriting their advantages.
• IDS is faster than BFS and DFS.
• It is said that “IDS is the preferred uniformed search method when
there is a large search space and the depth of the solution is not
known”.
02/19/2025 Unit-3, Informed and Uninformed Search 44
IDS Example
Depth 0
1
Depth 1
2 3

Depth 2
4 5 6 7

Depth 3
8 9 10 11 12 13 14 15

02/19/2025 Unit-3, Informed and Uninformed Search 45


IDS Example
1 Depth 0

3 Depth 1
2 No goal Found increase level

4 5 6 7 Depth 2

Goal No Need to Go
Found !!! Further Depth

02/19/2025 Unit-3, Informed and Uninformed Search 46


02/19/2025 Unit-3, Informed and Uninformed Search 47
Bidirectional Search
Graph search algorithm that finds a shortest path from an initial
vertex to a goal vertex in a directed graph.
Run two simultaneous search, one forward from initial state and one
backward from goal state , stop when two meet in the middle.
Bidirectional search is a brute-force search algorithm that requires an
explicit goal state instead of simply a test for a goal condition.
The time complexity of Bidirectional Search is O(b^d/2) since
each search need only proceed to half the solution path.
It is not always possible to search backward through possible states.

02/19/2025 Unit-3, Informed and Uninformed Search 48


• 100 101 102 103 104 105 106 107 108 depth:8

• 100 101 102 103 104


+

• 100 101 102 103 104

02/19/2025 Unit-3, Informed and Uninformed Search 49


02/19/2025 Unit-3, Informed and Uninformed Search 50
Evaluation of uninformed search
strategies.

02/19/2025 Unit-3, Informed and Uninformed Search 51


Heuristic Search (Informed
Search)
Greedy (Best-first Search)
A* algorithm (Search)
Hill Climbing
Means-End Analysis: Household ROBOT, Monkey Banana
Problem.

02/19/2025 Unit-3, Informed and Uninformed Search 52


Greedy Search
One of the simplest best-first search strategies is to minimize the
estimated cost to reach the goal.
node whose state is judged to be closest to the goal state is always
expanded first. I G
For most problems, the cost of reaching the goal from a particular
state can be estimated but cannot be determined exactly.
A function that calculates such cost estimates is called a heuristic
function, and is usually denoted by the letter h:
H(n)= estimated cost of the cheapest path from the state at node n to
goal state.
best-first search that uses h to select the next node to expand is
called greedy search
02/19/2025 Unit-3, Informed and Uninformed Search 53
Cont...

02/19/2025 Unit-3, Informed and Uninformed Search 54


Arad
366

Sibiu Timisoara Zerind


253 329 374

Arad Fagaras Oradea Rimnicu Vilcea


366 176 380 193

Sibiu Bucharest
253 0
Path: Arad Sibiu  Fagaras  Bucharest
02/19/2025 Unit-3, Informed and Uninformed Search 55
Performance Evaluation
Complete: No, Can get stuck in loop
Time: O(bm)
Space: O(bm),Keep all nodes in memory.
Optimal: No, (Think about previous search)

02/19/2025 Unit-3, Informed and Uninformed Search 56


A* Search
Basic Idea: avoid expanding path that are already expensive.
Evaluation Function f(n): g(n)+h(n)
f(n)= estimated total cost of path through n to goal
g(n) = cost so far to reach n
h(n) = estimated cost from n to goal
Straight line distance from
I : 75 Km
A: 25 Km
I A G

42 km 10 km

02/19/2025 Unit-3, Informed and Uninformed Search 57


02/19/2025 Unit-3, Informed and Uninformed Search 58
Arad
366

Sibiu Timisoara Zerind


253 329 374

Arad Fagaras Oradea Rimnicu Vilcea


366 176 380 193

Sibiu Bucharest
253 0

02/19/2025 Unit-3, Informed and Uninformed Search 59


Solution
F(n)=g(n)+h(n)
Arad : 366=0+366
Sibiu: 393=140+253, Timisoara: 447=118+329, Zernid: 449=75+374
Arad: 646=280+366, Fagaras: 415=239+176, Oradea:671=291+390,
Rimnicu Vilcea: 413=220+193
Craiova: 526=366+160, Pitesti: 415=317+98, Sibiu: 553=300+253
Bucharest: 418=418+0, Craiova: 609=455+160, Rimnicu vilcea:
607=414+193
Path : AradSibiuRimnicu VilceaPitestiBucharest

02/19/2025 Unit-3, Informed and Uninformed Search 60


Hill Climbing
Hill climbing can be used to solve problems that have many solutions,
some of which are better than others.
It starts with a random (potentially poor) solution, and iteratively
makes small changes to the solution, each time improving it a little.
When the algorithm cannot see any improvement anymore, it
terminates.
The algorithm does not maintain a search tree, so the node data
structure need only record the state and its evaluation, which we
denote by VALUE.
Global maximum : It is the best possible state in the state space
diagram. This because at this state, objective function has highest
value.

02/19/2025 Unit-3, Informed and Uninformed Search 61


Hill Climbing

02/19/2025 Unit-3, Informed and Uninformed Search 62


Algorithm
Step 1 : Evaluate the initial state. If it is a goal state then stop and
return success. Otherwise, make initial state as current state.
Step 2 : Loop until the solution state is found or there are no new
operators present which can be applied to current state.
a) Select a state that has not been yet applied to the current state and
apply it to produce a new state.
b) Perform these to evaluate new state
a) If the current state is a goal state, then stop and return success.
b) If it is better than the current state, then make it current state and proceed
further.
c) If it is not better than the current state, then continue in the loop until a
solution is found.
Step 3: Exit
02/19/2025 Unit-3, Informed and Uninformed Search 63
6 1 6

4 5 8

7 3 9
3
4 5
1 6 1 5 6 1 6

4 5 8 4 8 4 5 8

7 3 9 7 3 9 7 3 9

4
5
4 1 6 1 6

5 8 4 5 8

7 3 9 7 3 9

02/19/2025 Unit-3, Informed and Uninformed Search 64


Three Major Drawback of Hill
Climbing
Local maximum : It is a state which is better than its neighboring
state however there exists a state which is better than it(global
maximum). This state is better because here value of objective
function is higher than its neighbors.
Plateau/flat local maximum : It is a flat region of state space where
neighboring states have the same value.
Ridge : It is region which is higher than its neighbors but itself has a
slope. It is a special kind of local maximum.

02/19/2025 Unit-3, Informed and Uninformed Search 65


Hill Climbing

Despite the many local maxima in this graph, the global maximum
can still be found using simulated annealing. Unfortunately, the
applicability of simulated annealing is problem-specific because it
relies on finding lucky jumps that improve the position. In such
extreme examples, hill climbing will most probably produce a local
maximum.
02/19/2025 Unit-3, Informed and Uninformed Search 66
Means-Ends Analysis
Identify the procedure that causes a transition from the current state
to a goal state, or at least to an intermediate state that is nearer the
goal state.
The procedure above, reduces the observed difference between the
current state and goal state.
Until the goal state is reached or no more procedure are available.
Describe the current state, goal state and the difference between the two.
Use this difference, possible with the description of the current and goal state
to select a promising procedure.
Use the promising procedure and update the current state.
If the goal is reached then success otherwise fail.

02/19/2025 Unit-3, Informed and Uninformed Search 67


Monkey Banana Problem
Problem Formulation:
A monkey is in a room. Suspended from the ceiling is a bunch
of bananas, beyond the monkey's reach. However, in the room there
are also a chair and a stick. The ceiling is just the right height so that a
monkey standing on a chair could knock the bananas down with the
stick. The monkey knows how to move around, carry other things
around, reach for the bananas, and wave a stick in the air. What is the
best sequence of actions for the monkey?
More Problems: Household Robot Problem, Towers of Hanoi, Water
Jug
Lab task: implement Towers of Hanoi problem using C, JAVA, python,
PHP, JS
02/19/2025 Unit-3, Informed and Uninformed Search 68
02/19/2025 Unit-3, Informed and Uninformed Search 69
Constraint Satisfaction Problem
CSP are mathematical problems where one must find states or object
that satisfy a number of constraints or criteria.
Constraint is a restriction of the feasible solutions in an optimization
problem.
A CSP is characterized by:
 A set of variables {x1, x2, ....Xn} and a set of constraints C1, C2,......... Cm.
Each variable Xi has a nonempty domain Di of possible values.

02/19/2025 Unit-3, Informed and Uninformed Search 70


Formulation of CSPs as standard search problems
Initial state: no variables are assigned.
Successor function: assigns value(s) to currently unassigned
variable(s) provided constraints are not violated.
Goal: reached if all variables are assigned.
Path cost: constant C per step
In addition:
The tree is limited to depth so depth-first search is usable.
We don’t mind what path is used to get to a solution, so it is
feasible to allow every state to be a complete assignment whether
consistent or not. (Local search is a possibility)

02/19/2025 Unit-3, Informed and Uninformed Search 71


Crypt arithmetic
LOGIC+LOGIC=PROLOG
FORTY+TEN+TEN=SIXTY
WRONG+WRONG=RIGHT
SEND+MORE=MONEY

02/19/2025 Unit-3, Informed and Uninformed Search 72


Crypt arithmetic
solution may different according to the value assign
FORTY+TEN+TEN=SIXTY
Solution: 29786+850+850=31486
LOGIC+LOGIC=PROLOG
Solution: 90452+90452=180904
WRONG+WRONG=RIGHT
Solution: 12734+12734=25468
SEND+MORE=MONEY
Solution: 9567+1085=10652

02/19/2025 Unit-3, Informed and Uninformed Search 73


Game Playing
In which we examine the problems that arise when we try to plan ahead in a world
where other agents are planning against us.
A competitive environment, in which the agent’s goal are in conflict, giving rise to
adversarial search problems- often known as game.
A game can be formally defined as a kind of search problem with the following
elements.
S0: The initial state, which specifies how the game is set up at the start.
Player(s): Defines which player has the move in a state.
Action(s): Returns the set of legal move in a state.
Result(s): The transition model, which defines the result of a move.
Terminal-Test(s): which is true when the game is over and false otherwise. States
where the games are ended are called terminal state.
Utility(s, p): define final numeric value for a game that ends in terminal states s for
player p. (also called objective function
02/19/2025
or payoff function)
Unit-3, Informed and Uninformed Search 74
Game Playing
• Multi-agent Environment
• Cooperative vs Competitive
• Competitive environment is where the agent’s goals are in conflict.
• also known as adversarial Search.

Properties of Game
• Game theorists
• Deterministic, turn-taking, two-player, zero-sum games of perfect
information.

02/19/2025 Unit-3, Informed and Uninformed Search 75


Contd..
• AI
• Deterministic
• Fully-observable
• Two agents whose actions must alternate
• Utility values at the end of the game are equal and opposite
• For ex: In chess Winner (+1) and looser (-1)

02/19/2025 Unit-3, Informed and Uninformed Search 76


Game Tree
The initial state, ACTIONS Function, and RESULT function define the
game tree for the game.
A tree where the nodes are game states and edges are moves.
Game Tree for Tic-Tac Toe: next slide

02/19/2025 Unit-3, Informed and Uninformed Search 77


02/19/2025 Unit-3, Informed and Uninformed Search 78
Min Max Algorithm

-2 2 1 1 3 4 -1 1 0 2 5 6

02/19/2025 Unit-3, Informed and Uninformed Search 79


Min Max Algorithm
Max value
is 2 among 2 Max
two

Min value Min value


is 2 among 2 is 1 among 1 Min
two two

Max value Max value Max value Max value


is 2 among 2 is 4 among 4 is 1 among 1 is 6 among 6 Max
three three three three

-2 2 1 1 3 4 -1 1 0 2 5 6

02/19/2025 Unit-3, Informed and Uninformed Search 80


Min Max algorithm

02/19/2025 Unit-3, Informed and Uninformed Search 81


Properties of Min Max
• Complete
• Yes if the tree is finite (e.g. chess has specific rules for this)
• Optimal
• Yes, against an optimal opponent, otherwise???
• Time
• O(bm)
• Space
• O(bm) depth first exploration of the state space

02/19/2025 Unit-3, Informed and Uninformed Search 82


Alpha Beta Pruning
It is possible to compute the correct minimax decision without looking
at every node in the game tree.
Alpha-beta pruning allows to eliminate large parts of the tree from
consideration, without influencing the final decision.
Alpha = the value of the best choice we’ve found so far for MAX
(highest)
Beta = the value of the best choice we’ve found so far for MIN (lowest)
When maximizing, cut off values lower than Alpha
When minimizing, cut off values greater than Beta

02/19/2025 Unit-3, Informed and Uninformed Search 83


Alpha Beta Pruning

Initially value of α = -∞ and β= ∞ (Worst case Scenario)


The value of α and β are found the compare (α>= β):
true, then no need to check other successor node of
given node.
In max node choose best possible maximum value and
only compute value for alpha.
In min node choose best possible min value and
compute value for beta.
02/19/2025 Unit-3, Informed and Uninformed Search 84
Alpha-Beta
In worst case scenario α = -∞
Pruning Example
Compare (-∞,6)=6 Compare α(6,2)=6
α = -∞ Finally α=6
Now α = 6 6
Β= +∞ Β= +∞ Max=6

α = -∞ α=6
β= ∞ 6 β = +∞ 2
Compare(∞,6)=6 Compare β(+∞,2)=2
Now β=6 Check (α >= β):true
α = -∞
So no need to check
Compare (-∞,7)=7 Pruned
β=6 further
Now α = 7
Check (α >= β):true
α=6
α = -∞ (now 6)
So no need to check compare(6,1)=6
Compare(-∞,4)=4
Compare (4,6)=6 6 7 further Compare (6,2)=6 2
β = +∞ α value: no
Pruned change
Β= +∞
4 6 7 9 1 2 0 1

02/19/2025 Unit-3, Informed and Uninformed Search 85

You might also like