0% found this document useful (0 votes)
24 views28 pages

Week3 Lect5 6 AI

The document discusses various search strategies in Artificial Intelligence, focusing on Iterative Deepening Search, Informed Search, and specific methods like Hill Climbing and Beam Search. It explains the advantages of heuristic functions in guiding searches towards goal states while also highlighting potential drawbacks of certain search methods. The content is part of a lecture by Dr. Maqsood Hayat at Abdul Wali Khan University, covering fundamental concepts in AI search algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views28 pages

Week3 Lect5 6 AI

The document discusses various search strategies in Artificial Intelligence, focusing on Iterative Deepening Search, Informed Search, and specific methods like Hill Climbing and Beam Search. It explains the advantages of heuristic functions in guiding searches towards goal states while also highlighting potential drawbacks of certain search methods. The content is part of a lecture by Dr. Maqsood Hayat at Abdul Wali Khan University, covering fundamental concepts in AI search algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 28

Artificial Intelligence

(AI)
Lecture No. 5-6

Dr. Maqsood Hayat


Department of Computer Science,
Abdul Wali Khan University, Mardan
[email protected]
Agenda
 Iterative deepening search
 Informed Search
 Hill Climbing
 Beam search
 Best First Search

May 14, 2025 2


Iterative deepening search

To avoid the infinite depth problem of DFS,



only search until depth L,
i.e., we don’t expand nodes beyond depth L.
 Depth-Limited Search

• What if solution is deeper than L?  Increase L iteratively.


 Iterative Deepening Search

• This inherits the memory advantage of Depth-first search

• Better in terms of space complexity than Breadth-first search.

3
Iterative deepening search L=0

4
Iterative deepening search L=1

5
Iterative deepening search L=2

6
Iterative Deepening Search L=3

7
Heuristics

May 14, 2025 8


Informed Search
 The basic idea of a heuristic search is that rather than trying
all possible search paths, you try and focus on paths that seem
to be getting you closer to your goal state using some kind of a
“guide”. Of course, you generally can't be sure that you are
really near your goal state. However, we might be able to use a
good guess for the purpose. Heuristics are used to help us
make that guess. It must be noted that heuristics don’t always
give us the right guess, and hence the correct solutions. In
other words educated guesses are not always correct.
Heuristic Functions
 To further improve the quality of the previous methods, we
need to include problem-specific knowledge on the problem.
 How to do this in such a way that the
algorithms remain generally applicable ???

 HEURISTIC FUNCTIONS:
 f: States --> Numbers
 f(T) : expresses the quality of the state T
– allow to express problem-specific
knowledge, BUT: can be imported in a
generic way in the algorithms.
10
A heuristic function
 [dictionary]“A rule of thumb, simplification, or educated
guess that reduces or limits the search for solutions in
domains that are difficult and poorly understood.”
 h(n) = estimated cost of the cheapest path from
node n to goal node.
 If n is goal then h(n)=0
1 2 3 1 2 3
Start
8 4 7 8 4

7 6 5 6 5

Goal left Right Up

1 2 3 1 2 3 1 2 3
7 8 4 7 8 4 7 4
6 5 6 5 6 8 5

h=6 h=4 h=5


Approaches left Right Up

Count correct position 6 4 5

Count incorrect position 2 4 3

Count how far away 2 4 4


Blind search VS Heuristic Search
 Only have knowledge about already explored
 No Knowledge about far node is from goal state

 Estimates distance to goal state


 Guides search process toward goal state
 Prefer states that lead close to and not away from goal
state
Hill-Climbing Search
Hill-Climbing Search
 “is a loop that continuously moves in the direction of
increasing value”
 It terminates when a peak is reached.
 Hill climbing does not look ahead of the immediate neighbors
of the current state.
 Hill-climbing chooses randomly among the set of best
successors, if there is more than one.
What we think hill-climbing
looks like

What we learn hill-climbing is


Usually like

19
20
Hill-Climbing Search

function HILL-CLIMBING( problem) return a state that is a local maximum


input: problem, a problem
local variables: current, a node.
neighbor, a node.

current  MAKE-NODE(INITIAL-STATE[problem])
loop do
neighbor  a highest valued successor of current
if VALUE [neighbor] ≤ VALUE[current] then return STATE[current]
current  neighbor
Example
Drawbacks
 Foothill Problem
Drawbacks
 Plateau Problem
Drawbacks
 Ridge Problem
Beam Search
 Out of n possible choices at any level, beam search follows
only the best k of them; k is the parameter which we set
and the procedure considers only those many nodes at each
level.
K=2

27
Best First Search
 Beam search considers best k nodes at every level, best first search
considers all the open nodes so far and selects the best amongst them.

28

You might also like