Skip to content

Drive CSP variable creation from declared facts #339

Description

@redeboer

Make CSP variable creation driven by the quantum numbers declared in the QNProblemSet (facts keys for outer edges, qn_domains for intermediate edges), rather than by the union of all registered rules' required quantum numbers intersected with the settings domains.

Today the variables come from rule requirements (src/qrules/solving.py:605-797, src/qrules/argument_handling.py:301-336), and rules only decide executability afterwards. As a result, omitting spin_projection from the facts still spawns spin-projection variables on the intermediate edges. Also fix the wart whereby Optional rule-input fields are counted as required in get_required_qns (src/qrules/argument_handling.py:320-329) yet excluded by the executability check, so "optional" quantum numbers still create variables.

Promote the semantics of filter_quantum_number_problem_set (src/qrules/solving.py:104-181) from a post-hoc filter to the way problem sets are defined. Behavior change: rules that cannot execute against the declared facts are reported through the existing not-executed-rules mechanism.

Metadata

Metadata

Assignees

Labels

⚙️ EnhancementImprovements and optimizations of existing features❗ BehaviorChanges that may affect the framework output

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions