Lecture 5 — Local Search and Neighborhood Structures

Solution representation, neighborhoods, intensification

1 Learning Objectives

By the end of this lecture, students should be able to:

  • understand the role of local search in heuristic optimization
  • design effective solution representations for combinatorial problems
  • define and analyze neighborhood structures
  • distinguish between different neighborhood operators
  • understand intensification and its role in improving solution quality
  • recognize the limitations of naive local search and how neighborhoods affect performance

2 Lecture Roadmap

This lecture proceeds in seven blocks:

  1. local search as an iterative improvement paradigm
  2. solution representation choices
  3. neighborhood design and complexity trade-offs
  4. move acceptance strategies and termination rules
  5. intensification, diversification, and stagnation behavior
  6. incremental evaluation for scalable implementations
  7. local search as a core engine inside metaheuristics

5 Solution Representation

5.1 Why Representation Matters

The solution representation is a foundational design choice in local search and, more broadly, in heuristic and metaheuristic optimization. It determines:

  • how candidate solutions are encoded and stored in memory,
  • which types of modifications or moves are possible,
  • how neighborhoods are defined and explored, and
  • how efficiently objective values and constraint violations can be evaluated.

A well-chosen representation exposes the structure of the problem and enables efficient neighborhood exploration. Conversely, a poor representation can severely limit the effectiveness of local search, making even sophisticated algorithms slow, fragile, or incapable of reaching high-quality solutions.

In practice, the representation implicitly defines the geometry of the search space and strongly influences convergence behavior.


5.2 Common Solution Representations

Different classes of optimization problems naturally lend themselves to different solution representations. The choice should align with the decision structure of the problem and support meaningful neighborhood moves.

  • Binary vector representation

    • Used in selection, knapsack, set covering, and facility location problems.
    • Each component represents a yes–no decision.
    • Example: \[ x \in \{0,1\}^n \]
    • Neighborhoods are often defined by bit flips or small combinations of flips.
  • Integer vector representation

    • Used in assignment, allocation, and partitioning problems.
    • Each variable takes one value from a finite set of options.
    • Example: \[ x_i \in \{1,\dots,m\} \]
    • Neighborhoods typically involve reassignment or swap operations.
  • Permutation representation

    • Used in sequencing, scheduling, and routing problems.
    • A solution is represented as an ordered list of elements.
    • Example: an ordering of jobs on a machine or a sequence of cities in a tour.
    • Neighborhoods include swaps, insertions, reversals, or subsequence moves.
  • Mixed representations

    • Combine discrete and continuous components within a single solution.
    • Common in hybrid approaches and problems derived from MILP formulations.
    • Example: binary variables for activation decisions combined with continuous flow or quantity variables.

5.3 Design Considerations

An effective solution representation should:

  • reflect the natural structure of the problem,
  • allow simple and meaningful neighborhood moves,
  • support efficient feasibility checks and incremental evaluation, and
  • avoid introducing unnecessary redundancy or symmetry.

Choosing an appropriate representation is often as important as choosing the local search strategy itself, since it directly determines what parts of the solution space can be explored efficiently.


6 Neighborhood Structures

6.1 Definition

A neighborhood of a solution is the set of solutions that can be reached from it by applying a predefined move operator. Neighborhoods define the local geometry of the solution space and determine how the search progresses.

Formally, for a solution \(s\), its neighborhood is denoted by:

\[ \mathcal{N}(s) = \{ s' \mid s' \text{ can be obtained from } s \text{ by one move} \}. \]

In local search, the algorithm repeatedly evaluates elements of \(\mathcal{N}(s)\) and decides whether to move from \(s\) to one of its neighbors. The definition of the neighborhood therefore directly controls:

  • which solutions are reachable in one step,
  • how easily the search can escape poor regions, and
  • the computational cost of each iteration.

Choosing an appropriate neighborhood is one of the most critical design decisions in local search.


6.2 Common Neighborhood Operators

