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

Heuristic Search Techniques 1636978392317

Uploaded by

Jerry Roshan
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)
22 views24 pages

Heuristic Search Techniques 1636978392317

Uploaded by

Jerry Roshan
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/ 24

UNIT III

UNCERTAINTY AND SEARCH TECHNIQUES

HEURISTIC SEARCH TECHNIQUES


HEURISTIC SEARCH TECHNIQUES
• Blind searches are normally very inefficient.
• By adding domain knowledge, we can improve
search process.
• Explore the node that nearest to the goal state.
• We use heuristic function to know how close
we are nearer to the goal state.
• Solving problems more easily and fast.
• Consumes less memory and cheapest cost.
Representation
• h(n)  Heuristic function (Estimated cost of
the cheapest path from the state at node n to
a goal state)
• g(n)  path cost function
Types
1. Best first search (or) Greedy search
2. A* Search
3. Hill Climbing
GREEDY SEARCH
• Selects the path which appears best at that moment.
• Combination of BFS and DFS algorithms.
• Uses the heuristic function and search.
• Best-first search allows us to take the advantages of both
algorithms.
• At each step, we can choose the most promising node.
• Expand the node which is closest to the goal node and the
closest cost is estimated by heuristic function, i.e. f(n) = h(n)
• h(n)= estimated cost from node n to the goal
• The greedy best first algorithm is implemented by the
priority queue.
Algorithm:
1. Place the starting node into the OPEN list.
2. If the OPEN list is empty, Stop and return failure.
3. Remove the node n, from the OPEN list which has the lowest
value of h(n), and places it in the CLOSED list.
4. Expand the node n, and generate the successors of node n.
5. Check each successor of node n, and find whether any node
is a goal node or not. If any successor node is goal node, then
return success and terminate the search, else proceed to
Step 6.
6. For each successor node, algorithm checks for evaluation
function f(n), and then check if the node has been in either
OPEN or CLOSED list. If the node has not been in both list,
then add it to the OPEN list.
7. Return to Step 2.
Example
Expand the nodes of S and put in
the CLOSED list
Open Closed

[A, B] [S]

[A] [S, B]

[E, F, A] [S, B]

[E, A] [S, B, F]

[I, G, E, A] [S, B, F]

[I, E, A] [S, B, F, G]

Hence the final solution path will


be:
S----> B----->F----> G
Advantages:
• Best first search can switch between BFS and DFS
by gaining the advantages of both the algorithms.
• This algorithm is more efficient than BFS and DFS
algorithms.

Disadvantages:
• It can behave as an unguided depth-first search in
the worst case scenario.
• It can get stuck in a loop as DFS.
• This algorithm is not optimal.
• Time Complexity: The worst case time complexity of
Greedy best first search is O(bd).

• Space Complexity: The worst case space complexity of


Greedy best first search is O(bd).
• b is the branching factor
• d is the maximum depth of the search space.

• Complete: Greedy best-first search is also incomplete,


even if the given state space is finite.

• Optimal: Greedy best first search algorithm is not


optimal.
A* SEARCH
• A* search is commonly form of best-first search.
• It uses heuristic function h(n), and cost to reach the
node n from the start state g(n).
• Finds the shortest path through the search space
using the heuristic function.
• we use search heuristic as well as the cost to reach
the node and this sum is called as a fitness number.
• Fast and optimal result.
Algorithm:
1. Place the starting node in the OPEN list.
2. Check if the OPEN list is empty or not, if the list is empty then
return failure and stops.
3. Select the node from the OPEN list which has the smallest value of
evaluation function (g+h), if node n is goal node then return
success and stop, otherwise
4. Expand node n and generate all of its successors, and put n into
the closed list. For each successor n', check whether n' is already
in the OPEN or CLOSED list, if not then compute evaluation
function for n' and place into Open list.
5. Else if node n' is already in OPEN and CLOSED, then it should be
attached to the back pointer which reflects the lowest g(n') value.
6. Return to Step 2.
Example
S--> A = 1+3 = 4
S-->G = 10
S--> A-->C = 1+1+2 = 4
S--> A-->B = 1+2+4 = 7
S--> A-->C-->G = 1+1+4 =6
S--> A-->C-->D = 1+1+3+6 = 11
S--> A-->B-->D = 1+2+5+6 = 14
S--> A-->C-->D-->G = 1+1+3+2 = 7
S--> A-->B-->D-->G = 1+2+5+2 = 10
Hence the final solution path will be:
S--->A--->C--->G
because it provides the optimal path
with cost 6.
Advantages:
• Best algorithm than other search algorithms.
• Optimal and complete.
• Solve very complex problems.

Disadvantages:
• It does not always produce the shortest path as it
mostly based on heuristics and approximation.
• Has some complexity issues.
• It is not practical for various large-scale problems
because it requires large memory requirement.
• Complete: A* algorithm is complete as long as:
• Branching factor is finite.
• Cost at every action is fixed.

• Optimal: A* search algorithm is optimal if it follows below two conditions:


• Admissible: the first condition requires for optimality is that h(n) should
be an admissible heuristic for A* tree search. An admissible heuristic is
optimistic in nature.
• Consistency: Second required condition is consistency for only A* graph-
search.

• Time Complexity: The time complexity of A* search algorithm depends on


heuristic function, and the number of nodes expanded is exponential to the depth
of solution d. So the time complexity is O(bd), where b is the branching factor.

• Space Complexity: The space complexity of A* search algorithm is O(bd)


HILL CLIMBING
• Also known as greedy local search and has no backtracking.

• Moves in the direction of increasing elevation / value to find


the peak of the mountain or best solution to the problem.

• It terminates when it reaches a peak value where no


neighbor has a higher value.

• Its node has two components: state and value.


Features
• Generate and Test variant: Produce feedback
to decide which direction to move in the
search space.
• Greedy approach: Moves in the direction
which optimizes the cost.
• No backtracking: It does not remember the
previous states.
Regions in state space
• Local Maximum: Local maximum is a state which is better
than its neighbor states, but there is also another state
which is higher than it.
• Global Maximum: Global maximum is the best possible
state of state space landscape. It has the highest value of
objective function.
• Current state: It is a state in a landscape diagram where an
agent is currently present.
• Flat local maximum: It is a flat space in the landscape
where all the neighbor states of current states have the
same value.
• Shoulder: It is a plateau region which has an uphill edge.
State – space diagram
Algorithm
1. Evaluate the initial state, if it is goal state then return
success and Stop.
2. Loop Until a solution is found or there is no new
operator left to apply.
3. Select and apply an operator to the current state.
4. Check new state:
A. If it is goal state, then return success and quit.
B. Else if it is better than the current state then assign new state as
a current state.
C. Else if not better than the current state, then return to step2.
5. Exit.
Limitations
• Local Maximum: A local maximum is a peak state in
the landscape which is better than each of its
neighboring states, but there is another state also
present which is higher than the local maximum.
• Plateau: A plateau is the flat area of the search space
in which all the neighbor states of the current state
contains the same value, because of this algorithm
does not find any best direction to move. A hill-
climbing search might be lost in the plateau area.
• Ridges: A ridge is a special form of the local
maximum. It has an area which is higher than its
surrounding areas, but itself has a slope, and cannot
be reached in a single move.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy