Heuristic — penalty-guided metaheuristic· v1.0.0

Guided Local Search

Aliases gls, guided_local_search, guided-local-search
Type Heuristic — penalty-guided metaheuristic
Complexity O(n³ + epochs · n²)
Warm start Consumes the previous pipeline stage’s tour; falls back to nn
Benchmarks published results ↓

Description

Guided Local Search (GLS) is a penalty-based metaheuristic. It keeps the true tour cost g(s) and adds a penalty field over the edges in the current tour:

h(s) = g(s) + lambda * sum(p_e)

where p_e is the penalty count of edge e. The solver runs 2-opt on h, then penalizes the edge(s) with the highest utility c_e / (1 + p_e), and runs 2-opt again. Penalizing a frequently used long edge raises its augmented cost, so the next local search is pushed to replace it. The solver always tracks and returns the best tour seen under the true cost g, so a penalty step cannot make the final answer worse than the best tour found.

procedure GLS(tour):
    p[e] ← 0 for every edge
    s ← LocalSearch2opt(tour, h with p = 0)     # true-cost local optimum
    best ← s
    repeat:
        util[e] ← c_e / (1 + p_e) for edges in s
        penalize every edge with max util
        lambda ← alpha * g(s) / n
        s ← LocalSearch2opt(s, h)
        best ← argmin_g(best, s)
    until epochs or stagnation
    return two_opt(best)                        # unpenalized polish

alpha normalizes the penalty scale to the instance: lambda = alpha * g(s) / n, so one default works across instance sizes. The research sweep found alpha = 0.3 clears the acceptance bar on berlin52 and a280. The sweep is not perfectly flat, so treat 0.3 as a default rather than a tuned optimum.

The solver is deterministic: no random number generator is used. The nearest-neighbour seed, the (i, j) 2-opt tie-break, the tie-all maximum-utility rule, and alpha are fixed. The result is deterministic for a fixed starting tour; a caller-supplied warm start changes it. The reported cost is recomputed from the problem’s distance source. Symmetric EXPLICIT matrices work unchanged because the solver only reads pairwise distances; the derived display layout is never used as the objective.

Standalone runs consume the pipeline warm start when one exists and otherwise start from a nearest-neighbour tour. The CLI auto-expands a standalone run to pipeline(nn, guided_local_search); --no-seed skips that automatic prefix, but with no warm start the solver still builds its own nearest-neighbour tour.

The inner loop rescans O(n²) pairs per accepted move, and the first pass from an NN seed makes O(n) moves, so the default max_cities is 2,000: the dispatcher rejects larger instances before the work starts. At that default the dense penalty array is 16 MB. Raise max_cities with --gls_max_cities or [gls] max_cities when you have the hardware; a raised cap uses more memory and takes longer. The API and WASM use the default 2,000. GLS is not a large-instance path; sfc remains the 100k-city solver.

Options

Option Default Meaning
alpha 0.3 Penalty strength, in (0, 1]. Exposed through the CLI, [gls] TOML, and the API request.
epochs 1000 Maximum outer iterations. 0 means no outer cap.
stagnation_epochs 200 Stop after this many non-improving outer iterations. 0 disables the stop. epochs = 0 with stagnation_epochs = 0 is rejected.
max_cities 2000 Maximum city count before the size guard rejects. Raise it from the CLI or [gls]; there is no upper bound. The API and WASM use the default.
plateau_epochs 500 Accepted by the shared options table but unused by GLS.
n_nearest 3 Affects only the candidate list in the final two_opt polish.

The WASM bridge exposes no GLS-specific parameters in this version and uses the defaults. The Qt GUI also uses the defaults for GLS, so its epoch and plateau settings do not change a GLS run.

Usage

# auto-expands to pipeline(nn, guided_local_search)
teeline solve gls -i ./data/tsplib/berlin52.tsp

# explicit alias
teeline solve guided_local_search -i ./data/tsplib/berlin52.tsp

# stronger penalty field
teeline solve gls --alpha 0.5 -i ./data/tsplib/berlin52.tsp

# skip the automatic nearest-neighbour prefix
teeline solve gls --no-seed -i ./data/tsplib/berlin52.tsp

# raise the size guard for a faster machine; larger values take longer
teeline solve gls --gls_max_cities 5000 -i ./data/tsplib/dsj1000.tsp

# compose with a stronger constructive stage
teeline pipeline --steps=sfc,gls -i ./data/tsplib/berlin52.tsp

# polish after GLS
teeline pipeline --steps=nn,gls,2opt -i ./data/tsplib/berlin52.tsp

Benchmark notes

Tier A, release build, five runs per instance: berlin52 7542 (0.00%), kroA100 21,320 (+0.18%), a280 2,627 (+1.86%), and dsj1000 19,582,412 (+4.95%). Every run is identical, and the slowest instance (dsj1000) takes about 34 s, well inside the 300 s meta budget. The benchmark measures the auto-expanded nn → gls pipeline.

References

  • Voudouris, C. & Tsang, E. (1999) — “Guided local search and its application to the traveling salesman problem”, European Journal of Operational Research, 113(2), 469–499. https://doi.org/10.1016/S0377-2217(98)00099-X
  • Voudouris, C. & Tsang, E. (2003) — “Guided Local Search”, in Handbook of Metaheuristics, ch. 7, 185–218. https://doi.org/10.1007/0-306-48056-5_7
  • Voudouris, C. (1997) — Guided local search for combinatorial optimisation problems, PhD thesis, University of Essex.

Changelog

Date Version Change
2026-11-28 1.0.0 Initial GLS metaheuristic: penalized 2-opt inner loop, tie-all maximum-utility penalties, deterministic output, nn auto-seed, alpha/epochs/stagnation_epochs options, and a configurable max_cities size guard (default 2,000, no upper bound).

Benchmarks

Loading published results…