Skip to content
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

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

grayson-helmholz
Copy link
Contributor

As CSPSolver.find_solutions() just takes a general QNProblemSet it should be possible
to 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 the
full set of rules for a certain decay and just filter it to contain only the desired
constraints before passing it to CSPSolver.

@redeboer redeboer added the ✨ Feature New feature added to the package label Oct 4, 2024
@redeboer redeboer self-requested a review October 4, 2024 13:05
@redeboer redeboer changed the title Filter quantum numbers FEAT: implement quantum problem set filter Oct 4, 2024
Copy link
Member

@redeboer redeboer left a 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

Comment on lines +156 to +158
p.to_qn_problem_set()
for strength in sorted(problem_sets)
for p in problem_sets[strength]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#278 (comment)

@grayson-helmholz the instability of the test results was caused by the fact that the problem_sets is a dict (mapping of strength floats to lists). This makes the test stable and also enables asserting the exact number of solutions.

Comment on lines +33 to +37
all_particles: qrules.particle.ParticleCollection,
quantum_number_problem_set: QNProblemSet,
) -> None:
solver = CSPSolver(all_particles)
result = solver.find_solutions(quantum_number_problem_set)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#278 (comment)

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 dicts 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 pids. You can visualize this by rendering the result with

src = qrules.io.asdot(solutions)
graphviz.Source(src).render("file", format="svg")

Comment on lines +134 to +147
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],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#278 (comment)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#278 (comment)

This should be pinned to a specific number

@@ -37,6 +37,7 @@ oryx-build-commands.txt
prof/
tags
TAGS
*.swp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#278 (comment)

Ah and don't forget to revert or drop f190b2f

git revert f190b2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature New feature added to the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write example that finds J^PC numbers with CSPSolver directly
2 participants