Part IV — Optimization for analytics · Chapter 10

Prescriptive analytics: optimization for decisions

~50 min read7 interactive widgets

In this chapter

  1. Optimization: the mathematical core
  2. The map of optimization problems
  3. Nonlinear, linear and integer linear optimization
  4. P, NP and the size of real instances
  5. Combinatorial optimization: components, feasibility and cost
  6. The Travelling Salesman Problem
  7. Vehicle routing and the generalized assignment problem
  8. Constructive heuristics
  9. Local search: neighborhoods, 2-opt and 3-opt
  10. Metaheuristics: diversification versus intensification
  11. Iterated local search and simulated annealing
  12. Tabu search
  13. GRASP, variable neighborhood search and ALNS
  14. The loop closes: prescriptive analytics in the exam project
  15. Check your understanding

1. Optimization: the mathematical core

The last deck of the course opens by naming the engine behind everything seen so far. Mathematical optimization (aka mathematical programming) is the selection of a best element from some set of available alternatives. An optimization problem consists of minimizing (maximizing) a real function by choosing input values from within an allowed set — and, the deck adds, more generally, optimization includes finding best available values of some objective function, given a defined domain (or input), where objective functions and domains can be very diverse.

The deck's title slide carries an epigraph by Euler that says the whole programme in Latin: nihil omnino in mundo contingit, in quo non maximi minimiQve ratio quaepiam eluceat — nothing at all happens in the world in which some principle of maximum or minimum does not appear. It is the philosophical ancestor of everything this chapter models: even when the world looks like a forecast, what an operator actually needs is the best thing to do next.

The formal optimization problem: a real function f over a domain A, with the minimizing point x0 marked, next to the deck's formal definition and Euler's epigraph. x₀ — the minimizer f(x) x domain A GIVEN f : A → ℝ FIND x₀ ∈ A such that f(x₀) ≤ f(x) ∀x ∈ A “minimization” f(x₀) ≥ f(x) ∀x ∈ A “maximization” “nihil omnino in mundo contingit, in quo non maximi minimiQve ratio quaepiam eluceat” — Euler the same shape as chapter 9 — but the variables are now decisions, not parameters
Plate 10.1 — The formal optimization problem (deck slides 2–3). Chapter 9 minimized error functions over parameter spaces; this chapter keeps the identical shape and changes what x means: staffing levels, routes, assignments, schedules.

Position this inside the course. The first chapter promised three payoffs — faster decisions, fault fixing, productivity — and drew the loop that closes this course: operations produce data, statistics describe it, models predict it, and prescriptive optimization turns the prediction into a decision that acts back on operations. Chapter 9 fitted the parameters of models; this chapter is the other half of Part IV: it takes the fitted models' outputs — a forecast of demand, a predicted failure probability, an estimated processing time — as input data for a decision problem, and solves that problem. The forecast is not the product; the decision is.

Key idea

Minimizing an error function (chapter 9) and choosing the best decision (this chapter) are the same mathematical act with different actors. That is the deck's opening move: mathematical programming is the selection of a best element from a set of alternatives. Every widget in this chapter is a different instance of that one sentence.

2. The map of optimization problems

Optimization is a landscape, not a single algorithm. The deck lists the major subfields in one slide — a taxonomy worth keeping whole:

SubfieldDefinition (deck)
Linear programming (LP)the objective function f is linear and the constraints are specified using only linear equalities and inequalities
Nonlinear programmingthe objective function and/or the constraints can be nonlinear
Quadratic programmingthe objective function can have quadratic terms, while the feasible set must be specified with linear equalities and inequalities
Integer programminglinear programs in which some or all variables are constrained to take on integer values (this is in general much more difficult than regular linear programming)
Combinatorial optimizationproblems where the set of feasible solutions is discrete or can be reduced to a discrete one
Stochastic programmingsome of the constraints or parameters depend on random variables
Robust programmingcaptures uncertainty in the data, finding solutions that are valid under all / a wide set of possible realizations of the uncertainties
Constraint programminga programming paradigm where relations between variables are stated in the form of constraints

… and many more, the deck says. Two remarks tie the taxonomy to this course. First, integer programming and combinatorial optimization are the subfields where most operational decisions live — you cannot send 3.7 trucks or assign half a nurse — and they are exactly the ones that will dominate the rest of this chapter. Second, stochastic and robust programming are the bridge back to chapters 2–7: a forecast is a random variable, and a decision model that consumes it either treats its uncertainty explicitly (stochastic) or insists the decision stay valid for a whole range of scenarios (robust).

The map of optimization subfields: mathematical optimization at the root, with linear, nonlinear, quadratic, integer, combinatorial, stochastic, robust and constraint programming as leaves, plus the deck's many more. MATHEMATICAL OPTIMIZATION (mathematical programming) LINEAR (LP) NONLINEAR QUADRATIC INTEGER (ILP / MILP) COMBINATORIAL STOCHASTIC ROBUST CONSTRAINT PROG. … and many more the deck’s emphasis for operations: LP · ILP/MILP · combinatorial — the vermilion branch
Plate 10.2 — The subfields of mathematical optimization (deck slide 4). The vermilion branch — integer and combinatorial optimization — is where operational decisions actually live; stochastic and robust programming are how the course's forecasts enter decision models.
Key idea

The taxonomy is a decision tree for the exam discussion too: name the problem first (LP, ILP, MILP, combinatorial, stochastic), then the method. The rest of the chapter is exactly that pairing — model first, algorithm second, in that order.

3. Nonlinear, linear and integer linear optimization