Neighborhood operators depend strongly on the underlying solution representation. Well-designed operators reflect the structure of the problem and enable meaningful improvements.


6.2.1 Binary Neighborhoods

Used when solutions are represented as binary vectors.

  • Single-bit flip

    • Change one binary variable from 0 to 1 or from 1 to 0.
    • Neighborhood size: \(O(n)\) for \(n\) binary variables.
    • Simple and fast, but may lead to shallow local optima.
  • Multi-bit flip

    • Flip two or more bits simultaneously.
    • Allows larger structural changes in one move.
    • Neighborhood size grows combinatorially, increasing evaluation cost.

Single-bit neighborhoods are commonly used in basic local search, while multi-bit neighborhoods are often embedded in more advanced methods.


6.2.2 Assignment Neighborhoods

Used in allocation and assignment problems.

  • Reassignment move

    • Reassign one item (e.g., customer, job) to a different category, machine, or facility.
    • Neighborhood size depends on the number of alternative assignments.
  • Swap move

    • Swap the assignments of two items.
    • Preserves certain constraints (e.g., balanced assignments) and can produce stronger improvements than single reassignment moves.

These neighborhoods are especially effective when feasibility must be maintained explicitly.


6.2.3 Permutation Neighborhoods

Used in sequencing, scheduling, and routing problems.

  • Swap

    • Exchange two positions in a sequence.
    • Simple and widely used, but limited in expressive power.
  • Insertion

    • Remove an element from its current position and insert it elsewhere.
    • Produces larger changes than swaps and often yields better improvements.
  • 2-opt move

    • Reverse a subsequence between two positions.
    • Common in routing and traveling salesman problems.
    • Efficiently removes crossings and shortens routes.

Permutation neighborhoods are often carefully selected to balance move expressiveness and evaluation cost.


6.3 Neighborhood Size and Computational Complexity

Neighborhoods vary significantly in size and computational burden:

  • Small neighborhoods

    • Fast to explore and easy to evaluate.
    • Risk of early convergence to poor local optima.
  • Large neighborhoods

    • Offer greater improvement potential and stronger diversification.
    • Increase runtime per iteration and may require specialized evaluation strategies.

A central trade-off in local search design is:

Larger neighborhoods increase solution quality potential but also increase computational cost per iteration.

Modern local search and metaheuristic methods often address this trade-off by using adaptive, variable, or implicitly explored neighborhoods, enabling efficient exploration without exhaustive enumeration.


7 Local Search Strategies

Once a solution representation and a neighborhood structure have been defined, a local search strategy specifies how the neighborhood is explored and which moves are accepted. These choices strongly influence convergence speed, solution quality, and computational effort.


7.1 Best-Improvement vs First-Improvement

Two classical move acceptance strategies are widely used in local search.

7.1.1 Best-Improvement (Steepest Descent)

  • all neighbors in \(\mathcal{N}(s)\) are evaluated,
  • the move that yields the largest improvement in the objective value is selected,
  • the search moves deterministically to the best neighboring solution.

Characteristics

  • produces strong improvements per iteration,
  • more stable and predictable behavior,
  • higher computational cost per iteration due to full neighborhood evaluation.

Best-improvement is often preferred when neighborhoods are small or when solution evaluation is inexpensive.


7.1.2 First-Improvement

  • neighbors are explored sequentially in some order,
  • the search accepts the first neighbor that improves the objective value,
  • neighborhood exploration stops as soon as an improving move is found.

Characteristics

  • significantly faster per iteration,
  • more stochastic behavior due to dependence on exploration order,
  • often reaches good solutions faster in wall-clock time.

First-improvement is especially effective for large neighborhoods where evaluating all neighbors would be prohibitively expensive.


7.2 Comparison and Practical Considerations

  • Best-improvement emphasizes solution quality per move.
  • First-improvement emphasizes speed and scalability.

In practice, first-improvement is more commonly used in large-scale problems, while best-improvement is useful in small or structured neighborhoods. Some algorithms dynamically switch between the two strategies depending on the search phase.


7.3 Termination Criteria

Local search algorithms require explicit stopping rules. Common termination criteria include:

  • Local optimality

    • no improving neighbor exists in the current neighborhood,
    • the algorithm has reached a local optimum.
  • Iteration limits

    • a predefined maximum number of iterations or moves is reached,
    • useful to control runtime in large problems.
  • Time limits

    • the algorithm stops after a fixed amount of computation time,
    • essential in real-time or large-scale applications.
  • Stagnation criteria

    • no improvement observed for a certain number of iterations,
    • often used to trigger diversification or restart mechanisms.

At termination, the current solution is locally optimal with respect to the chosen neighborhood and acceptance strategy. Escaping such local optima requires enhanced mechanisms, which motivates the metaheuristic methods introduced in subsequent lectures.


7.4 Restarts and Diversification (Preview)

When local search stagnates, a common strategy is to restart from a different region of the search space.

Typical diversification mechanisms include:

  • random restart from a new initial solution,
  • perturb-and-improve (apply a strong move, then run local search again),
  • adaptive neighborhood change (switch to a different move operator),
  • memory-guided diversification (as in tabu-based methods).

These mechanisms preserve local search as the intensification engine while improving global exploration.


9 Incremental Evaluation

9.1 Why Incremental Evaluation Matters

In local search algorithms, a large number of candidate moves are evaluated repeatedly. Recomputing the objective function and constraint violations from scratch after each move can be computationally expensive and quickly become the dominant cost of the algorithm, especially for large-scale problems or complex neighborhoods.

Incremental evaluation addresses this issue by updating the objective value and relevant constraint measures using only the difference introduced by a move, rather than re-evaluating the entire solution.

The core idea is simple:

If a move modifies only a small part of the solution, then only a small part of the objective and constraints need to be updated.

For a candidate move \(m\), this is often written as:

\[ f(s \oplus m) = f(s) + \Delta(m \mid s), \]

where \(\Delta(m \mid s)\) is the move delta computed from local information.


9.2 Benefits of Incremental Evaluation

Efficient incremental evaluation provides several critical advantages:

  • Significantly faster neighborhood exploration

    • allows many more moves to be evaluated per unit of time,
    • enables the use of larger or more expressive neighborhoods.
  • Improved scalability

    • makes local search feasible for large instances with thousands or millions of variables,
    • avoids repeated full computations that scale poorly with problem size.
  • Support for complex neighborhoods

    • enables multi-move and large-neighborhood operators that would otherwise be too costly,
    • essential for advanced local search and metaheuristic techniques.

9.3 Typical Use Cases

Incremental evaluation is particularly effective when:

  • objective functions are additive (e.g., sums of costs or distances),
  • moves affect only a limited subset of decision variables, and
  • constraints can be updated locally (e.g., capacity usage, assignment counts).

Examples include updating total cost after flipping a binary variable, recalculating route length after a 2-opt move, or adjusting load after reassigning a single customer.


9.4 Practical Importance

In practice, efficient local search implementations rely heavily on incremental evaluation. The difference between a naive implementation and an incrementally evaluated one can be orders of magnitude in runtime. For this reason, careful bookkeeping of objective contributions and constraint impacts is a key skill in designing effective heuristic and metaheuristic algorithms.


10 Limitations and Role of Local Search in Metaheuristics

10.2 Role of Local Search in Metaheuristics

In modern soft computing, local search is rarely used as a standalone optimization method. Instead, it plays a central role as a core intensification component within more powerful metaheuristic algorithms.

