-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: implement quantum problem set filter #287
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ported remaining review comments from #278
p.to_qn_problem_set() | ||
for strength in sorted(problem_sets) | ||
for p in problem_sets[strength] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grayson-helmholz the instability of the test results was caused by the fact that the problem_sets
is a dict
(mapping of strength float
s to lists). This makes the test stable and also enables asserting the exact number of solutions.
all_particles: qrules.particle.ParticleCollection, | ||
quantum_number_problem_set: QNProblemSet, | ||
) -> None: | ||
solver = CSPSolver(all_particles) | ||
result = solver.find_solutions(quantum_number_problem_set) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured that all_particles
still contains all edge properties. These are still inserted into intermediate edges of the found solutions, which causes the large number of properties.
But even if you give the CSPSolver
a list of dict
s with only the required properties (like you did with the domain filter), you still end up with a large number of solutions because of the pid
s. You can visualize this by rendering the result with
src = qrules.io.asdot(solutions)
graphviz.Source(src).render("file", format="svg")
EdgeQuantumNumberTypes = Union[ | ||
type[EdgeQuantumNumbers.pid], | ||
type[EdgeQuantumNumbers.mass], | ||
type[EdgeQuantumNumbers.width], | ||
type[EdgeQuantumNumbers.spin_magnitude], | ||
type[EdgeQuantumNumbers.spin_projection], | ||
type[EdgeQuantumNumbers.charge], | ||
type[EdgeQuantumNumbers.isospin_magnitude], | ||
type[EdgeQuantumNumbers.isospin_projection], | ||
type[EdgeQuantumNumbers.strangeness], | ||
type[EdgeQuantumNumbers.charmness], | ||
type[EdgeQuantumNumbers.bottomness], | ||
type[EdgeQuantumNumbers.topness], | ||
type[EdgeQuantumNumbers.baryon_number], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's separate this to a different PR so that it can close #279 specifically.
git checkout -b merge-Settings-attributes origin/main
git cherry-pick 559b2f4
# resolve conflicts...
) | ||
result = solver.find_solutions(new_quantum_number_problem_set) | ||
|
||
assert len(result.solutions) != 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be pinned to a specific number
@@ -37,6 +37,7 @@ oryx-build-commands.txt | |||
prof/ | |||
tags | |||
TAGS | |||
*.swp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As
CSPSolver.find_solutions()
just takes a generalQNProblemSet
it should be possibleto reduce the set of constraints (i.e. conservation rules) the solver takes into account for
finding the solutions of a decay.
A possible way to implement this is to use the
StateTransitionManager
to generate thefull set of rules for a certain decay and just filter it to contain only the desired
constraints before passing it to
CSPSolver
.