AI Chapter-Three Search Algorithm1
AI Chapter-Three Search Algorithm1
Credit hour:3
leve1
leve2
leve3
04/21/2024
Chapte2: Search Algorithm
Uniformed search…
Fig2: DFS
04/21/2024 Chapte2: Search Algorithm 7
Uniformed search…
• Nodes are explored as A B D E H L M I N O F GJ
I G1 G2
Given
Initial
state
Apply technique
Produce
new state
YES
NO
New sate is goal state
=5
S D
E
C 8
3
B
A
7 F
6
5 2
Local maxima
starts
04/21/2024
Fig9: Local Maxima Chapte2: Search Algorithm 24
Limitation of hill climbing…
2. Plateau
•A plat area of search space in which all neighboring states have the same value
•So in plateau search stops at particular point because of plat value will found at
particular point.
•This is limitation of hill climbing
•Fore example, in figure below , node A,B And C have the same value.
•The equality represents plateau.
Goal state
Plateau
starts
04/21/2024
Fig10: Plateau Chapte2: Search Algorithm 25
3.Ridge: is special kind of local maxima. The
difference is it has sharp slope.
• When search find sharp slope, it detects that
Sharp slope as goal state and stop search
process
Ridge Goal state
starts
Fig11: ridge
04/21/2024 Chapte2: Search Algorithm 26
Summary of limitation of hill climbing
Global
maxima
Local maxima
Ridge
plateau
•From global maxima you can stand and see all the other cases.
•The is only one global maxima but their may be multiple local maxima
Nodes Heuristic
A->A=0+10=10 A 10
B 3
A->B=1+3=4 C 5
A->C=1+5=6 D 1
E 4
A->D=1+1=2 F 6
G 6
A->D->E=1+1+4=6 H 5
A->D->F=1+1+6=8 I 2
J 0
A->D->E-I=1+1+1+2=5
Expanded Next
A->D->E->J=1+1+1+0=3 Best path
A* search…
OPEN CLOSE
A {}
BCD A
BCEF AD
GHCEF ADB
GHCIJF ADBE
GOAL STATE
S 10
A 5
B 6
C 4
D 5
E 7
F 5
G 1
H 3
I 2
J 6
K 5
L 4
M 9
N 0
Goal : acquire TV
GET TV
BUY TV
Earn some
money
• Solution
C could be 8 or 9 since it is top most alphabet.
At column 1 S+S=R which implies R is even number.
1. Let C=9 and S=2
S+S=R = 2+2=4 there fore R=4
Substitute;
94O22
4 O 3 1 2 incorrect because this equation implies that A=E=3 which violets rule2
13??34
DANGE R
3. Let O=2
Substitute;
9 6233
6 2513
1 5 8 7 4 6 correct
DA N G E R
Forward reasoning
• In forward reasoning the search start from initial
state and reaching to goal state.
Backward reasoning:
In back ward reasoning the search start from goal state
to reach initial node
Backward
reasoning Goal state
Forward
Initial state reasoning
Problem Tree and Graph
• Tree is a graph in which any two vertices are connected by
exactly one simple path.
• In other words, tree is any connected graph
without cycles is a tree.
• Graph is any connected graph with cycle
Tree vs Graph
• In tree having only one path In graph there can be more than one
path
between any two vertices. In Graph, no. of edges depend
• In tree no. of edge is n-1 on the graph.
• In trees, there is parent child In Graph there is no parent child
relationship. relationship
Problem Tree and Graph