The deck walks the taxonomy from the most general to the most rigid. Nonlinear optimization: the objective function or the constraints or both can have nonlinear components, and the problem can be constrained or unconstrained. The deck's one-liner example: min x² − 2x + 3, s.t. x² ≤ 9. The unconstrained minimum of the parabola is x = 1 (derivative 2x − 2 = 0), which lies inside the constraint x ∈ [−3, 3] — so the constraint is inactive and the answer is x = 1 with f = 2. That is the pattern to internalize: constraints only matter when they bite.

Linear optimization: both the objective function and the constraints are modelled by linear functions; constraints (there have to be some) are in the form of a system of equations or inequalities. The deck's example is the one the widget below draws:

min    −x₁ − x₂
s.t.   x₁ − x₂ ≤ 1.5
       −7x₁ + 5x₂ ≤ −17.5
       −x₂ ≤ −4.5
       x₁, x₂ ≥ 0

Rewritten as half-planes: x₂ ≥ x₁ − 1.5, x₂ ≤ 1.4·x₁ − 3.5, x₂ ≥ 4.5, plus nonnegativity. The objective moves in the (1, 1) direction — the north-east — and the feasible region is the wedge between the three half-planes.

Editor's note

As extracted from the deck, the three constraints leave the region unbounded to the north-east: x₂ can keep growing with x₁ while satisfying all three inequalities, so min −(x₁ + x₂) → −∞. The deck's slide was probably drawn with a bound that did not survive extraction (or was intentionally cut). Rather than silently change the deck's numbers, the widget below keeps the deck's three constraints verbatim and adds an explicit bound x₁ ≤ B with a slider — which both exhibits the optimum vertex and demonstrates, honestly, what "the LP is unbounded" means.

Integer linear optimization: linear optimization problems where (some of) the variables are required to take on integer values. If all variables are integer: Integer Linear Programming (ILP); if some of the variables are continuous: Mixed Integer Linear Programming (MILP). The same example with "and integer" added: the optimal vertex of the continuous relaxation is generally not an integer point, and the optimum over the lattice can sit far from it — which is why the deck warns that integer programming is in general much more difficult than regular linear programming.

The deck's linear program drawn: the three constraint half-planes, the feasible polygon clipped by the added bound x1 at 8, the LP optimum at vertex (8, 7.7) and the ILP optimum at the lattice point (8, 7). x₁ x₂ iso-objective z = −15.7 LP optimum (8, 7.7) — z = −15.7 ILP optimum (8, 7) — z = −15 x₁ − x₂ ≤ 1.5 (rising line) · −7x₁ + 5x₂ ≤ −17.5 (steep line) · x₂ ≥ 4.5 (horizontal) · x₁ ≤ 8 = added bound
Plate 10.3 — The deck's linear program, with the added bound x₁ ≤ 8 (deck slides 6–7). The LP optimum is the vertex (8, 7.7); the ILP optimum is the lattice point (8, 7). Naively rounding the LP solution to (8, 8) would be infeasible — integer programming searches the lattice itself, which is what makes it harder.

The deck's linear program, explored live

The three constraint half-planes of the deck's example, drawn as extracted. The slider is the artificial bound x₁ ≤ B that closes the region so the optimum vertex exists; push B to its maximum and the region simply continues past the plot — the unbounded case.

8.00
Key idea

One problem, three regimes: the continuous LP is solved at a vertex of the feasible polyhedron; the ILP is solved on the integer lattice inside it; and when neither exists because the region is unbounded, the solver answers "unbounded" — a legitimate answer, not a bug. Knowing which regime you are in is the first diagnostic of any prescriptive model.

4. P, NP and the size of real instances

The deck's slide on complexity theory is two Venn diagrams: the world P = NP and the world P ≠ NP, with the NP-complete region inside NP but outside P. The deck does not take sides — it draws both and moves on, because either way the operational conclusion is the same. The next slide says it: the size of the instances met in real world applications rules out the possibility of solving them to optimality in an acceptable time. Nevertheless, these instances must be solved. Thus the need to look for suboptimal solutions, provided that they are of "acceptable quality" and that they can be found in "acceptable time".

Two panels: the P versus NP question as the deck draws it, and the factorial explosion of the number of possible tours with the deck's table values on a logarithmic scale. P = NP P = NP P ≠ NP P NP-complete the deck draws both worlds — either way, real instances are too large to solve to optimality in acceptable time n nodes ⇒ (n−1)! possible tours n=5 n=10 n=15 n=20 120 3.6·10⁶ 1.31·10¹² 2.43·10¹⁴ logarithmic scale — the deck’s table: n! = 120 · 3,628,800 · 1.31·10¹² · 2.43·10¹⁴
Plate 10.4 — The two sides of the deck's argument (slides 8 and 12). Left: the P versus NP question, drawn as the deck draws it. Right: the combinatorial explosion — for 20 locations there are more possible tours than there are seconds in 70 billion years; "acceptable time" is simply not available.

The consequence is the working contract of the whole chapter: acceptable quality in acceptable time. Every method that follows — constructive heuristics, local search, metaheuristics — is a bid on that contract: it gives up the guarantee of optimality (which is unattainable anyway at real sizes) in exchange for solutions that are good enough, found fast enough. Chapter 9's black-box optimizers were exactly this in the parameter space; here the same machinery acts on decision spaces.

For the exam

This is the paragraph to quote when a discussion turns to why heuristics are legitimate: real instances rule out optimality in acceptable time; they must nevertheless be solved; therefore suboptimal solutions of acceptable quality, found in acceptable time, are the actual deliverable. It is the license for everything in sections 8–13.

5. Combinatorial optimization: components, feasibility and cost

