refactor(opam_solver): incremental at-most groups - #16304
Merged
Merged
Conversation
Signed-off-by: Arthur Wendling <arthur@tarides.com>
Alizter
approved these changes
Sep 2, 2026
Alizter
left a comment
Collaborator
There was a problem hiding this comment.
No behaviour changes from what I can tell.
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.
In preparation for the on-demand loading of opam packages by the
opam_solver, this refactoring introduces a small abstractionAt_most_groupto represent a (growing) set of SAT variables of which at mostnmay be true (e.g. for conflict classes withn=1or in the future for minimizingavoid-version).Currently we don't make use of the fact that those groups may grow as every constraint is preloaded ahead of time (so we only
sealthose groups once before the SAT solver starts, just like before). With on-demand parsing of opam files however, we'll have to handle the incremental discovery of additional elements bounded by these at-most-size groups.Growing a group incrementally is possible (e.g. from
[y;z]to[x;y;z]) because the new constraintat_most n [x;y;z]is strictly stronger than the previous oneat_most n [y;z](we could even get rid of the old clause, but currently this removal operation is not available nor critical for performances).It's possible to merge this PR before or after the incremental SAT clauses (#16303), although it's not that useful atm (it's just easier to review as an independent refactoring).