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

395 xor decomposition is very inefficient #425

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

Wout4
Copy link
Collaborator

@Wout4 Wout4 commented Oct 13, 2023

Came up with this one, it avoids nested conjunctions/disjunctions, in favour of nested sums.

Seems to lead to a smaller amount of constraints after flattening.

@Wout4 Wout4 linked an issue Oct 13, 2023 that may be closed by this pull request
# there are multiple decompositions possible, Recursively using sum allows it to be efficient for all solvers.
decomp = [sum(self.args[:2]) == 1]
if len(self.args) > 2:
decomp = Xor([decomp,self.args[2:]]).decompose()[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, you made it recursive, nice one. It's indeed clear that it will create far less constraints

@Wout4 Wout4 merged commit b2e7388 into master Oct 17, 2023
1 check passed
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.

Xor decomposition is very inefficient
2 participants