BEHAVIOR: derive CSP variables from problem set - #380
Open
grayson-helmholz wants to merge 1 commit into
Open
grayson-helmholz wants to merge 1 commit into
grayson-helmholz wants to merge 1 commit into
Conversation
redeboer
added this pull request to stack #386
September 15, 2026 14:29
redeboer
self-requested a review
September 15, 2026 14:40
This branch has not been deployed
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.
❗ Behavioral changes
CSPSolvernow creates all its variables up front from what theQNProblemSetdeclares, instead of creating them while walking the rules of each node and edge. A graph element without initial facts contributes one variable per declared quantum number domain; an element with initial facts contributes fixed values. Rules then only select among the variables that already exist, so the set of variables no longer depends on which rules happen to be inspected first.listortupleof values instead of a single value. Such a range becomes a solver variable with the range as its domain, which is what allows several spin-projection cases to be solved inside one constraint problem.complete_intermediate_states()merges the initial facts into a completed solution without overwriting the solved values, since a fact carrying a value range only covers the case that the solution actually selected.✨ New features
merge_qn_problem_sets()inqrules.solvinggroups problem sets that differ only in the given quantum numbers (by defaultspin_projection) and merges each group into a singleQNProblemSetcarrying value ranges. A group is merged only when its values form a full Cartesian product over the edges, so no combination is added or lost.create_qn_problem_sets()takes an optionalmerge_spin_projectionsargument that applies this merging to the problem sets it returns, which cuts the number of problem sets and the solving time for reactions with many spin-projection combinations.⚙️ Enhancements
create_graph_settings()drops the quantum number domains that no conservation rule of the surrounding graph elements can consume. An edge domain survives if an edge rule of that edge, or a node rule of an adjacent node, requires the quantum number. Since the solver creates a variable per declared domain, this keeps the constraint problem from carrying variables that nothing constrains.Squash commit messages