Local Search



Search through neighboring configurations until some objective function is improved


Iterative improvement to a single saved state

Hill Climbing



Start from random configuration


Move to neighboring configuration using a small change


If objective improves, keep change; else discard

Consider the n-Queens problem

How would you solve this with hill-climbing?

Consider Linear Regression

How would you solve this with hill-climbing?

Consider the
Travelling Salesman
problem


How would you solve this with hill-climbing?

Local Search



Pros and Cons?

  • Constant space
  • Can be used online
  • Can get stuck in local optima
  • Can get stuck in plateaus

What do we do about local optima or plateaus?



Random Restarts

Random Downhill Steps

Random Restarts



If stuck in local optima, restart from initial solution


Keep track of best solution


Repeat as necessary

Random Restarts

Random Downhill Steps



Allow moving to a worse state with a small probability


Keep track of best solution


Repeat as necessary

Random Downhill Steps

Simulated Annealing



Inspired by metallurgical processes


Metal is heated, then cooled to resolve internal structural defects

Simulated Annealing



Allow moving to a worse state with a small probability


Probability of moving to a worse state decreases over time

Simulated Annealing



Initialize a temperature, $T$ and a decay multiplier $d$


Allow moving to a worse state with probability
$\mathrm{e}^{(e(n) - e(n'))/T}$


Probability decays exponentially with lower temperature


Local Beam Search



Maintain $k$ states at each iteration


Keep $k$ best successors from all states combined


Note that these are $k$ separate searches that talk to each other!

Genetic Algorithms



Inspired by biological evolution


Maintain a population of candidate solutions


Generate new solutions by mutating
or combining existing ones


Genetic Algorithms



Fitness: how good the solution is for a given objective


Mutation: changing a solution into a neighbor configuration at random


Crossover: two parent solutions combine to produce a new
solution that retains some elements from both


Consider the n-Queens problem

How would you solve this with genetic algorithms?

Consider Linear Regression

How would you solve this with genetic algorithms?

Consider the
Travelling Salesman
problem


How would you solve this with genetic algorithms?