Repository navigation
Keep time budgets on truncated and exploding builds - #87
Merged
Merged
Conversation
added 3 commits
December 1, 2026 20:53
With a time budget, generative_model's first bidirectional build stops at half the budget: the mixed-state enumeration, the ε-machine minimization and the bidirectional construction check a deadline and raise MixedStateDeadlineError, a MixedStateExplosionError, so a stopped build is classed as an explosion and the forward-only bracket gets the rest. The retry ladder no longer rebuilds a cap that has exploded. The persistent criteria, the candidate machines after the ε-machine, separating_optima's later starts, the exact stage's dit fallbacks and the lifted dit run stop at their deadlines; with a budget, simplex chains no lighter than the ε-machine are not lifted. A bracket still open after the searches gets a second future-window pass with the time left, resuming the first pass's branch and bound at the stronger window length.
On Windows before Python 3.13, time.monotonic() ticks every 15.6 ms, so a deadline of time.monotonic() can still equal the clock after the first start of separating_optima, which then begins a second one. The full matrix failed this way on windows-latest with 3.11 and 3.12.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
time_budget,generative_modelnow keeps to its budget on truncated and exploding bidirectional builds. Before, the build, the persistent criteria, the exact common information multistart and the dit fallbacks could each run far past it: n3-t059-d3 of the binary 3-state dataset ran 814 s of a 300 s budget, 573 s of them inseparating_optima.Changes
deadline(new keyword onbuild_mixed_state_presentation,MealyHMM.mixed_state_presentation,EpsilonMachine.from_hmm,infer_reverse_epsilon_machineandbuild_bidirectional_epsilon_machine) and raiseMixedStateDeadlineError, aMixedStateExplosionError. A stopped build is classed as an explosion withbudget_exhaustedset, and the forward-only bracket runs with the time left. The retry ladder skips caps at or below one that has already exploded (it used to build at 10,000 reverse states again) and forecasts from that build's time.cryptic_order,cryptic_order_from_graphandpower_automatontake adeadlineand raiseTimeoutErrorpast it; the block persistent crypticities stop between lengths. The pipeline gives them a tenth of the time left; past it the cryptic orders areNone.separating_optima. Checks its deadline before every start after the first, whether or not a start has succeeded, and inside the SLSQP objective (_DeadlineReachedError); the first start still runs to the end._forward_only_result, and after_bracket_searchon truncated builds (in the fifth of the budget the searches leave)._branch_and_boundnow returns its open leaves in pop order and can resume from them, sonnodes and thenmmore branch exactly asn + mnodes; the second pass resumes the first pass's stronger window length for ten times its boxes, so the bound only rises.minimal_wyner_modelon a 2-state ternary truncation with a 20 s budget ran over 30 minutes in dit's Wyner basin hopping.Differences from the plan
Measured
generative_modeltook 72 to 78 s; it now takes 60.0 s and returns [0.8827307, 1.0795992].Every run ends by 310 s, and no bound is worse than on #86. n3-t015-d3 certifies in both settings. Nine lower bounds rise, seven of them through the second window pass, which is why runs that ended early now take the whole budget. n3-t061-d4's default build stops at its 150 s deadline, and the forward-only bracket lowers its upper bound to the HMM search's generator. The #86 runs were made on a busier machine, so their times and first window passes are not strictly comparable.
Tests
slowtest that n3-t059-d3's default build ends within 10% of a 60 s budget.ruff check,ruff format --check,ty checkand the docs build with-Ware clean.