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

Support for lexicographic constraints #126

Open
algebravic opened this issue Apr 27, 2023 · 3 comments
Open

Support for lexicographic constraints #126

algebravic opened this issue Apr 27, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@algebravic
Copy link

It would be nice if you had support for lexicographic comparison between two lists of literals, somewhat analogous to the support that you have for cardinality constraints.

@alexeyignatiev
Copy link
Collaborator

@algebravic, could you please explain what kind of constraint you need here?

@algebravic
Copy link
Author

algebravic commented Apr 28, 2023

If a and b are two lists (for now of equal length) of boolean variables, and a <=lex b if and only if the following:
either a[0] < b[0] or ((a[0] == b[0]) and a[1:] <= lex b[1:]. Here's a survey of possible implementations: https://digitalcommons.iwu.edu/cgi/viewcontent.cgi?article=1022&context=cs_honproj

This has even more details: https://www.cs.york.ac.uk/aig/constraints/SMT/ElgabouThesis.pdf

They are used all the time in symmetry breaking: https://eprints.soton.ac.uk/263661/1/jpms-sat07.pdf

@alexeyignatiev
Copy link
Collaborator

OK, I see what you mean now. It would be indeed nice to have a separate module providing CNF encodings for a list of typical constraints, including this one and some others, e.g. alldifferent.

@alexeyignatiev alexeyignatiev added the enhancement New feature or request label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants