0% found this document useful (0 votes)
15 views24 pages

4 ABIS InformedSearching

The document discusses search strategies in artificial intelligence, focusing on the use of heuristics to guide search processes more efficiently. It explains the concept of heuristics, their applications in everyday decision-making, and their role in informed search methods such as Greedy Search and A* Search. Additionally, it covers the 8-Puzzle problem as a practical example of applying the A* algorithm to find optimal paths.
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)
15 views24 pages

4 ABIS InformedSearching

The document discusses search strategies in artificial intelligence, focusing on the use of heuristics to guide search processes more efficiently. It explains the concept of heuristics, their applications in everyday decision-making, and their role in informed search methods such as Greedy Search and A* Search. Additionally, it covers the 8-Puzzle problem as a practical example of applying the A* algorithm to find optimal paths.
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/ 24

The One Queue

 All the previously discussed search strategies are essentially


the same except for how nodes are placed in the OPEN list
 Conceptually, all OPEN lists are priority queues
(collection of nodes with attached priorities)

• Priority depends on the algorithm


being used.
• The goal state is not taken into
consideration during node
selection or placement in
OPEN.
Informed Search

 Compass (Heuristic)
 Guides Search

 A Heuristic is:
 A function that estimates how close a state is to a goal
 Actions are guided by heuristics
 Designed for a particular search problem
 Path Finding:
 Manhattan Distance, Euclidean Distance
Heuristic
 Origin: from the Greek Word ‘heuriskein’, meaning “to discover”.

 A heuristic technique or any approach to problem solving or self-


discovery that employs a practical method that is not guaranteed to
be optimal, perfect, or rational, but is nevertheless sufficient for
reaching an immediate, short-term goal or approximation.
 These rule-of-thumb strategies shorten decision-making time and
allow people to function without constantly stopping to think about
their next course of action

Heuristics are "rules of thumb", educated guesses, intuitive


judgments or simply common sense.

 A heuristic contributes to the reduction of search in a problem-solving


activity. 3
Use of heuristics in our everyday lives:

 When having difficulty in understanding a problem we try writing the


steps down or drawing a layout of the steps.

 The reason that sales pages are often very long and contain a lot of
material–such as information in bullet form, pictures and lots of
recommendations of satisfied customers–is in the hopes that you, as a
consumer, will think:
 “Ah, if this much is written about the product, and if this many
people (experts) recommend the product, then it must be good.”

 If the sky is grey we conclude that it would be better to


take an umbrella before going out.
Heuristic Search
 Uses domain-dependent (heuristic) information in order to search
the space more efficiently.

Ways of using heuristic information:


1. Deciding which node to expand next, instead of doing the
expansion in a strictly single direction.
2. In the course of expanding a node, deciding which successor or
successors to generate, instead of blindly generating all possible
successors at one time;
3. Deciding that certain nodes should be discarded, or pruned, from
the search space.

5
Heuristic Search
 For many real world problems, it is possible to find specific
information to guide the search process and thus reduce the
amount of computation.

 This specific information is known as Heuristic information, and


the search procedures that use it are called Heuristic Search
Methods.

 Heuristics are decision rules regarding how a problem should


be solved.
 Heuristics are developed on the basis of solid, rigorous analysis of the
problem, and sometimes involved designed experimentation.

6
Heuristic Function

 It is a function that maps from problem state description to


measure of desirability, usually represented as number.

• Which aspects of the problem state are


considered
• How those aspects are evaluated
 the weights given to individual aspects are
chosen in such a way that the value of the
heuristic function at a given node in the
search process gives as good an estimate as
possible of whether that node is on the
desired path.

7
Major Benefits of Heuristics
1. Heuristic approaches have an inherent flexibility, which
allows them to be used on ill-structured and complex
problems.
2. These methods by design may be simpler for the decision
maker to understand, especially when it is composed of
qualitative analysis. Thus chances are much higher for
implementing proposed solution.
3. These methods may be used as part of an iterative
procedure that guarantees the finding of an optimal solution.

8
S h(n) = heuristic
g(n) = cost of path
from start node to 7 3
current node 2

A B C
6 7 8
4 2
1 L
D 6
6 H 4
6 4
J
5 3 I
2 4
4 4
F 4
6 E K
3 2 5 3
Evaluation Function
f(n) = ?? 5 G
0
Informed Search

 Informed Search Strategies


(Heuristic Search)
• Greedy Search

• Algorithm A* (A* Search)


Greedy Search (f(n) = h(n))
This algorithm selects the path which
appears to be the best

Let’s say we want to drive from city S to city G in the shortest


possible road distance, and we want to do it in the fastest way,
by exploring the least number of cities in the way, i.e. the least
number of steps.

Whenever we arrive at an intermediate city, we get to know the


distance from that city to our goal city G. This distance is an
approximation of how close we are to the goal from a given
node and is denoted by the heuristic function h(n).
S

7 3
2
Greedy Search f(n) = h(n) A B C
6 7 8
18

4 7 2
1 L
ENode OPEN CLOSED 21 D
H 6
{S} 6 4
6 4
S { A(6) B(7) C(8) } {S} 3 J
5 I 4
A { D(6) B(7) C(8) } {SA} 2 4
4
D { F(6) B(7) C(8) } {SAD} F 4
6 5 E K
F { G(0) B(7) C(8) } {SADF} 3
3 2 5
G { B(7) C(8) }
G
0

Solution path found is S A D F G (cost of solution = 21)


Number of nodes expanded (including goal node) = 5

Finds a quick solution, but not necessarily the optimal


solution
UCS Greedy

Informed Search - A*
The A* Search Heuristic

 A search algorithm to find the shortest path through a search


space to a goal state using a heuristic.
f(n) = g(n) + h(n)

 g - the cost of getting from the initial state to the current state
 h - the cost of getting from the current state to a goal state
S

7 3
2
A* Search f(n) = g(n) + h(n)
A B C
6 7 8
4 2
ENode OPEN CLOSED 1 L
D
{S} 6 H 6
4
S { B(9) C(11) A(13) } {S} 6 4
3 J
B { H(9) C(11) A(13) } {SB} 5 I 4
2 4
H { E(8) C(11) F(12) A(13) } {SBH} 4
F 4
6 E K
E { G(7) C(11) F(12) A(13) } {SBHE} 3
3 2 5
G { C(11) F(12) A(13) } 5 G
0
Solution path found is S B H E G (cost of solution = 7)
Number of nodes expanded (including goal node) = 5

f(A) = g(A) + h(A) f(H) = g(H) + h(H) f(E) = g(E) + h(E) f(G) = g(G) + h(G)
= 7+6 = 3+6 = 5+3 = 7+0
= 13 =9 =8 =7
Find a path from Arad to Bucharest using
A* and Greedy Search

g(n) h(n)
A* Applications:

 Path finding / Routing


 Resource Planning
 Language Analysis
 Machine Translation
 Speech Recognition
 ….
8-Puzzle

 Given an initial
configuration of 8
numbered tiles on a 3x3
board, move the tiles in
such a way so as to
produce a desired goal
configuration of the tiles.
8-Puzzle

 What are the states?


 What are the actions?
 Moving a tile to the empty spot (left, right, top, down)
 How many successors from the start state?
 What should the cost (g(n)) be?
 1 for each time you slide the tile
 (how many moves have been made?)
 Heuristics?
 Number of Tiles misplaced
 h(start) = 8
8-Puzzle
 Failure to detect repeated states can cause exponentially
more work
 When ever you encounter some state that has already been
explored before, never expand it again.
8-Puzzle Problem
 Use the A* Algorithm to find a path from the start state to the goal
state.

 The evaluation of the state f = g + h


 g - the cost of getting from the initial state to the current state
(How many moves have been made)
 h - the cost of getting from the current state to a goal state
(Count the number of tiles that are misplaced)

1 2 3 1 2 3
8 4 8 4
7 6 5 7 6 5
Start State Goal State
8-Puzzle
1 2 3 2 8 3
8 4 1 6 4 g=0
7 6 5 7 5
Goal State

h=5 h=3 h=5


f=6 f=4 f=6
2 8 3 2 8 3 2 8 3
1 6 4 1 4 1 6 4 g=1
7 5 7 6 5 7 5

h=3 h=3 h=4


f=5 f=5 f=6
2 8 3 2 3 2 8 3
g=2
1 4 1 8 4 1 4
7 6 5 7 6 5 7 6 5
h=3 h=3 h=4
1 2 3 f=5 2 8 3 f=5 2 3 2 8 3 f=6
8 4 1 4 1 8 4 g=2
1 4
7 6 5 7 6 5 7 6 5 7 6 5
Goal State
h=3 h=4 h=2 h=4
f=6 f=7 f=5 f=7

8 3 2 8 3 2 3 2 3
2 1 4 7 1 4 1 8 4 1 8 4 g=3
7 6 5 6 5 7 6 5 7 6 5
h=1
f=5
1 2 3 g=4
h=0 8 4
f=5
1 2 3 7 6 5 1 2 3
8 4 7 8 4 g=5
Goal State 7 6 5 6 5
Assignment

 Use the A* Algorithm to find a path from the start state to


the goal state.

1 3 1 2 3
7 2 4 8 4
6 8 5 7 6 5
Start State Goal State

You might also like