The deck then gives the formal vocabulary that all the rest of the chapter speaks. A combinatorial optimization problem is defined over a set C = {c₁, …, cₙ} of basic components. A solution of the problem is a subset S ⊂ C; F ⊆ 2C is the subset of feasible solutions (a solution S is feasible iff S ∈ F). z: 2C → ℝ is the cost function. The objective is to find a minimum cost feasible solution S°, i.e., to find S° ∈ F such that z(S°) ≤ z(S), ∀S ∈ F. Failing this, the algorithm anyway returns the best feasible solution found, S* ∈ F.

Three moves in this definition matter. First, a solution is a subset of components — the "decision variables" of section 3 become, in combinatorial language, the choice of which components to include. Second, feasibility is a separate layer: F is only a part of 2C, and an algorithm that proposes S ∉ F has failed regardless of cost. Third — and this is the sentence the whole chapter is built on — the objective is S°, but the algorithm may fail to find it and then returns the best feasible solution found, S*. The "acceptable quality" of section 4 is here made formal: S* is the honest deliverable, and the quality gap z(S*) − z(S°) is what heuristics try to shrink.

Key idea

Everything that follows is a family of answers to one question: how do you produce a good S* quickly? Constructive heuristics build one subset at a time (section 8); local search improves a subset by small edits (section 9); metaheuristics manage the search that local search gets trapped in (sections 10–13). The formal triple — components, feasibility, cost — stays constant; only the way of exploring 2C changes.

6. The Travelling Salesman Problem

The canonical combinatorial problem gets the deck's full treatment. n locations given (home of salesperson and n−1 customers); [dij] distance matrix given, contains distances (Km, time, …) between each pair of locations. The TSP asks for the shortest tour starting home, visiting each customer once and returning home. Symmetric and asymmetric versions exist (depending on whether dij = dji).

Why it is the canonical case: the explosion is immediate. n nodes ⇒ (n−1)! possible tours (for the symmetric undirected case, half that — the direction of travel does not matter). The deck's table: n = 5 → 120; n = 10 → 3,628,800; n = 15 → 1.31·10¹²; n = 20 → 2.43·10¹⁴. "Difficult to say… which is the shortest tour" — indeed.

Then the deck does the formal translation that connects TSP to section 5: TSP is defined over a weighted (un)directed graph G=(V,E,D), where V is the set of vertices, E is the set of edges and D is the set of edge weights. The component set corresponds to E (C=E); F corresponds to the set of Hamiltonian cycles in G; z(S) is the sum of the weights associated to the edges belonging to the solution S. A tour is a subset of edges — components — that happens to form a cycle visiting every vertex once.

Editor's note

The deck's slide 16 states that the LP formulation of the TSP is "a binary LP (IP) which is almost identical to the assignment problem", plus conditions to avoid short cycles — the formula itself is an image that did not survive text extraction. The standard form it gestures at: min ∑ cijxij s.t. ∑j xij = 2 for every vertex i (undirected), xij ∈ {0,1}, plus subtour elimination constraints (the "conditions to avoid short cycles"), which forbid the solution from being a union of two small cycles instead of one big one. The assignment relaxation alone would happily produce such unions — that is why the extra constraints are the hard part.

Brute force versus nearest neighbor, live

Six cities, one fixed home. The vermilion tour is the true optimum found by enumerating all (6−1)! = 120 tours; the dashed cobalt tour is the nearest-neighbor greedy of section 8. Regenerate instances and watch the gap move — and note that for n = 15 the same enumeration would need 1.31·10¹² tours.

For the exam

The TSP triple — C = E, F = Hamiltonian cycles, z = sum of edge weights — is the standard worked example of "combinatorial optimization problem defined over components". If you can translate TSP into the section-5 vocabulary, you can translate any routing problem, including the VRP of the next section.

7. Vehicle routing and the generalized assignment problem

From one salesperson to a fleet. The Vehicle Routing Problem (VRP) is a classic optimization problem in logistics. Goal: determine optimal routes for a fleet of vehicles delivering goods to customers. The constraints multiply: vehicle capacities, and may also include delivery time windows, customer service times, driver working hours / route duration limits, split deliveries, pickup and delivery, …. The objective stays the same shape: minimize total distance, cost, or time. Input data: V = {0, …, n}: set of nodes (0 = depot, others = customers); E: set of edges; cij: cost (distance) from node i to node j; qi: demand of customer i; Q: vehicle capacity; K: number of vehicles. "Mathematics gets more complicated…" — the deck's dry summary of moving from one vehicle to K.

Left: a TSP tour on eight nodes with the home marked. Right: a vehicle routing solution with K equal 3 routes leaving a depot, each serving a subset of customers. TSP — ONE TOUR H visit every customer once, return home — symmetric / asymmetric versions VRP — K = 3 ROUTES 0 capacities Q · demands qᵢ · time windows · working hours · split deliveries …
Plate 10.5 — From TSP to VRP (deck slides 11–20). Left: one tour for one vehicle. Right: K = 3 routes from the depot; each customer is served once, each route respects the vehicle capacity Q, and the objective is total distance, cost or time.

The second model of the section is the one with a full math formulation on the slides: the Generalized Assignment Problem (GAP). It is modeled on a bipartite complete directed graph G(I ∪ J, A), where the vertices in I denote the potential facilities, the vertices in J the customers, and the arcs in A ⊂ I × J are associated with the material flows between the potential facilities and the demand points. Demand may be divisible or not. The notation: Qi, i ∈ I, the capacity of facility i; qij, j ∈ J, the demand of customer j when serviced by facility i; xij a decision variable representing the (percentual) amount of product sent from site i to demand point j; cij the cost of transporting all products from site i to customer j. The deck's math model (MIP):

