Local Search and Genetic Algorithms
In Chapter 2 we said "learning is search." That chapter cheated a little: squared error has a perfectly smooth, bowl-shaped landscape, so calculus jumped straight to the bottom. This chapter covers what to do when the landscape is rough, the gradient is unavailable, or the space is huge and discrete.
Many real problems look like this:
- Schedule exams for 3,000 students with no clashes (discrete, astronomically many options).
- Find the layout of a delivery route visiting 30 hostels (travelling salesman).
- Tune a model's weights when you can only query its error from a server: a black box with no gradient. This is the MDL genetic-algorithm assignment.
- Choose which of 20 orders Bolt should carry tonight (knapsack).
All of these share one structure: there is a state (a candidate solution), an objective that scores it, and a notion of neighbouring states. We don't care about the path to the answer, only the answer itself. That is what makes a problem a local search (or optimization) problem.
- §3.1 Hill climbing: the simplest local search, and the three ways it gets stuck.
- §3.2 Simulated annealing and beam search: escaping local optima with controlled randomness and with populations.
- §3.3 Genetic algorithms: evolution as an algorithm. Representation, selection, crossover and mutation, worked by hand.
- §3.4 Lab: evolving a model that generalizes: Chapter 2 and Chapter 3 meet. A GA tunes the weights of an overfit model through a black-box error server.
Bolt's predictor runs on a microcontroller. The engineers have an overfit 11-weight polynomial (degree 10) and a server that, given any weight vector, returns its training and validation error. There's no gradient and no access to the data, and every query costs time. Can we search the 11-dimensional weight space intelligently enough to find a vector that generalizes?