Many well-known metaheuristics explicitly rely on local search:

  • Simulated annealing

    • performs local moves but allows non-improving moves with controlled probability,
    • enables escape from local optima while retaining local refinement.
  • Tabu search

    • applies local search guided by memory structures,
    • prevents cycling and encourages exploration of new regions.
  • Genetic algorithms with local improvement (memetic algorithms)

    • use evolutionary operators for exploration,
    • apply local search to refine individuals and accelerate convergence.
  • Large and variable neighborhood search

    • repeatedly invoke local search after changing the neighborhood structure,
    • combine diversification and intensification dynamically.

Within these frameworks, local search provides the intensification engine, responsible for exploiting high-quality regions of the solution space. Metaheuristics augment local search with memory, randomness, and adaptive control to overcome its limitations, achieving both robustness and scalability on large and complex optimization problems.


10.3 Implementation Checklist

Before scaling a local search implementation, verify the following:

  1. solution representation is explicit and easy to mutate
  2. neighborhood operators are correct and unit-tested on small instances
  3. feasibility checks (or penalty logic) are consistent
  4. incremental evaluation matches full recomputation on validation samples
  5. stopping criteria and runtime budgets are clearly defined
  6. performance is measured over multiple random seeds/instances

This checklist prevents many common bugs that otherwise appear only at large scale.


10.4 Takeaways

  • Local search iteratively improves solutions using neighborhood moves
  • Solution representation determines what neighborhoods are possible
  • Neighborhood design is critical for performance
  • Intensification focuses search around good solutions
  • Efficient evaluation is essential for scalability
  • Local search is a key building block of metaheuristics

11 Mini Exercises

  1. Solution representation and neighborhood design Consider a simple knapsack problem with binary decision variables.

    • Propose a suitable solution representation.
    • Define at least one neighborhood structure (for example, single-bit flip or swap-based).
    • Explain how a local search algorithm would explore this neighborhood to improve the solution.
  2. Comparison of local search strategies Compare first-improvement and best-improvement strategies in local search.

    • Discuss their differences in terms of computational effort per iteration.
    • Explain how each strategy affects convergence speed and solution quality.
    • Identify situations where one strategy may be preferred over the other.
  3. Incremental evaluation design Consider a binary optimization problem with objective \[ f(x)=\sum_{j=1}^{n} c_j x_j,\quad x_j\in\{0,1\}. \]

    • Derive the objective delta for flipping a single variable \(x_k\).
    • Explain how this delta avoids full objective recomputation.
    • Estimate the difference in per-move cost between naive and incremental evaluation.
  4. Feasibility handling trade-offs For a constrained assignment problem, compare:

    • strictly feasibility-preserving moves, and
    • moves that allow temporary infeasibility with penalties.

    Discuss how each choice affects exploration, implementation complexity, and final solution quality.


12 References for This Chapter

  1. Hoos, H. H., & Stutzle, T. (2005). Stochastic Local Search: Foundations and Applications. Morgan Kaufmann. URL: https://www.cs.ubc.ca/~hoos/SLS-Book/about.html
  2. Kernighan, B. W., & Lin, S. (1970). An efficient heuristic procedure for partitioning graphs. Bell System Technical Journal, 49(2), 291-307. DOI: 10.1002/j.1538-7305.1970.tb01770.x
  3. Lin, S., & Kernighan, B. W. (1973). An effective heuristic algorithm for the traveling-salesman problem. Operations Research, 21(2), 498-516. DOI: 10.1287/opre.21.2.498
  4. Mladenovic, N., & Hansen, P. (1997). Variable neighborhood search. Computers & Operations Research, 24(11), 1097-1100. DOI: 10.1016/S0305-0548(97)00031-2
  5. Johnson, D. S., Aragon, C. R., McGeoch, L. A., & Schevon, C. (1989). Optimization by simulated annealing: An experimental evaluation; part I, graph partitioning. Operations Research, 37(6), 865-892. DOI: 10.1287/opre.37.6.865
  6. Lourenco, H. R., Martin, O. C., & Stutzle, T. (2019). Iterated local search: Framework and applications. In Handbook of Metaheuristics (3rd ed.). DOI: 10.1007/978-3-319-91086-4_5
Back to top