z(GAP) = min  ∑i∈Ij∈J cij xij                    (1)
subject to   ∑i∈I xij = 1        j ∈ J      (2)
             ∑j∈J qij xij ≤ Qi   i ∈ I      (3)
             xij ∈ {0,1}  (or xij ≥ 0)  i ∈ I, j ∈ J   (4)

Read constraint by constraint, as the deck does: variables xij determine customer allocations to facilities; the objective function (1) is the cost for transporting goods from facilities to customers; constraints (2) ensure that each customer request is satisfied; constraints (3) force the total request to a facility not to exceed the corresponding capacity; constraints (4) could be either xij ≥ 0 — clients' service can be split — or xij ∈ {0,1} — clients are singly assigned to a warehouse. This is a MILP exactly as section 3 defined it, and the widget below solves a small instance of it by hand with the tools of the next two sections.

Generalized assignment: greedy, local search and the escape

Three facilities (capacities 6, 12, 12) and six customers (demands 4, 3, 4, 3, 3, 3; total 20). The costs are fixed: facility 0 is cheap for customers 0 and 1 but tiny; facilities 1 and 2 are cheap for the rest. Run the three buttons in order and watch the objective move — this is the section-5 story (S° vs S*) played out on a real model.

Key idea

The GAP is the bridge between the two halves of this chapter: it is a clean MIP (model first), and it is small enough that the heuristic story (construct, improve, escape) can be watched on a canvas. Every real prescriptive model in operations — staff scheduling, facility location, order-to-warehouse allocation — is a GAP with extra constraints.

8. Constructive heuristics

With the models in place, the algorithms begin. The first family builds a solution from nothing:

function Constructive():
1. Sort the components in C by increasing costs.
2. Set S* = ∅ and i = 1.
3. Repeat
        if (S* ∪ cᵢ is a feasible partial solution)
            then S* = S* ∪ cᵢ.
        i = i + 1.
   until S* ∈ F.

