2. Classical Search
• Observable
• Deterministic
• Known Environment
• Solution of sequence of actions
3. Local Search
• All that matters is the solution state
• Don't care about solution path
4. Advantages of Local Search
• Very little memory — usually constant amount
• Can often find reasonable solutions in infinite (continuous)
state spaces
6. Hill Climbing
1. Pick a random point.
2. Look at your neighbors.
3. Keep going up until you find the
local maximum.
7. Hill Climbing & 8-Queens
• Gets stuck 86% of the time
• avg 3 steps when it gets stuck
• avg 4 steps to solve optimally
8. Hill Climbing with Sidesteps
• Gets stuck only 6% of the time on 8-queens
• avg 64 steps when it gets stuck
• avg 21 steps to solve optimally
9. Random-restart hill climbing
• expected restarts = 1/p, p is the probability of success
• expected steps = 1 successful iteration + cost of (1-p)/p cost
of failure, roughly 22 steps
• even for 3 Million-Queens finds a solution in under 1 minute
11. Metallurgy
Annealing is the process used to temper or harden metals
and glass by heating them to a high temperature and then
gradually cooling them, thus allowing the material to reach a
low-energy crystalline state.
12. Simulated Annealing
1. Choose a random initial state, high initial temperature, and
cooling rate
2. Choose random neighbor of current state
3. If it's better than the current state, pick it
4. If not, randomly decide to take it anyway based on
temperature
5. Reduce temperature
6. Repeat steps 2-5 until cooled
13.
14. // Loop until system has cooled
while (temp > 1) {
Tour newSolution = randomNeighbor(currentSolution);
// Get energy of solutions
int currentEnergy = currentSolution.getDistance();
int neighbourEnergy = newSolution.getDistance();
// Decide if we should accept the neighbour
if (acceptanceProbability(currentEnergy, neighbourEnergy, temp) > Math.random()) {
currentSolution = new Tour(newSolution.getTour());
}
// Keep track of the best solution found
if (currentSolution.getDistance() < best.getDistance()) {
best = new Tour(currentSolution.getTour());
}
// Cool system
temp *= 1-coolingRate;
}
15. Choosing Cooling Rate
• No silver bullet.
• Picking a high temperature and low cooling rate is generally
best.
16. Advantages of Simulated
Annealing
• can deal with arbitrary systems and cost functions
• is relatively easy to code, even for complex problems
• generally gives a "good" solution