Repository navigation
Bound the UpgradeRoots pass in solver steps - #105
Merged
Merged
Conversation
Time bounds make pins depend on host load. A step budget gives the same pins for the same inputs on every run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Adds a step budget for the
UpgradeRootspass so its pins no longer depend on host load. NewOptions.UpgradeStepFactor(× the first solve's steps) andOptions.UpgradeMaxSteps(absolute) bound all re-solves together; zero keeps today's behaviour, so this is a minor release.How it works. A step is one call of the solver's
Interrupthook: one main-loop round or one conflict-resolution step. The resolver already setInterrupt; it now counts calls too. Each re-solve gets the steps the pass has left and is stopped when they run out; the pass then ends with the best answer so far. The time options still work and can be set alongside as a backstop, documented as non-repeatable.Determinism. The solver runs on one goroutine and calls
Interruptfrom its loop, so the count depends only on inputs. New tests run 12 random fixtures with a budget that cuts the pass partway, 20 runs each at GOMAXPROCS 1 and 8, with 4 busy goroutines and a fake clock that jumps randomly on every read: same pins and same per-solve step counts every run. Also passes under-race. A control test shows the same jumping clock does move a time-bounded pass.Charging. Tests pin exact step counts per re-solve: a budget one step short of the first two re-solves cuts the second (base answer); the exact budget keeps its gain and starts no third. Mutations checked: not charging, or giving each re-solve the full budget, fails 3 tests; a clock-dependent budget fails the determinism test.
Cost (Nov PyPI snapshot, UpgradeRoots=40, 3 runs per mode, idle laptop):
On an idle machine time per step is about the same for the base solve and the re-solves, so a step factor of about 2 matches
UpgradeTimeFactor2 without load. Pins were the same in all 3 runs in every mode here, because the machine was idle.🤖 Generated with Claude Code