2.4-Informed Search Algorithms-060224
2.4-Informed Search Algorithms-060224
Artificial Intelligence
(BITE308L)
Informed
Search Algorithms
Dr. S. Hemalatha
School of Computer Science Engineering & Information Systems
VIT, Vellore
1
06-02-2024
2
06-02-2024
Heuristic function
• Used in informed search
– Additional knowledge of the problem imparted to search algorithm
• Takes the current state of the agent as its input
– Produces the estimation of how close agent is from the goal
– Estimates how close a state is to the goal
• Represented by 𝒉(𝒏)
– Calculates the cost of an optimal path between a pair of states
• Admissibility of the heuristic function:
– ℎ(𝑛) ≤ ℎ∗ (𝑛) [ℎ 𝑛 - heuristic cost & ℎ∗ 𝑛 - estimated cost]
• ℎ(𝑛): arbitrary, nonnegative, problem-specific functions, with one constraint:
– If 𝑛 is a goal node, then ℎ(𝑛) = 0
3
06-02-2024
4
06-02-2024
5
06-02-2024
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.
Dr. Hemalatha S, SCORE, VIT
6
06-02-2024
A* search algorithm
• Most commonly known form of best-first search
• Uses
– Heuristic function ℎ(𝑛), and
– Cost
• To reach the node 𝑛 from the start state 𝑔(𝑛)
• Combined features of UCS and greedy best-first search,
– By which it solve the problem efficiently
• Finds the shortest path through the search space using the heuristic function
• Expands less search tree and provides optimal result faster
• Similar to UCS except that it uses 𝑔 𝑛 + ℎ 𝑛 instead of 𝑔 𝑛
A* Search Algorithm
7
06-02-2024
A* Search Algorithm
• Step1: Place the starting node in the OPEN list
• Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure
and stops.
• Step 3: Select the node from the OPEN list which has the smallest value of evaluation
function 𝑔 + ℎ
– If node 𝑛 is goal node then return success
– Stop, otherwise
• Step 4: Expand node 𝑛 and generate all of its successors, and put 𝑛 into the closed list
– For each successor 𝑛 , check whether 𝑛 is already in the OPEN or CLOSED list
– If NOT, then compute evaluation function for 𝑛 and place into Open list
• Step 5: Else if node 𝑛 is already in OPEN and CLOSED, then it should be attached to
the back pointer which reflects the lowest 𝑔 𝑛 value
• Step 6: Return to Step 2
Dr. Hemalatha S, SCORE, VIT
A* Search Algorithm
example
8
06-02-2024
A* Search Algorithm
example
A* Search Algorithm
advantages & disadvantages
Advantages:
• The best algorithm among other search algorithms
• Optimal and complete
• Can solve very complex problems
Disadvantages:
• It does not always produce the shortest path
– as it is mostly based on heuristics and approximation
• A* search algorithm has some complexity issues
• The main drawback of A* is memory requirement as it keeps all generated nodes in the
memory, so it is not practical for various large-scale problems
9
06-02-2024
A* Search Algorithm
key-points
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)
A* Search Algorithm
key-points
• Optimal:
– If it follows two conditions:
1. 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
2. Consistency: Second required condition is consistency for only A* graph-search.
• If the heuristic function is admissible, then A* tree search will always find the least cost
path.
• 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(b^d), where b is the branching factor.
• Space Complexity: The space complexity of A* search algorithm is 𝑶 𝒃𝒅
10