Skip to content

feat: symmetry breaking (to be evaluated)#10

Merged
alexandrutomescu merged 4 commits intoalgbio:mainfrom
jeeeesper:symmetry-breaking
Mar 6, 2026
Merged

feat: symmetry breaking (to be evaluated)#10
alexandrutomescu merged 4 commits intoalgbio:mainfrom
jeeeesper:symmetry-breaking

Conversation

@jeeeesper
Copy link
Contributor

This adds symmetry breaking among all paths that are not fixed already, in the hope to significantly reduce the number of branches that need to be explored when solving.

Marked as draft as this still needs evaluation and proof of correctness. So far, it is only anecdotally tested. For small k, it slows down computation (because the number of solver variables is bigger), however for mid-single-digit-k-s is starts to show value, but only on some test instances. So far, only tested with k-Min-Path-Error models. The solver size is also significantly increased by all the new variables. I think we can get rid at least of the "diff" variables by substituting.

Comment on lines +691 to +699
# safe_lists may contain many more entries than k; cap it so the range below is never empty
# when there are genuinely free paths to order.
if hasattr(self, "paths_to_fix") and self.paths_to_fix is not None:
n_fixed = len(self.paths_to_fix)
else:
# quite likely, this is higher than k, so then this method has no effect.
n_fixed = len(self.safe_lists)

free_pair_indices = list(range(n_fixed + 1, self.k))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One concern I have is that, in its current form, this will be pretty useless because the paths_to_fix variable is not set before this method runs. I don't have a super good overview of the different execution paths from subclasses. Is paths_to_fix even the correct variable to look at here? Or do we need to make this a method that subclasses have to call separately, after adding all the other variables?

I also realize that the in-code comment is a bit outdated, so ignore it -- the check for empty index list / no paths to order comes right after this now.

Basically, @alexandrutomescu can you review these few lines please :D

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, paths_to_fix is the variable to look at. Now issue addressed and merged into main. This uncovered a previous bug where the safety optimizations were now applied at all in DAGs, probably due to an earlier incorrect refactoring.

@alexandrutomescu alexandrutomescu merged commit 62f7912 into algbio:main Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants