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

Improve translation to clauses #30

Open
rkaminsk opened this issue May 5, 2020 · 1 comment
Open

Improve translation to clauses #30

rkaminsk opened this issue May 5, 2020 · 1 comment
Assignees

Comments

@rkaminsk
Copy link
Member

rkaminsk commented May 5, 2020

The current translation for sum constraints only makes sense with two variables. With more variables, auxiliary variables for intermediate results should be introduced.

I believe clingcon 3 had a similar translation.

Consider the constraint x+y+z <= 1 where all variables have domain [0,1]. The term x+y can take value 1 if x=0 and y=1 or x=1 and y=0. We get the clauses:

  • x<=0 & y<=1 => z<=0, and
  • x<=1 & y<=0 => z<=0.

We can avoid this by introducing an auxiliary variable for the prefix. It is probably best to detect such prefixes and introduce the required Boolean variables during the translation to clauses. It could also be done introducing auxiliary integer variables but this has the disadvantage that we would have to be very careful to stay within the bounds of the minimum/maximum integer.

@MaxOstrowski
Copy link
Member

In old clingcon integer variables are introduced (constraints can be split into smaller ones). But for longer constraints a propagator is still more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants