Prev: L24, Next: L26

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:



# Local Search Algorithms

📗 For some problems, every state is a solution, only some states are better than other states specified by a cost function (sometimes score or reward): Wikipedia.
📗 The search strategy will go from state to state, but the path between states is not important.
📗 Local search assumes similar (nearby) states have similar costs, and search through the state space by iteratively improving the costs to find an optimal state.
📗 The successor states are called neighbors (or move set).



# Hill Climbing or Valley Finding

📗 Hill climbing is the discrete version of gradient descent: Wikipedia.
➩ It starts at a random state.
➩ Move to the best neighbor (successor) state.
➩ Stop when all neighbors are no better than the current state (local minimum).
📗 Random restarts can be used to pick multiple random initial states and find the best local minimum (similar to neural network training).
📗 If there are too many neighbors, first choice hill climbing randomly generates neighbors until a better neighbor is found.
In-class Discussion ID:
📗 [1 points] Given the initial state (red points) \(i\), the neighbors are \(i - 1\) and \(i + 1\), and is used for imization of the score, which solution will be found? Click on the red point to restart, and click anywhere else to move to the next iteration.

Temperature: \(T\) = , \(dT\) = .
📗 Answer: .


In-class Quiz (Past Exam Question) ID:
📗 [3 points] Given the scores in the following table, if hill-climbing (valley-finding) is used, how many states will lead to the global imum? Note: the neighbors of state \(i\) are states \(i - 1\) and \(i + 1\) (if they exist).
State 0 1 2 3 4 5 6 7
Score

📗 Answer: .




# Simulated Annealing

📗 Simulated annealing uses a process similar to heating solids (heating and slow cooling to toughen and reduce brittleness): Wikipedia.
➩ Each time, a random neighbor is generated.
➩ If the neighbor has a lower cost, move to the neighbor.
➩ If the neighbor has a higher cost, move to the neighbor with a small probability: \(p = e^{- \dfrac{\left| f\left(s'\right) - f\left(s\right) \right|}{T\left(t\right)}}\), where \(f\) is the cost and \(T\left(t\right)\) is the temperature and decreasing in \(t\).
➩ Stop until bored.
📗 Simulated annealing is a version of Metropolis-Hastings algorithm: Wikipedia.
Example
📗 The traveling salesman problem is often solved by simulated annealing: Link.



# Temperature

📗 The temperature function should be decreasing over time. They can change arithmetically or geometrically.
➩ Arithmetic sequence: for example, \(T\left(t + 1\right) = \displaystyle\max\left\{T\left(t\right) - 1, 1\right\}\).
➩ Geometric sequence: for example, \(T\left(t + 1\right) = 0.9 T\left(t\right)\).
📗 When the temperature is high: almost always accept any state.
📗 When the temperature is low: first choice hill climbing.
In-class Discussion ID:
📗 [1 points] Given the initial state (red points) \(i\), the neighbors are \(i - 1\) and \(i + 1\), and is used for imization of the score, which solution will be found? Click on the red point to restart, and click anywhere else to move to the next iteration.

Temperature: \(T\) = , \(dT\) = .
📗 Answer: .






# 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 Q25 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: L24, Next: L26





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