Prev: L17, Next: L19

Zoom: Link, Piazza: Link, Google Form: Link.

Wisc ID for in-class quiz: (if your wisc email is "test@wisc.edu", please enter "test")
Token: (will be given during the lectures)



# Warning: this is a draft and will be updated one day before the lecture.


Slide:



# Heuristic

📗 Additional information can be given in the form of a heuristic cost from any state to the goal state: this is an estimate or guess of the minimum cost from \(s\) to a goal state: Wikipedia.
➩ The cost from the initial state to a state \(s\) is denoted by \(g\left(s\right)\).
➩ The cost from the state \(s\) to the goal state is denoted by \(h^\star\left(s\right)\), which is unknown during the search.
➩ The estimated value of \(h^\star\left(s\right)\) is called the heuristic cost, denoted by \(h\left(s\right)\).
📗 Heuristic costs can be used to speed up the search.
In-class Discussion
📗 Search for a page containing an image. Describe how you find the image.
📗 Start here: Link.



# Uniform Cost Search

📗 UCS (Uniform Cost Search, or Dijkstra's Algorithm) expands the state with the lowest current cost \(g\left(s\right)\): Wikipedia.
📗 It is BFS with a priority queue based on \(g\left(s\right)\), and it is equivalent to BFS if the cost of every action is 1.
📗 UCS is complete.
📗 UCS is optimal.
In-class Quiz
📗 [4 points] Given initial state \(S\) and goal state \(G\), write down the expansion path (list of expanded nodes) for . In case the diagram is not clear, the edge costs are (heuristic on the diagonal).

📗 Answer: .




# Best First Greedy Search

📗 (Best First) Greedy Search expands the state with the lowest heuristic cost \(h\left(s\right)\): Wikipedia.
📗 BFGS is not an abbreviation of Greedy Search, since it usually stands for Broyden Fletcher Goldfarb Shanno algorithm (a version of a gradient descent algorithm).
📗 Greedy uses a priority queue based on \(h\left(s\right)\).
📗 Greedy is incomplete.
📗 Greedy is not optimal.
In-class Quiz
📗 [4 points] Given initial state \(S\) and goal state \(G\), write down the expansion path (list of expanded nodes) for . In case the diagram is not clear, the edge costs are (heuristic on the diagonal).

📗 Answer: .




# A Search

📗 A Search expands the state with the lowest total cost \(g\left(s\right) + h\left(s\right)\): Wikipedia (for A*).
📗 A Search uses a priority queue based on \(g\left(s\right) + h\left(s\right)\).
📗 A is complete.
📗 A is not optimal.
In-class Quiz
📗 [4 points] Given initial state \(S\) and goal state \(G\), write down the expansion path (list of expanded nodes) for . In case the diagram is not clear, the edge costs are (heuristic on the diagonal).

📗 Answer: .

In-class Quiz
📗 [4 points] Given initial state \(S\) and goal state \(G\), write down the expansion path (list of expanded nodes) for . In case the diagram is not clear, the edge costs are (heuristic on the diagonal).

📗 Answer: .




# Admissible Heuristic

📗 A heuristic is admissible if it never over estimates the true cost: \(0 \leq h\left(s\right) \leq h^\star\left(s\right)\): Wikipedia.
➩ The true costs are always assumed to be non-negative \(h^\star\left(s\right) \geq 0\) for this course.
📗 A Search with an admissible heuristic is called A* (A star) search.
📗 A* is complete.
📗 A* is optimal.
In-class Discussion
📗 Suggest some admissible heuristic for the 15-puzzle game: Link.



# Dominated Heuristic

📗 \(h_{2}\) dominates \(h_{1}\) (or \(h_{1}\) is dominated by \(h_{2}\)) if \(h_{1}\left(s\right) \leq h_{2}\left(s\right) \leq h^\star\left(s\right)\) for every state \(s\).
📗 A* with a dominated heuristic is less informed and worse for A*.
📗 If optimality is not required, then a heuristic that is close but slightly over estimates the true cost can be preferred.
In-class Quiz (Past Exam Question) ID:
📗 [3 points] Let \(h_{1}\) be an admissible heuristic from a state to the optimal goal, A* search with which ones of the following \(h\) will be admissible?
📗 Choices:





None of the above




# More Variants

📗 Iterative Deepening A* (IDA*) expands states with limit on \(g\left(s\right) + h\left(s\right)\) instead of depth in IDS: Link, Wikipedia.
📗 Beam Search keeps a priority queue with a limited size: Wikipedia.
Example
📗 A* search is often used to control robotic arms. States are usually represented by rotations angles instead of positions. The search space is called the configuration space: Link.
Review Note Review of search algorithms:

📗 Ignore edge cost (equivalently, assume edge costs are all 1)

BFS:
Expand the shallowest node first 
Complete, optimal (if cost is all 1)
Time complexity ~ \(b^{d}\)
Space complexity ~ \(b^{d}\)

DFS:
Expand deepest node first
Incomplete (when D is infinite), hence not optimal
Time complexity ~ \(b^{D}\)
Space complexity ~ \(b D\)

IDS:
"Search like BFS, fringe like DFS"
Complete, optimal (if cost is all 1)
Time complexity: ~ \(b^{d}\)
Space complexity: ~ \(b d\)
Preferred algorithms if heuristic is unknown

📗 Consider edge cost

UCS:
(Generalization of BFS)
Expand least-cost node first (first half cost \(g\left(s\right)\))
Complete, optimal

 \(g\left(s\right)\): first half cost, known.
 \(h^\star\left(s\right)\): second half cost, unknown.
 \(h\left(s\right)\): an estimate/guess for second half cost; user-specified

BFG:
Expand node with lowest \(h\left(s\right)\)
Incomplete, not optimal.
Issue: ignores \(g\left(s\right)\)

A Search:
Expand node with lowest \(g\left(s\right) + h\left(s\right)\)
Complete, but not optimal.
Issue: \(h\left(s\right)\) may be an overestimate of \(h^\star\left(s\right)\), preventing us to expand a node with low true \(h^\star\left(s\right)\).




# Questions?

📗 If you have questions, please use (i) Zoom chat, (ii) Piazza: Link, (iii) Office hours and discussion sessions. Please do NOT use Canvas mail and use email only to the course instructor (not TAs) for grading issues.
Additional In-class Discussion
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:

Notes (not visible to other students):


Submit your answer to see other students answers (click the submit button to refresh): 

Additional In-class Quiz
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:
A.
B.
C.
D.
E.
Notes (not visible to other students):


Submit your answer to see other students answers (click the submit button to refresh): 






# In-class Quiz Instructions

📗 To get full points on the in-class quizzes for a lecture:
➩ Submit relevant answers to the questions discussed during the lecture: incorrect answers are okay.
➩ Some questions require [notes] to earn the point.
➩ Some questions require special ID (given during the lecture) to earn the point.
➩ Do not submit answers to questions that are not discussed during the lectures. Each such submission will result in a deduction of one point.
➩ Submissions after the lecture, before the midterm (first 14 lectures) and the final exam (last 14 lectures), are accepted. After the exams, no in-class quiz submissions will be accepted.
➩ The grade on Canvas Assignment Q18 is computed as number of points divided by the number of questions asked (out of 1) and updated on Canvas every weekend.
📗 If there are any issues with submission on the website, please use this Google form: Link.
📗 Bonus point opportunities during a few lectures (added to in-class quiz above 20 points).
📗 Notes and code adapted from the course taught by Professors Jerry Zhu, Blerina Gkotse, Yudong Chen, Yingyu Liang, Charles Dyer. Some content are generated using Copilot .

Prev: L17, Next: L19





Last Updated: June 26, 2026 at 3:06 AM