DM841 Discrete Optimization
Metaheuristics
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Metaheuristics Marco Chiarandini Department of Mathematics & - - PowerPoint PPT Presentation
DM841 Discrete Optimization Metaheuristics Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Metaheuristics Outline 1. Metaheuristics Stochastic Local Search Simulated Annealing Iterated
Department of Mathematics & Computer Science University of Southern Denmark
Metaheuristics
2
Metaheuristics
3
Metaheuristics
◮ Non-improving steps: in local optima, allow selection of
◮ Diversify the neighborhood ◮ Restart: re-initialize search whenever a local optimum
4
Metaheuristics
◮ Goal-directed and randomized components of LS strategy need to be
◮ Intensification: aims at greedily increasing solution quality, e.g., by
◮ Diversification: aims at preventing search stagnation, that is, the search
◮ Iterative Improvement (II): intensification strategy. ◮ Uninformed Random Walk/Picking (URW/P): diversification strategy.
5
Metaheuristics
7
Metaheuristics
8
Metaheuristics
10
Metaheuristics
◮ No need to terminate search when local minimum is encountered
◮ Probabilistic mechanism permits arbitrary long sequences
◮ GWSAT [Selman et al., 1994],
11
Metaheuristics
12
Metaheuristics
import cotls; int n = 16; range Size = 1..n; UniformDistribution distr(Size); Solver<LS> m(); var{int} queen[Size](m,Size) := distr.get(); ConstraintSystem<LS> S(m); S.post(alldifferent(queen)); S.post(alldifferent(all(i in Size) queen[i] + i)); S.post(alldifferent(all(i in Size) queen[i] − i)); m.close(); int it = 0; while (S.violations() > 0 && it < 50 ∗ n) { select(q in Size : S.violations(queen[q])>0) { selectMin(v in Size)(S.getAssignDelta(queen[q],v)) { queen[q] := v; cout<<"chng @ "<<it<<": queen["<<q<<"] := "<<v<<" viol: "<<S.violations() <<endl; } it = it + 1; } } cout << queen << endl;
13
Metaheuristics
14
Metaheuristics
◮ Function p(f , s): determines probability distribution
◮ Let step(s, s′) := p(f , s, s′).
◮ Behavior of PII crucially depends on choice of p. ◮ II and RII are special cases of PII.
15
Metaheuristics
◮ Search space S: set of all Hamiltonian cycles in given graph G. ◮ Solution set: same as S ◮ Neighborhood relation N(s): 2-edge-exchange ◮ Initialization: an Hamiltonian cycle uniformly at random. ◮ Step function: implemented as 2-stage process:
T
◮ Termination: upon exceeding given bound on run-time.
16
Metaheuristics
17
Metaheuristics
◮ candidate solutions ∼
◮ evaluation function ∼
◮ globally optimal solutions ∼
◮ parameter T ∼
18
Metaheuristics
19
Metaheuristics
◮ 2-stage step function based on
◮ proposal mechanism (often uniform random choice from N(s)) ◮ acceptance criterion (often Metropolis condition)
◮ Annealing schedule
◮ initial temperature T0
◮ temperature update scheme
◮ number of search steps to be performed at each temperature
◮ may be static or dynamic ◮ seek to balance moderate execution time with asymptotic behavior
◮ Termination predicate: often based on acceptance ratio,
20
Metaheuristics
◮ proposal mechanism: uniform random choice from
◮ acceptance criterion: Metropolis condition (always accept improving
◮ annealing schedule: geometric cooling T := 0.95 · T with n · (n − 1)
◮ termination: when for five successive temperature values no
◮ neighborhood pruning (e.g., candidate lists for TSP) ◮ greedy initialization (e.g., by using NNH for the TSP) ◮ low temperature starts (to prevent good initial candidate solutions from
21
Metaheuristics
0.0 0.5 1.0 1.5 2.0 2.5 Temperature Run A 10 20 30 40 50 100 200 300 400 500 600 Iterations 107 Cost function value Run B 10 20 30 40 50 Iterations 107 23
Metaheuristics
26
Metaheuristics
◮ subsidiary local search steps for reaching
◮ perturbation steps for effectively
27
Metaheuristics
◮ Subsidiary local search results in a local minimum. ◮ ILS trajectories can be seen as walks in the space of
◮ Perturbation phase and acceptance criterion may use aspects of search
◮ In a high-performance ILS algorithm, subsidiary local search,
28
Metaheuristics
◮ More effective subsidiary local search procedures lead to better ILS
◮ Often, subsidiary local search = iterative improvement,
29
Metaheuristics
◮ Needs to be chosen such that its effect cannot be easily undone by
◮ A perturbation phase may consist of one or more
◮ Weak perturbation ⇒ short subsequent local search phase;
◮ Strong perturbation ⇒ more effective escape from local minima;
◮ Advanced ILS algorithms may change nature and/or strength of
30
Metaheuristics
◮ Always accept the best of the two candidate solutions
◮ Always accept the most recent of the two candidate solutions
◮ Intermediate behavior: select between the two candidate solutions based
◮ Advanced acceptance criteria take into account search history,
31
Metaheuristics
◮ Given: TSP instance π. ◮ Search space: Hamiltonian cycles in π. ◮ Subsidiary local search: Lin-Kernighan variable depth search algorithm ◮ Perturbation mechanism:
double bridge move
◮ Acceptance criterion: Always return the best of the two given
32
Metaheuristics
35
Metaheuristics
◮ memorizing full solutions (space) ◮ computing hash functions (time)
36
Metaheuristics
◮ Associate tabu attributes with candidate solutions or
◮ Forbid steps to search positions recently visited by
37
Metaheuristics
◮ Search space: set of all complete assignments of X. ◮ Solution set: models of the formula. ◮ Neighborhood relation: 1-flip ◮ Memory: Associate tabu status (Boolean value) with each pair
◮ Initialization: a random assingment ◮ Search steps:
◮ pairs (x, v) are tabu if they have been changed
◮ neighboring assignments are admissible if they
◮ choose uniformly at random admissible neighbors
◮ Termination: upon finding a feasible assignment or after given bound
40
Metaheuristics
◮ Admissible neighbors of s: Non-tabu search positions in N(s) ◮ Tabu tenure: a fixed number of subsequent search steps
◮ Aspiration criterion (often used): specifies conditions under which
◮ Crucial for efficient implementation:
◮ efficient best improvement local search
◮ efficient determination of tabu status:
41
Metaheuristics
48
Metaheuristics
◮ a local minimum w.r.t. one neighborhood function is not necessarily
◮ a global optimum is locally optimal w.r.t. all neighborhood functions
49
Metaheuristics
◮ Several adaptations of this central principle
◮ (Basic) Variable Neighborhood Descent (VND) ◮ Variable Neighborhood Search (VNS) ◮ Reduced Variable Neighborhood Search (RVNS) ◮ Variable Neighborhood Decomposition Search (VNDS) ◮ Skewed Variable Neighborhood Search (SVNS)
◮ Notation
◮ Nk, k = 1, 2, . . . , km is a set of neighborhood functions ◮ Nk(s) is the set of solutions in the k-th neighborhood of s 50
Metaheuristics
◮ for many problems different neighborhood functions (local searches)
◮ change parameters of existing local search algorithms ◮ use k-exchange neighborhoods; these can be naturally extended ◮ many neighborhood functions are associated with distance measures; in
51
Metaheuristics
52
Metaheuristics
53
Metaheuristics
◮ Final solution is locally optimal w.r.t. all neighborhoods ◮ First improvement may be applied instead of best improvement ◮ Typically, order neighborhoods from smallest to largest ◮ If iterative improvement algorithms IIk, k = 1, . . . , kmax
◮ order black-boxes ◮ apply them in the given order ◮ possibly iterate starting from the first one ◮ order chosen by: solution quality and speed 54
Metaheuristics
56
Metaheuristics
◮ which neighborhoods ◮ how many ◮ which order ◮ which change strategy ◮ Extended version: parameters kmin and kstep; set k ← kmin and increase
57
Metaheuristics
61
Metaheuristics
◮ Key Idea: Modify the evaluation function whenever
◮ Associate weights (penalties) with solution components; these determine
◮ Perform Iterative Improvement; when in local minimum, increase
62
Metaheuristics
◮ Modified evaluation function:
◮ Penalty initialization: For all i: penalty(i) := 0. ◮ Penalty update in local minimum s: Typically involves penalty increase
◮ Subsidiary local search: Often Iterative Improvement.
63
Metaheuristics
64
Metaheuristics
◮ Given: TSP instance π ◮ Search space: Hamiltonian cycles in π with n vertices; ◮ Neighborhood: 2-edge-exchange; ◮ Solution components edges of π;
◮ Penalty initialization: Set all edge penalties to zero. ◮ Subsidiary local search: Iterative First Improvement. ◮ Penalty update: Increment penalties of all edges with maximal utility by
65
Metaheuristics
◮ Change the objective function bringing constraints gi into it
◮ λi are continous variables called Lagrangian Multipliers ◮ L(
◮ Alternate optimizations in
66
Metaheuristics
67