Two honest caveats from the deck. A constructive approach can yield optimal solutions for certain problems, e.g., the MST — the minimum spanning tree is exactly the case where the sorted-edge greedy (Kruskal's algorithm) is provably optimal. In other cases it could be unable to construct a feasible solution — the "until S* ∈ F" loop can simply run out of components. For the TSP the deck lists the classic constructive strategies: Farthest Insertion, the Nearest Neighbor, the Best Insertion or the Sweep algorithms.

The nearest neighbor is worked in full because its weakness is instructive:

function NearestNeighbor():
0. Start from any city; e.g. the first one
1. Find nearest neighbor (to the last city) not already visited
2. repeat 1 until all cities are visited.
   then connect last city with starting point

Ties can be broken arbitrarily.
Starting from different starting points gives different solutions!
Some will be bad, some will be good.

And the deck's punchline: GREEDY ⇒ the last connections tend to be long and improvement heuristics should be used afterwards. The greedy has perfect local information and zero foresight: the first choices look excellent, and the bill arrives at the end, when the remaining cities force long closing edges. That is why the constructive phase is only the first phase — the next section's local search exists to pay the bill.

Key idea

Constructive heuristics are the cold start of every method in this chapter. They are fast, they always return something (usually), and they are never the final answer — the deck says it in one sentence: "starting from different starting points gives different solutions; some will be bad, some will be good." Section 9 turns "some will be bad" into a procedure that fixes them.

9. Local search: neighborhoods, 2-opt and 3-opt

The improvement machinery starts with the neighborhood. The neighborhood of a solution S, N(S), is a subset of 2C defined by a neighborhood function N: 2C → 22C. Often only feasible solutions are considered, so neighborhood functions N: F → 2F. The deck's warning: the specific function used has a deep impact on the algorithm performance and its choice is left to the algorithm designer — the neighborhood is the designer's first real decision.

function LocalSearch():
1. Generate an initial feasible solution S.
2. Find S' ∈ N(S), such that z(S') = min z(S^), ∀S^ ∈ N(S).
3. If z(S') < z(S) then S = S'
   go to step 2.
4. S* = S.

The update of a solution in step 3 is called a move from S to S' — and the deck notes it could be made to the first improving solution found rather than the best of the whole neighborhood (the difference between first-improvement and best-improvement descent). Two properties anchor the method: there are problems for which a local search approach guarantees to find an optimal solution (ex. the simplex algorithm) — LP is one giant local search over vertices — and for combinatorial problems it generally does not, because it stops at the first solution whose whole neighborhood is worse, the local optimum.

The four local-search moves the deck lists for the TSP: 2-opt on arcs (invert a subsequence), 3-opt on arcs (shift a subsequence), 2-opt on nodes (swap a pair) and 3-opt on nodes (swap a triplet). 2-OPT (ARCS) invert a subsequence 1 5 12 345 15 432 3-OPT (ARCS) shift a subsequence 12 345 12 534 2-OPT (NODES) swap a pair 12 345 15 342 3-OPT (NODES) swap a triplet 12 345 14 235
Plate 10.6 — The four moves of the deck's slide 32. 2-opt and 3-opt on arcs act on the edges (invert a subsequence, shift a subsequence); 2-opt and 3-opt on nodes act on the permutation itself (swap a pair, swap a triplet). If a move improves the tour, the search restarts from the beginning.

For the TSP, the deck names the two classic neighborhoods: 2-opt and 3-opt, which take a solution (a list of n vertices) and exhaustively swap the elements of all pairs or triplets of arcs in it — and the more sophisticated neighborhoods that produce the more effective heuristics, among which Lin and Kernighan [LK73]. The widget below runs first-improvement 2-opt exactly as the deck describes it: try all inversions of a subsequence; if one improves, apply it and start again from the beginning.

2-opt, one improving swap at a time

Eight cities, tour initialized by the nearest-neighbor heuristic of section 8 (the dashed tour). Each step scans all inversions of subsequences, applies the first one that shortens the tour, and restarts the scan — the deck's "if improvement ⇒ start again from beginning". Watch the length stair-step down to a 2-opt local optimum.

Key idea

Local search is the workhorse that connects chapter 9 and this chapter: Nelder–Mead was a local search over parameter space, 2-opt is a local search over tour space. Both stop at a local optimum — the first solution whose whole neighborhood is worse — and both need a strategy for what to do when that happens. That strategy is the entire subject of the next four sections.

10. Metaheuristics: diversification versus intensification

The deck motivates its last big family with the failure mode just observed. Simple heuristics can perform very well, but can get trapped in poor quality solutions (local optima). The response, starting in the mid-1970s, is a class of algorithms that manage the trade-off between search diversification, when search is going on in bad regions of the search space, and intensification, aimed at finding the best solutions within the region being analyzed. These algorithms have been named metaheuristics.

The deck gives the two canonical definitions, worth keeping verbatim because they say the same thing with different emphasis:

"A master strategy that guides and modifies other heuristics to produce solutions beyond those that are normally generated in a quest for local optimality" (Glover, Laguna, 1997).

"An iterative master process that guides and modifies the operations of subordinate heuristics to efficiently produce high-quality solutions. It may manipulate a complete (or incomplete) single solution or a collection of solutions at each iteration. The subordinate heuristics may be high (or low) level procedures, or a simple local search, or just a construction method. The family of meta-heuristics includes, but is not limited to, adaptive memory procedures, tabu search, ant systems, greedy randomized adaptive search, variable neighborhood search, evolutionary methods, genetic algorithms, scatter search, neural networks, simulated annealing, and their hybrids" (Voß et al., 1999).

The deck then lists the relevant family: iterated local search, simulated annealing, tabu search, GRASP, variable neighborhood search, ALNS, CMSA, ejection chains, genetic algorithms, evolution strategies, ant colony optimization, scatter search, particle swarm optimization, … — particle swarm already met in chapter 9. And the closing remark of the slide is the deck's own research program in one line: all relevant metaheuristics have been hybridized with MP [mathematical programming], generating matheuristics.

The metaheuristics axis: restart and multistart methods on the diversification side, single-point memory methods on the intensification side, population methods in between, with the matheuristics note below. DIVERSIFICATION search wide — escape local optima INTENSIFICATION refine the best region found RESTART / MULTISTART GRASP · ILS (new starts, perturbations) POPULATION GA · ACO · PSO scatter search SINGLE-POINT MEMORY SA · TS · VNS · ALNS one solution + memory all relevant metaheuristics have been hybridized with MP, generating matheuristics (Voß et al. 1999 · Glover & Laguna 1997)
Plate 10.7 — The metaheuristics axis (deck slides 33–35). Every method in the deck sits on the line between diversification and intensification; the art is the trade-off. The matheuristics sentence at the bottom is the deck's own research territory.
Key idea

Diversification and intensification are the two ends of a budget: spend effort exploring new regions (diversification) versus polishing the best one found (intensification). The four methods of the next sections are four different answers to the same scheduling problem — when to do which. Chapter 9's PSO was already one of them (the population column); now the single-point methods get their turn.

11. Iterated local search and simulated annealing

Iterated Local Search (ILS) is the simplest metaheuristic and the honest baseline. Repeat local searches starting from different initial solutions. The refinement that makes it work: initial solutions should not be random to increase effectiveness. Bespoke perturbations of previous solutions or of problem data work best. Instead of restarting blindly, ILS perturbs the current local optimum — a big jump in neighborhood space, not a random draw — and runs local search again:

function IteratedLocalSearch():
1. Generate an initial feasible solution x⁰
2. Apply a local search on x⁰ obtaining a local optimum x○
3. repeat
4.   Set x = Perturbation(x○, history)
5.   Set x = LocalSearch(x)
6.   Set x○ = AcceptanceCriterion(x○, x, history)
7.   if (z(x*) > z(x○)) then set x* = x○
8. until termination condition
9. return x*

Simulated Annealing (SA), a simple and widely used metaheuristic, replaces the "restart" strategy with a probabilistic escape: a worse move is accepted with a probability that decays as the search cools:

function SimulatedAnnealing(T):
1. Generate a feasible solution x; Set x* = x
2. Generate a feasible solution x′ ∈ N(x)
3. if (z(x′) < z(x)) then set x = x′
4. if (z(x*) > z(x)) then x* = x
5. else set x = x′ with probability p = exp(−(z(x′) − z(x))/kT)
6. if (annealing condition) then decrease T
7. if not (terminating condition) then go to 2
8. return x*
Editor's note

The deck's slide prints the acceptance probability with a mangled comparison (a text-extraction artifact of "≤"). The standard form used everywhere — and in the widget below — is p = exp(−(z(x′) − z(x))/kT): the worse the proposed move and the colder the system, the smaller the chance it is accepted. In practice the Boltzmann constant k is absorbed into the temperature scale.

The deck's example is a TSP trace on the benchmark instance ulysses16: the plot shows z values over iterations, oscillating around a descending trend — the accepted uphill moves are what let the search climb out of one basin and into a deeper one. The widget below reproduces that trace live on a small TSP with the 2-opt neighborhood of section 9.

Simulated annealing trace on a small TSP

Eight cities, 2-opt neighborhood, starting from the nearest-neighbor tour. The cobalt line is the length of the current tour after each iteration; vermilion dots mark accepted worse moves — the uphill steps that let the search escape local optima; the forest step line is the best tour seen. Raise T₀ and the early phase accepts almost everything; lower it and the search is nearly pure descent.

12
300
Key idea

SA is local search with a temperature-controlled willingness to go uphill. Early (hot) it behaves almost like random search — diversification; late (cold) it behaves exactly like 2-opt descent — intensification. The temperature schedule is the diversification/intensification trade-off of section 10, written as a single decreasing number.

12. Tabu search

Where SA randomizes the uphill decision, Tabu Search (TS) [GL97] makes it deterministic and memory-driven. TS escapes from local minima by moving onto the best solution of the neighborhood at each iteration, even though it is worse than the current one. A memory structure called tabu list, TL, forbids to return to already explored solutions:

function TabuSearch():
1. Generate an initial feasible solution S,
   set S* = S and initialize TL = ∅
2. Find S′ ∈ N(S), such that
   z(S′) = min { z(S^), ∀S^ ∈ N(S), S^ ∉ TL }
3. S = S′, TL = TL ∪ {S}, if (z(S*) > z(S)) set S* = S
4. If not (end condition) go to step 2

Two details make it work. First, "best of the neighborhood even though it is worse": when no neighbor improves, TS still moves — to the least-bad one — which is how it walks out of a basin that 2-opt would call the answer. Second, the tabu list is what keeps that walk from immediately returning: the move that just made things worse is exactly the move a naive "go to the best neighbor" rule would immediately undo, so TS forbids the recently used moves for a while (a tenure). In practice the list stores features of moves rather than whole solutions, and an aspiration criterion — a tabu move that would beat the global best is allowed anyway — prevents the memory from blocking the best move available.

Tabu search, step by step, with the tabu list visible

Eight cities, 2-opt neighborhood, tenure = 7. Each step evaluates the whole neighborhood and applies the best move that is not tabu — or a tabu move that improves the global best (aspiration). The output shows exactly which two edges were removed, and the tabu list chips show what is currently forbidden and for how many more steps.

7
Key idea

SA and TS are the two classic answers to the local-optimum trap: SA escapes by probabilistic uphill moves, TS by forced moves to the best neighbor plus a memory that forbids undoing them. The deck's trace slides show both on the same benchmark (ulysses16) — same problem, same neighborhood, different escape mechanisms, both descending toward the same region of good tours.

13. GRASP, variable neighborhood search and ALNS

Three more members of the family, each with a distinct idea. GRASP (Greedy Randomized Adaptive Search Procedure) restarts search from another promising region of the search space as soon as a local optimum is reached. GRASP consists in a multistart approach with a suggestion on how to construct the initial solutions — the construction itself is randomized:

function GRASP():
1. Build a solution S (=S* in the first iteration) by a constructive
   greedy randomized procedure based on candidate lists.
2. Apply a local search procedure starting from S and producing S′.
3. If z(S′) < z(S*) then S* = S′.
4. If not (end condition) go to step 1.

The trace the deck shows for GRASP on ulysses16 plots three lines: zcons (the cost of each constructed solution), zloc (the cost after the local search that follows each construction) and zbest (the best found so far). The pattern is the signature of multistart: zcons jumps around (randomized construction), zloc always lands below its zcons (local search does its job), and zbest descends in steps, one per restart.

Variable Neighborhood Search (VNS) explores a sequence of neighborhoods at each iteration (called a Variable Neighborhood Descent, VND), followed by a perturbation of the incumbent solution. The insight is the deck's best single sentence of the section: a local minimum with respect to one neighborhood is not necessarily a local minimum for other neighborhoods. Only a global optimum is a local optimum for any neighborhood. So VND applies the chosen neighborhoods in a fixed order, restarting from the beginning each time an improvement is found; VNS wraps it with a perturbation step (re-instantiating search on another seed) and an acceptance step (evaluating exploration versus exploitation).

function VariableNeighborhoodDescent(x):
1. Define Nₘ, k = 1, ..., k_max          // the neighborhoods
2. Set k = 1
3. repeat
4.   Set x′ = FindBestNeighbor(x, Nₘ)
5.   if (z(x′) < z(x)) then x = x′; x* = x; k = 1
6.   else k = k + 1
7. until k > k_max
8. return x*

function VariableNeighborhoodSearch():
1. Generate an initial feasible solution x
2. Set x* = x
3. repeat
4.   Set x′ = VariableNeighborhoodDescent(x)   // can be any local search
5.   if (z(x*) > z(x′)) then set x* = x′
6.   Set x = Perturb(x′)                      // perturbation
7.   Set x = Accept(x, history)                // acceptance
8. until termination condition
9. return x*

Finally ALNS — Adaptive Large Neighborhood Search — maintains sets of destroy and reconstruct operators, records the performance of each, and dynamically adjusts the weights used to choose (in probability or otherwise) which method to use at each iteration:

function ALNS():
// Given: an initial solution
//         a set of destroy methods Ω⁻ and associated weights w⁻
//         a set of repair methods Ω⁺ and associated weights w⁺
1. Repeat until stop-criterion:
      Choose a method from Ω⁻ and a method from Ω⁺
      Destroy part of solution
      Repair solution
      Accept or reject new solution
      Update destroy and repair weights w⁻ and w⁺
2. Return best solution encountered

ALNS is the metaheuristic as learner: the algorithm itself is fixed, and what adapts is which of its tools gets used, based on their recorded performance. The destroy/repair pair is a very large neighborhood — "destroy part of the solution, repair it" — searched adaptively.

Key idea

Read the four methods as a progression of the same theme. ILS perturbs one solution and re-descends; SA accepts uphill moves probabilistically; TS forbids recent moves and accepts the best non-forbidden one; GRASP re-randomizes the construction; VNS changes the neighborhood itself; ALNS learns which changes work. Every one of them is "local search, plus a mechanism for not stopping at the first local optimum" — and that mechanism is the meta part.

14. The loop closes: prescriptive analytics in the exam project

This is the last deck, and it closes the loop drawn on the course index: operations produce data; descriptive statistics summarize it; predictive models extend it into the future; prescriptive optimization turns the forecast into decisions that act back on operations. The index plate's dashed vermilion line — "decision taken NOW acts back on operations" — is exactly what this chapter's models formalize.

Where chapter 9 ended with fitting the parameters of models, this chapter began where those models' outputs become inputs: the forecast of demand is the qᵢ of a GAP or the qi of a VRP; the predicted failure probability of a machine decides whether it is in the maintenance schedule; the predicted service time decides how crews are rostered. The vocabulary of this chapter is what lets you name the model — LP, ILP, MILP, combinatorial — and then choose the method: exact when the instance is small (simplex, branch-and-bound, the closed forms of chapter 9), heuristic when it is not (constructive → local search → metaheuristic).

For the exam

The exam project is a forecasting project, and this chapter is its natural extension question — "what would you do with the forecast?" Being able to answer with the GAP model of section 7 ("each customer demand qᵢ must be served once, capacities Qᵢ must hold, minimize total cost") or the TSP/VRP vocabulary of section 6–7 is what separates a complete answer from a merely good one. The three sentences to have ready: (1) the forecast is a random variable, so the decision model is stochastic or robust in principle; (2) at real sizes, optimality is out of reach in acceptable time, so the deliverable is S*, the best feasible solution found; (3) constructive + local search + a metaheuristic is the standard way to produce it.

And one last thread to the beginning of the course. The first chapter's three payoffs — faster decisions, fault fixing, productivity — are the objective function of this chapter: every model here is a formal way of choosing the decision that delivers them. The Euler epigraph of slide 2 — nothing happens in the world without some principle of maximum or minimum — is, in the end, the one-line summary of the whole course: measurements describe the world (chapters 2–8), and optimization decides in it (chapters 9–10).

Course epilogue

Operational Analytics, reconstructed from the decks 0–9, the transformers lecture and the project brief: forecasting machinery (chapters 2–7), the statistics to describe and compare it (chapter 8), the parameter fitting underneath it all (chapter 9), and the optimization that turns it into decisions (chapter 10). The exam project exercises the whole loop — and now the loop is closed.

Check your understanding

State the deck's definition of mathematical optimization and the formal problem it solves.

Mathematical optimization (aka mathematical programming) is the selection of a best element from some set of available alternatives: minimizing (or maximizing) a real function by choosing input values from within an allowed set. Formally: given f : A → ℝ, find x₀ ∈ A such that f(x₀) ≤ f(x) for all x ∈ A (minimization) or f(x₀) ≥ f(x) for all x (maximization). The deck's epigraph (Euler): nothing happens in the world without some principle of maximum or minimum.

List the eight subfields of optimization named by the deck.

Linear programming (linear objective and linear constraints), nonlinear programming (nonlinear objective and/or constraints), quadratic programming (quadratic objective, linear feasible set), integer programming (some or all variables integer; in general much more difficult than LP), combinatorial optimization (discrete feasible set), stochastic programming (parameters/constraints depend on random variables), robust programming (solutions valid under a wide set of uncertainty realizations), constraint programming (relations between variables stated as constraints) — and many more.

Solve the deck's nonlinear example: min x² − 2x + 3, s.t. x² ≤ 9.

The unconstrained minimum of the parabola is at x = 1 (derivative 2x − 2 = 0), inside the feasible interval x ∈ [−3, 3] — the constraint is inactive and the answer is x = 1, f = 2. The lesson: constraints only matter when they bite.

Write the deck's LP example and say what happens to its feasible region as extracted.

min −x₁ − x₂ s.t. x₁ − x₂ ≤ 1.5; −7x₁ + 5x₂ ≤ −17.5; −x₂ ≤ −4.5; x₁, x₂ ≥ 0. As extracted, the three half-planes leave the region unbounded to the north-east: x₂ can grow with x₁ while all constraints hold, so the objective −(x₁ + x₂) → −∞ and the correct solver answer is "unbounded". With an added bound x₁ ≤ 8 the optimum vertex is (8, 7.7) with z = −15.7, and the ILP optimum is the lattice point (8, 7) with z = −15.

Define ILP and MILP, and explain why integer programming is harder than LP.

Integer Linear Programming: linear programs where all variables are constrained to integer values; Mixed Integer Linear Programming: some variables integer, some continuous. It is in general much more difficult because the LP optimum is a vertex of the polyhedron, while the ILP optimum is a lattice point inside it — rounding the LP solution is generally infeasible or suboptimal (e.g. rounding (8, 7.7) to (8, 8) violates the constraints), so the search must work on the lattice itself.

What is the "acceptable quality / acceptable time" contract?

The size of the instances met in real world applications rules out solving them to optimality in an acceptable time; nevertheless these instances must be solved; thus the need to look for suboptimal solutions, provided they are of acceptable quality and can be found in acceptable time. It is the license for every heuristic in the chapter.

Give the formal definition of a combinatorial optimization problem (C, F, z, S°, S*).

A CO problem is defined over a set C = {c₁, …, cₙ} of basic components; a solution is a subset S ⊂ C; F ⊆ 2C is the subset of feasible solutions (S is feasible iff S ∈ F); z : 2C → ℝ is the cost function. The objective is a minimum-cost feasible solution S° with z(S°) ≤ z(S) for all S ∈ F; failing this, the algorithm returns the best feasible solution found, S* ∈ F.

Define the TSP and translate it into the CO vocabulary.

n locations (home plus n−1 customers), distance matrix [dij]; find the shortest tour starting home, visiting each customer once and returning home; symmetric or asymmetric. As CO: over the weighted graph G=(V,E,D), the component set is C = E; F is the set of Hamiltonian cycles; z(S) is the sum of the weights of the edges in S. n nodes ⇒ (n−1)! possible tours (half that undirected); the deck's table: 120, 3,628,800, 1.31·10¹², 2.43·10¹⁴ for n = 5, 10, 15, 20.

What is the TSP's LP formulation "almost identical to", and what must be added?

It is a binary LP almost identical to the assignment problem — each vertex incident to exactly two tour edges (∑j xij = 2 for every i, undirected), xij ∈ {0,1} — plus conditions to avoid short cycles: subtour elimination constraints, which forbid the solution from being two or more disjoint cycles instead of one Hamiltonian cycle.

Define the VRP: goal, constraints, objective and input data.

Goal: determine optimal routes for a fleet of vehicles delivering goods to customers. Constraints: vehicle capacities, plus possibly delivery time windows, customer service times, driver working hours / route duration limits, split deliveries, pickup and delivery. Objective: minimize total distance, cost or time. Data: V = {0, …, n} (0 = depot), edges E, cost cij, demand qi, capacity Q, number of vehicles K.

Write the GAP model: objective and constraints, and what each means.

min ∑i,j cijxij (1) — transport cost; s.t. ∑i xij = 1 for all j (2) — every customer request satisfied exactly once; ∑j qijxij ≤ Qi for all i (3) — facility capacities hold; xij ∈ {0,1} or xij ≥ 0 (4) — singly assigned (binary) or splittable demand. A MILP: binary/integer variables, linear objective and constraints.

Give the Constructive() pseudocode and its two caveats.

Sort the components in C by increasing costs; S* = ∅; repeat: if S* ∪ cᵢ is a feasible partial solution then S* = S* ∪ cᵢ. Caveats: for certain problems it yields optimal solutions (e.g. the MST); in other cases it may be unable to construct a feasible solution at all. TSP constructive strategies: Farthest Insertion, Nearest Neighbor, Best Insertion, Sweep.

Why does the deck say "GREEDY ⇒ the last connections tend to be long"?

Nearest Neighbor always moves to the closest unvisited city: perfect local information, zero foresight. The early choices look optimal, but they can strand the tour so that the final closing connections — the last few edges — are forced to be long. Hence constructive heuristics are only phase one, and improvement (local search) should be used afterwards.

Define the neighborhood function and give the LocalSearch() loop.

N(S) is a subset of 2C defined by a neighborhood function N : 2C → 22C (often restricted to feasible solutions, N : F → 2F); the choice of neighborhood has a deep impact on performance and is left to the algorithm designer. LocalSearch: generate an initial feasible solution S; find S′ ∈ N(S) minimizing z; if z(S′) < z(S) then S = S′ and repeat; otherwise S* = S. The update is called a move; it may be made to the first improving solution found. For some problems LS guarantees optimality (the simplex algorithm); for TSP the classic neighborhoods are 2-opt and 3-opt, with Lin–Kernighan as the more sophisticated relative.

Give the two deck definitions of metaheuristics and the diversification/intensification trade-off.

Glover & Laguna (1997): "a master strategy that guides and modifies other heuristics to produce solutions beyond those that are normally generated in a quest for local optimality". Voß et al. (1999): "an iterative master process that guides and modifies the operations of subordinate heuristics to efficiently produce high-quality solutions", manipulating a single solution or a collection. Metaheuristics manage the trade-off between diversification (searching bad regions to escape local optima) and intensification (refining the best region found). All relevant ones have been hybridized with mathematical programming, generating matheuristics.

Describe Iterated Local Search and why its perturbations should not be random.

ILS repeats local searches starting from different initial solutions: perturb the current local optimum, run local search again, apply an acceptance criterion, keep the best. Initial solutions should not be random because random restarts ignore everything the search has learned; bespoke perturbations of previous solutions or of problem data work best, because they land near good regions instead of anywhere.

Write the simulated annealing acceptance rule and explain what the temperature does.

A proposed neighbor x′ replaces x if z(x′) < z(x); otherwise it is accepted with probability p = exp(−(z(x′) − z(x))/kT) — the worse the move and the colder the system, the smaller the chance. The temperature T starts high (almost everything accepted: diversification) and decreases under the annealing condition until the search is pure descent (intensification). The deck's example is the ulysses16 TSP trace: z values oscillating around a descending trend, with accepted uphill moves visible as spikes.

Explain how tabu search escapes local minima, and what the tabu list and aspiration criterion are.

TS moves onto the best solution of the neighborhood at each iteration, even though it is worse than the current one — so at a local optimum it takes the least-bad neighbor instead of stopping. The tabu list (TL) forbids returning to recently explored solutions (typically recent moves, kept for a tenure), which prevents the immediate undo of the escape move. The aspiration criterion allows a tabu move anyway if it would beat the global best. Best-so-far S* is updated whenever z improves.

Describe GRASP, VNS and ALNS in one paragraph each.

GRASP: multistart — construct a solution with a greedy randomized procedure based on candidate lists, improve it by local search, keep the best, restart; the trace shows zcons (constructed), zloc (after local search) and zbest (best so far). VNS: a local minimum for one neighborhood is not necessarily one for another, and only a global optimum is local for every neighborhood; VND applies a fixed sequence of neighborhoods, restarting at the first improvement, and VNS wraps it with perturbation and acceptance. ALNS: maintains sets of destroy and repair operators with weights; each iteration chooses one of each (in probability), destroys part of the solution, repairs it, accepts or rejects, and updates the weights from recorded performance — the metaheuristic that learns which of its tools work.