Skip to content

irregular: make the direct trigonometry local search independent of the time - #727

Merged
fontanf merged 2 commits into
masterfrom
irregular-local-search-deterministic
Oct 20, 2026
Merged

fontanf merged 2 commits into
masterfrom
irregular-local-search-deterministic

Conversation

@fontanf

@fontanf fontanf commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes the direct trigonometry local search independent of the time, so that it fits the optimization modes of the library and is deterministic in the not anytime modes.

The exploration and compression phases of Sparrow (exploration until 80% of the time limit, then compression with shrink ratios decreasing with the elapsed time) are replaced by the population-based iterated local search on each sub-problem of the sequential feasibility algorithm, with two changes to the separation:

  • Early abort / racing. A separation starting from a disruption of a failed layout stops after a single strike while its loss isn't smaller than the loss of this failed layout (before the disruption). Otherwise, it gets the usual 3 strikes (SeparatorParameters::maximum_number_of_strikes_above_reference).
  • Stronger initial separation. The separation of the initial layout of each sub-problem (built from the best solution found) gets 10 strikes (LocalSearchParameters::initial_separation_maximum_number_of_strikes), a bit like the compression step of Sparrow.

Optimization modes

  • Anytime: no limit on the number of failed separations; the local search stops with the timer.
  • Not anytime: a sub-problem is given up after not_anytime_local_search_maximum_number_of_failed_separations failed separations (new OptimizeParameters field, default 10, also on the command line and in the Python bindings).
  • NotAnytimeSequential: a single worker in the separator. The 3 workers of the other modes are deterministic (seeded from the generator, joined, best one kept).

With the same seed, two runs give identical solutions in NotAnytimeDeterministic and NotAnytimeSequential (checked on jakobs1 and albano).

Results

13 literature instances (data_literature.csv), 120 s, seeds 0 and 1, mean gap to the best known solutions:

mean gap
Exploration + compression (master) 1.54
This PR 1.47
Sparrow 1.69

Variants tried along the way (same benchmark): iterated local search without the reference loss rule 1.73, with 5 strikes for all separations 1.69, plus a "no perturbation" operator 1.63, smaller fixed shrink ratios 1.68–1.74, several initial layouts per sub-problem 1.77.

Other changes

  • maximum_number_of_failed_separations can be -1 (no limit).
  • The compression of the sequential feasibility algorithm is removed: it isn't used anymore.
  • local_search_direct_trigonometry is restructured: separation of the initial layout, then a loop that draws a failed layout from the population, disrupts it and separates it (same behaviour: identical solutions in the not anytime modes).
  • RestartSelection is removed: the failed layouts are always drawn by binary tournament in the population (the selection of Sparrow was behind on the benchmark of irregular: add a local search with a direct trigonometry engine #725, 1.61 against 1.54).

Tests

All irregular test executables and Python irregular tests pass.

…he time

Replace the exploration and compression phases of Sparrow, which depend on
the time limit, by the population-based iterated local search on each
sub-problem of the sequential feasibility algorithm:
- A separation starting from a disruption of a failed layout of the
  population stops after a single strike while its loss isn't smaller than
  the loss of this failed layout
  ('SeparatorParameters::maximum_number_of_strikes_above_reference').
- The separation of the initial layout of a sub-problem gets more strikes
  ('LocalSearchParameters::initial_separation_maximum_number_of_strikes').
- 'maximum_number_of_failed_separations' can be -1 (no limit).

Optimization modes:
- Anytime: no limit on the number of failed separations; the local search
  stops with the timer.
- Not anytime: new parameter
  'not_anytime_local_search_maximum_number_of_failed_separations' (also on
  the command line and in the Python bindings).
- NotAnytimeSequential: a single worker in the separator.

Remove the compression of the sequential feasibility algorithm, which isn't
used anymore.
@fontanf
fontanf force-pushed the irregular-local-search-deterministic branch from ef57c1b to dfd23f5 Compare October 20, 2026 16:41
…estartSelection

Separate the initial layout first, then loop: draw a failed layout from the
population, disrupt it and separate it. Remove the selection of Sparrow
(RestartSelection::LowestLoss): the failed layouts are always drawn by
binary tournament in the population.
@fontanf
fontanf merged commit eb7a250 into master Oct 20, 2026
15 of 16 checks passed
@fontanf
fontanf deleted the irregular-local-search-deterministic branch October 20, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant