Heuristic-Based Search Algorithms
CSET-381 | Lecture 3.4 | Artificial Intelligence
Three key functions needed for informed search:
Purpose: Determines which node to expand next
Logic: Combines actual cost with estimated cost
Used in: A* Search algorithm
Purpose: Tracks the actual path cost so far
Logic: Known, exact distance traveled
Example: Steps taken, distance moved
Purpose: Estimates remaining cost to goal
Logic: Domain-specific knowledge
Example: Straight-line distance, Manhattan distance
| Algorithm | Complete? | Optimal? | Time Complexity | Space Complexity | Key Feature |
|---|---|---|---|---|---|
| BFS | ✓ Yes | ✓ Yes | O(b^d) | O(b^d) | Uninformed, level-order |
| DFS | ✗ No* | ✗ No | O(b^m) | O(bm) | Uninformed, memory efficient |
| Best-First | ~ Depends | ~ Depends | O(b^m) | O(b^m) | Uses evaluation function f(n) |
| Greedy Best-First | ✗ No | ✗ No | O(b^m) | O(b^m) | Fast but can be misleading |
| A* Search | ✓ Yes* | ✓ Yes* | O(b^d) | O(b^d) | Optimal & complete with good heuristic |
Legend: b = branching factor, d = depth of optimal solution, m = maximum depth
*A* properties depend on admissible & consistent heuristics
The quality of your heuristic function determines search efficiency. Good heuristics guide toward the goal, poor ones can mislead the search entirely.
A* combines actual cost g(n) with heuristic h(n) to find optimal solutions efficiently. It's complete and optimal with admissible heuristics.
Greedy Best-First is fastest but risky. A* balances optimality with efficiency. Choose based on your requirements for speed vs accuracy.
For A* to be optimal, heuristics must be admissible (never overestimate) and consistent. Examples: straight-line distance, Manhattan distance.