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

Regular Constraint - Pentomino Benchmark #17

Open
MaxOstrowski opened this issue Sep 21, 2020 · 6 comments
Open

Regular Constraint - Pentomino Benchmark #17

MaxOstrowski opened this issue Sep 21, 2020 · 6 comments
Assignees

Comments

@MaxOstrowski
Copy link
Member

MaxOstrowski commented Sep 21, 2020

pentominos/05 seems just to post static regular constraints. No
variables involved ? (board isnt static)
Is this true ? Why do I use propagation... whats wrong there ...
Maybe not all values of board are set ?

@MaxOstrowski MaxOstrowski self-assigned this Sep 21, 2020
@MaxOstrowski
Copy link
Member Author

regular translates into quite some array_int_element constraints, which are again translated. Maybe look at this translation first!
Otherwise the a array could directly be created as boolean values, as numbers do not make much sense here.

@MaxOstrowski
Copy link
Member Author

MaxOstrowski commented Sep 23, 2020

In the general case array_int_element (and as=array of integers) as[b]=c is translated to
as[1]*(b==1) + as[2]*(b==2) + ... + as[n]*(b==n) = c.
This introduces direct encoding variables for b, and equivalent {0,1} integer variables for them to be put into the constraint above.
A lot of equal variables are introduced, do not know how much overhead this makes.

@MaxOstrowski
Copy link
Member Author

MaxOstrowski commented Sep 23, 2020

The array_var_int_element (and as=array of integer variables) as[b]=c constraint instead produces constraints of the form

b==1 -> c=as[1]
b==2 -> c=as[2]
...
b==n -> c=as[n]

This is more intuitive.
It does not introduce the equivalence {0,1} variables but much more smaller constraints.
I do not know which version has better propagation strength.

@MaxOstrowski
Copy link
Member Author

A propagator for
&array_element(b){a(X),X : dom(X)} = c
could help reduce grounding a lot.

@MaxOstrowski
Copy link
Member Author

In the case of array_int_element
as[1]*(b<=1) + as[2]*(b<=2) + ... + as[n]*(b<=n) = c
could be used if the array is ordered increasingly. (values in as would need to be adapted)

@MaxOstrowski
Copy link
Member Author

MaxOstrowski commented Mar 3, 2021

For array_int_element a PB constraint could be used instead of a clingcon constraint, if c is a constant.
as[1]*(b==1) + as[2]*(b==2) + ... + as[n]*(b==n) = c
This saves a bit of grounding (equal variables) and could be a bit faster.

The same is true for the translation for cumulative.

Edit: Created a PB constraint for this to save a lille grounding and conversion from bool2int.

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

1 participant