Skip to content

Give functional_cover_search a deadline from the pipeline's time budget - #84

Merged
Autoplectic merged 1 commit into
mainfrom
functional-cover-deadline
Nov 28, 2026
Merged

Autoplectic merged 1 commit into
mainfrom
functional-cover-deadline

Conversation

@Autoplectic

@Autoplectic Autoplectic commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • functional_cover_search takes a deadline (a time.monotonic() value). Each MILP solve gets the time left as HiGHS's time_limit; a solve stopped there, or a deadline passed between covers, ends the search with exact False, the identity cover and a new stopped field set. lower then counts only the covers solved to optimality.
  • With a deadline the search is skipped above 20,000 product rectangles, since HiGHS checks its time limit only after a presolve whose cost grows faster than the column count.
  • The pipeline's functional stage passes 30% of the remaining budget, logs stopped, and offers no generator from a stopped search. Without a time budget nothing changes.

Why

In a spot-check on main, generative_model took 750 s on a 300 s budget on s3-n2-t0022-d2, a truncated 2-state ternary build with 132,103 product rectangles: the functional stage started before its deadline, and the exact cover's first solve alone took 535 s.

A time limit alone does not bound this. With a 5 s time_limit, the first solve stopped at 5.1 s on 10,000 of its rectangles, 9.3 s on 20,000, 25.7 s on 40,000 and 343 s on all 132,103. HiGHS's presolve found no reductions and reported "Time limit reached" only when it finished; with presolve off the solve ignored the limit and ran to optimality in 190 s.

Of the 825 processes in the generator archive, this is the only one with more than 20,000 product rectangles and fewer than product_rectangles' limit of 200,000 (median 6, next largest 12,297). In the round-18 bracket reruns (300 s and 900 s), the functional cover gave the pipeline's upper bound on three processes, with 28 to 126 product rectangles.

Results

generative_model_from_bidirectional(bidir, stages=("machines", "functional"), time_budget=60.0) on s3-n2-t0022-d2:

tree time functional stage upper bound
main 1,342 s (machine under load) exact, 0.9982953692630936 0.9982953692630936 (ε-machine)
this branch 32.3 s stopped: more than 20,000 product rectangles 0.9982953692630936 (ε-machine)

The full search on main finds no functional generator below the ε-machine, so the skip loses nothing here. These runs call the lower-level entry to force the stage; its lower bounds are computed on the truncation (as its docstring says), so only times and upper bounds are compared.

Tests

  • New: test_functional_cover_search_stops_at_its_deadline, test_functional_cover_search_time_limit_is_not_exhaustion (milp mocked to return status 1), test_functional_cover_search_skips_many_rectangles_only_on_a_deadline, and test_generative_model_gives_the_functional_stage_a_deadline (the pipeline end to end with the cap lowered).
  • test_generative_model, test_generative_model_invariants, test_generative_search_helpers, test_minimal_generative_model, test_generative_objectives and test_generator_caps: 96 passed, 4 slow deselected.
  • ruff check, ruff format --check clean; ty check shows the same 3 warnings as main.

Each solve gets the time left as HiGHS's time limit, and a solve stopped there or a deadline passed between covers ends the search with exact False and stopped set; the pipeline's functional stage passes 30% of the remaining budget and offers no generator from a stopped search. With a deadline the search is skipped above 20,000 product rectangles, since HiGHS checks its time limit only after a presolve whose cost grows faster than the column count.
@Autoplectic
Autoplectic merged commit 1548b23 into main Nov 28, 2026
10 checks passed
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