0% found this document useful (0 votes)
48 views43 pages

chp03 Searching Strategies

The document discusses different types of search algorithms used in artificial intelligence problem solving. It covers blind search strategies like breadth-first search, depth-first search, and iterative deepening depth-first search. It then discusses heuristic search strategies, which use additional information to guide the search, such as hill climbing, best-first search, and A* search. A* combines the cost to reach the current node from the start with an heuristic estimate of the cost to reach the goal, allowing it to find optimal solutions. Examples of applying these search strategies to tic-tac-toe and the 8-puzzle problem are provided.
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)
48 views43 pages

chp03 Searching Strategies

The document discusses different types of search algorithms used in artificial intelligence problem solving. It covers blind search strategies like breadth-first search, depth-first search, and iterative deepening depth-first search. It then discusses heuristic search strategies, which use additional information to guide the search, such as hill climbing, best-first search, and A* search. A* combines the cost to reach the current node from the start with an heuristic estimate of the cost to reach the goal, allowing it to find optimal solutions. Examples of applying these search strategies to tic-tac-toe and the 8-puzzle problem are provided.
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/ 43

Artificial Intelligence

PROBLEM SOLVING
& SEARCH

Part II
Blind Search Strategies
Search Algorithms
 You will learn 2 categories of searching
algorithm, i.e.
 Blind search – covered in Part II
 Heuristic search – covered in Part III
Search Algorithms
 Blind search
 Also known as uninformed search – a strategy that does not
know additional information about states beyond that
provided in the problem definition.
 Search proceeds by generating successors and
distinguishing a goal state from non-goal state.
 Algorithms include
 Breadth-first search
 Depth-first search
 Uniform-cost search
 Depth-limited search
 Iterative deepening depth-first.
Search Algorithms
 Heuristic search
 Also known as informed search – a strategy that knows
whether one non-goal state is more promising than
another.
 Algorithms include
 Hill climbing
 Best-first
 Greedy search
 A*

Note: This algorithm will be discussed further in Part III


BLIND SEARCH
How it works?
1. Breadth-first search
How BFS works?
 Goes by level, i.e.
visiting states A-B-
C-.....-U in sequence.
 Only moves to the
next level after all
states in the current
level have been
examined and no
goal is found.
Breadth-first search
Breadth-first search
Breadth-first search
 Always guarantee to find the shortest path for each
state from the start state
 as it considers each node (i.e. state) at each level
before going deeper into the space.
Applying BFS on the 8-Puzzle problem.
2. Depth-first search
How DFS works?
 Goes by depth, i.e.
visiting states A-B-E-
K- .....-U in sequence.
 Only moves to the
nearest state after
dead end state is
reached and no goal
is found.
function depth-first search
Depth-first search
Depth-first search
Applying DFS on the 8-Puzzle problem.
3. Iterative deepening search

 A strategy that combines BFS and DFS.


 Performs a DFS with a depth bound of n.
 Increase the depth bound to n+1 if fail to find the
goal
4. Depth limited search

 A strategy that imposes a cut-off on the


maximum depth of a path.
 Choosing a depth limit that is too small or too
big will affect the success of a search
Artificial Intelligence

PROBLEM SOLVING
& SEARCH

Part III
Heuristic Search Strategies
HEURISTIC SEARCH
 Heuristic (informed) search strategies
 Strategies that know whether one non-goal state
is more promising than another.

 Used to guide search by making intelligent


choices during problem solving thereby reducing
the amount of search.
Heuristic
 What is heuristics?
▪ “rules of thumb, educated guesses, intuitive judgement,
or simply common sense” (as popularly known)
▪ “strategies using readily accessible though loosely
applicable information to control problem-solving
processes in human beings and machine” (in more
precise terms)
▪ “an informed guess of the next step to be taken in
solving a problem, often based on experience or
intuition”.
Heuristic
 Heuristics are employed in two basic
situations:
▪ No exact solution because of inherent ambiguities in the
problem statement or available data.

▪ Exact solution exists, but the computational cost of


finding it may be prohibitive.
Heuristic
 Heuristics can either:
▪ Lead a search algorithm to a suboptimal solution
OR
▪ Fail to find any solution at all.

Note:
The basic idea of heuristic search is,
“when you’re in a state and there are several choices of
operators to new states, evaluate each state by assigning a
number to it. The state which seems most promising is the
one to explore next”.
Heuristic search concepts
Heuristic evaluation function
 Is a procedure which assigns numbers to choices (states) for
the purpose of determining what the best choice is.

 Two common interpretations for the number associated with


choices:
 How good it is?
 The cost of attaining the goal state from the current state
(e.g. the distance to the nearest goal state).

Note: In one case, high numbers are desirable, and in the other, low
numbers.
Example 1
Tic-tac-toe problem

Total number of states = 9!


Tic-Tac-Toe

Symmetric operation: to a corner, to the centre of the grid, to the centre of


the side.
Tic-Tac-Toe

The “most wins” heuristic


Tic-Tac-Toe
Select state with highest number of opportunities.
1. Hill Climbing
 Analogy:
 The eager, blind mountain climber - go uphill along the
steepest possible path until he can go no farther up

 The algorithm - expand the current state and


evaluate its children
 Select the best child, then moves
 Search halts when it reaches a state that is better than any
of its children
 As used in previous tic-tac-toe example
Hill Climbing
How it works? A-5

B-5 C-4 D-6

E-4 F-3

G-2 H-3 (Goal)


Hill Climbing
 Advantages
 Space efficient
 Can be used in conjunction with other methods by getting
off to a quick start

 Limitation
 No guarantee of finding a solution
▪ Keeps no history, cannot recover from failures
 Tends to become a stuck at local maximum (can be
avoided with sufficient informative evaluation function)
2. Best-first search
 Similar to hill climbing in that it explores the best
node first.
 Unlike hill climbing, it is a global method.
 States not chosen in the first instance are remembered for
possible future use.
 Nature of solution:
 A sort of combination of DFS and BFS
 Start off by going depth (in the same way as hill climbing).
 When things stop improving, going breadth by jumping
back up to previous nodes at a higher level in the tree.
Best-first search
How it works?
Best-first search
Best-first search
Example 2
8 Puzzle problem
8 Puzzle
Defining heuristics for this problem

(compare CS to GS)

(compare CS to Goal, then count)


8 Puzzle
A*
 Best-FS solution is not optimal
 Meaning that, it doesn’t guarantee to find the shortest path
solution
 Why? Because states are evaluated without considering
their distance from the start node

The A* overcome the above limitation


 by including g(n) in its heuristic evaluation function :
 f(n) = g(n) + h(n)
▪ g(n)  cost from start node to node n
▪ h(n)  heuristics, or cost to get from node to goal
Applying A* to 8 Puzzle problem

g(n) = 0 a

b c d

h(n) = 5 h(n) = 3 h(n) = 5


g(n) = 1 f(n) = 1 + 5 = 6

f(b) = f(c) = f(d) =

h(n) = the “number of tiles out of place” heuristic

You might also like