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

Canonical comparison does not handle reification of comparisons #420

Closed
Wout4 opened this issue Oct 5, 2023 · 4 comments
Closed

Canonical comparison does not handle reification of comparisons #420

Wout4 opened this issue Oct 5, 2023 · 4 comments
Assignees

Comments

@Wout4
Copy link
Collaborator

Wout4 commented Oct 5, 2023

Flatten_constraint() allows nested output in the case of a reified comparison i.e (IV1 == IV2) == BV

This case is not handled by canonical comparison. Althought the example above does not give an error when using choco, the following does:

iv = intvar(-8,8, shape=5)
bv = boolvar(shape=3)
cons = [(((4 + iv[0]) == iv[1]) == bv[0])]
Model(cons).solve('choco')
@Dimosts
Copy link
Collaborator

Dimosts commented Oct 6, 2023

Indeed. Opened a PR handling that

@IgnaceBleukx
Copy link
Collaborator

I think we were a bit fast in merging the pull request.
You would also want single-reified comparisons to be canonicalized:

a -> 4 + x >= y should also become a -> -1 * x + 1 * y <= 4

@Dimosts
Copy link
Collaborator

Dimosts commented Oct 6, 2023

hmm, indeed. So we need to cover both rhs and lhs, or move canonical comparison after reify_rewrite. But as the plan is to move it before/in flatten at some point, we should just cover both cases.

@Dimosts
Copy link
Collaborator

Dimosts commented Oct 16, 2023

This was solved with 2 PRs already merged

@Dimosts Dimosts closed this as completed Oct 16, 2023
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

No branches or pull requests

3 participants