Skip to content

irregular: compute the periodic packings before solving sub-instances - #883

Merged
fontanf merged 2 commits into
masterfrom
irregular-request-periodic-packings
Nov 19, 2026
Merged

fontanf merged 2 commits into
masterfrom
irregular-request-periodic-packings

Conversation

@fontanf

@fontanf fontanf commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Depends on #882 (uses the timer version of Instance::get_periodic_packings); its commit is included in this branch.

Problem

Since the cached structures are computed lazily (aab3523), nothing requests the periodic packings on the instance solved by the sequential single knapsack, the sequential value correction, the dichotomic search and the column generation. A sub-instance only gets the periodic packings of its original instance if they are already computed, so the subproblems computed them again.

Previously, they were computed by the instance builder, before the timer starts.

Change

These four algorithms now request the periodic packings on the instance before solving its sub-instances, as is already done for the simplified shapes.

Results

alma2025/alma_02, -t 60:

First solution Best
Before (Oct 31, eager computation) 1.7 s (+ ~13 s before the timer starts) 13 bins at 6.0 s
master 29 s 14 bins at 103 s
This PR 6.0 s 14 bins at 7.6 s

Irregular unit tests pass.

…ime limit

The precomputations of the blocks (box, rectangle, rectangleguillotine),
of the periodic packings and of the simplified shapes (irregular) took a
'const bool& end'. They never checked the time limit, and since the end
booleans of the algorithm formatters are atomic, passing one bound the
reference to a temporary copy, so they didn't stop when the algorithm
ended either. Under load, the periodic packings of alma_01 ran 30-40 s
past a 60 s time limit.

They now take an 'optimizationtools::Timer', with the end boolean of the
algorithm formatter added to it. The periodic packings also check it
inside the computation of each item type and of the wrapping periodic
packings. An interrupted computation of the periodic packings now
discards everything computed in the call: previously, the wrapping
periodic packings between the item types computed before the
interruption were never computed.
Since the cached structures are computed lazily, the periodic packings
were never computed on the instance solved by the sequential single
knapsack, the sequential value correction, the dichotomic search and the
column generation. Their sub-instances only get the periodic packings of
the original instance if they are already computed, so the subproblems
computed them again. On alma_02, the first solution was found after 29 s.

These algorithms now request the periodic packings before solving
sub-instances. On alma_02, the first solution is found after 6 s,
including the computation of the periodic packings.
@fontanf
fontanf merged commit ae27095 into master Nov 19, 2026
8 checks passed
@fontanf
fontanf deleted the irregular-request-periodic-packings branch November 19, 2026 22:55
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