0% found this document useful (0 votes)
2 views25 pages

03 - AI Searching Techniques - Informed Search Strategies

The document discusses informed search strategies in artificial intelligence, focusing on heuristic functions, Best First Search, and the A* algorithm. It explains how heuristics help in navigating large search spaces by estimating the cost to reach a goal, and details the workings of both the Greedy Best First Search and A* search algorithms. The A* algorithm combines heuristic and path cost to efficiently find optimal solutions in search problems.
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 views25 pages

03 - AI Searching Techniques - Informed Search Strategies

The document discusses informed search strategies in artificial intelligence, focusing on heuristic functions, Best First Search, and the A* algorithm. It explains how heuristics help in navigating large search spaces by estimating the cost to reach a goal, and details the workings of both the Greedy Best First Search and A* search algorithms. The A* algorithm combines heuristic and path cost to efficiently find optimal solutions in search problems.
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/ 25

Artificial Intelligence

AI Searching Techniques – Informed


Search Strategies

Lecture slides by: May Zakarne


Palestine Technical University Kadoori
2022-2023

1
Topics To be Covered …

•Informed search strategies


Heuristic function
Best first search
A* algorithm
Part I

3
Informed Search Strategies

•The informed search algorithm is more


useful for large search space.
•Informed search algorithm uses the idea of
heuristic, so it is also called Heuristic
search.
•Search with information via the concept of
heuristic function

4
Informed Search Strategies

• Heuristics function: Heuristic is a function which is


used in Informed Search, and it finds the most
promising path.
• It takes the current state as its input and produces the
estimation of how close it is from the goal.
• The heuristic method, however, might not always give
the best solution, but it guaranteed to find a good
solution in reasonable time.
• Heuristic function estimates how close a state is to the
goal. It is represented by h(n), and it calculates the cost
of an optimal path between the pair of states. The
value of the heuristic function is always positive.
5
Heuristic Function

Rules for choosing those branches in a state space that are most
likely to lead to an acceptable problem solution.

A heuristic function, is a function that calculates an approximate


cost to a problem (or ranks alternatives).

The heuristic function is a way to inform the search about the


direction to a goal. It provides an informed way to guess which
neighbor of a node will lead to a goal.

6
Heuristic Function example – The 8-puzzle game
The 8-puzzle game:
Hamming distance: Number of tiles out of place (i.e., not
in their goal positions)

Manhattan distance: sum of the distance of each tile from its


goal position

7
Heuristic Function example – Tic Tack Toe

8
Pure heuristic search Algorithms

• Pure heuristic search is the simplest form of heuristic search


algorithms. It expands nodes based on their heuristic value h(n). It
maintains two lists, OPEN and CLOSED list. In the CLOSED list, it places
those nodes which have already expanded and in the OPEN list, it
places nodes which have yet not been expanded.
• On each iteration, each node n with the lowest heuristic value is
expanded and generates all its successors and n is placed to the closed
list. The algorithm continues unit a goal state is found.
• In the informed search we will discuss two main algorithms:
• Best First Search Algorithm(Greedy search)
• A* Search Algorithm

9
Greedy Best first search algorithm

• It is a pure heuristic search.

• Efficient selection of the current best candidate for extension


is typically implemented using make use of the value of
heuristic function.

• Best-first search is a search algorithm which explores a graph


by expanding the most promising node chosen according to a
specified rule.

• Best-first search": search with a heuristic that attempts to


predict how close the end of a path is to a solution, so that
paths which are judged to be closer to a solution are
extended first. This specific type of search is called greedy
best-first search or pure heuristic search.

10
Best first search example
Start state

Goal state
11
Best First Search

12
Best First Search Example

13
Best First Search Example

14
Best First Search Example

15
Best First Search Example

16
A* search Algorithm

17
A* search

• A* search is the most commonly known form of best-first search. It


uses heuristic function h(n), and cost to reach the node n from the
start state g(n).
• It has combined features of UCS and greedy best-first search, by which
it solve the problem efficiently.
• A* search algorithm finds the shortest path through the search space
using the heuristic function. This search algorithm expands less search
tree and provides optimal result faster. A* algorithm is similar to UCS
except that it uses g(n)+h(n) instead of g(n).
• In A* search algorithm, we use search heuristic as well as the cost to
reach the node. Hence we can combine both costs as following, and
this sum is called as a fitness number.

18
A* Algorithm example 1

n h(n)
S 1 start
a 3
b 3
c 0 goal
d 0 goal

19
A* Algorithm example 1

20
A* Algorithm Example 2

21
A* Algorithm Example 2

• Initialization: {(S, 5)}


• Iteration1: {(S--> A, 4), (S-->G, 10)}
• Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)}
• Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7),
(S-->G, 10)}
• Iteration 4 will give the final result, as S--->A--->C--->G it provides the
optimal path with cost 6.

22
A* Algorithm

• Points to remember:
• A* algorithm returns the path which occurred first, and it does not
search for all remaining paths.
• The efficiency of A* algorithm depends on the quality of heuristic.
• A* algorithm expands all nodes which satisfy the condition f(n)<=""
li="">
• Complete: A* algorithm is complete
• Optimal: A* search algorithm is optimal if it follows below two
conditions

23
Example (BFS, DFS, BestFS, A*)

24
Next Time …

• Predicate Calculus

25

You might also like