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

Improving global constraints #303

Merged
merged 15 commits into from
Jun 12, 2023
Merged

Improving global constraints #303

merged 15 commits into from
Jun 12, 2023

Conversation

Dimosts
Copy link
Collaborator

@Dimosts Dimosts commented May 16, 2023

Based on the discussion in #256, changed the global cardinality constraint (GlobalCardinalityCount()) to make it more general.

Specifically, in the previous version the user had to define the exact amount of times all values appear, and could not define it only for a subset of them.

The new GlobalCardinalityCount() of this PR is in align with http://sofdem.github.io/gccat/gccat/Cglobal_cardinality.html and also with what minizinc has https://www.minizinc.org/doc-2.5.5/en/lib-globals.html. In addition, the new version complies with hakan's description in http://www.hakank.org/bprolog/global_cardinality.pl

I also checked in all the examples, if we used anywhere the GlobalCardinalityCount constraint, in order to change to the new syntax, but did not find any case.

@Dimosts Dimosts marked this pull request as ready for review May 16, 2023 20:13
@IgnaceBleukx IgnaceBleukx changed the title Global cardinality more general Improving global constraints May 17, 2023
@IgnaceBleukx
Copy link
Collaborator

IgnaceBleukx commented May 17, 2023

I changed the pull request to be more general changes to global constraints and pushed some optimizations in decompositions as well.

@Dimosts Dimosts linked an issue May 22, 2023 that may be closed by this pull request
Copy link
Collaborator

@tias tias left a comment

Choose a reason for hiding this comment

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

GCC is fine and can be fast-tracked in a separate merge if needed.

The changes to the existing decompositions are not improvements imho

cpmpy/expressions/globalconstraints.py Show resolved Hide resolved
cpmpy/expressions/globalconstraints.py Show resolved Hide resolved
cpmpy/expressions/globalconstraints.py Outdated Show resolved Hide resolved
cpmpy/expressions/globalconstraints.py Outdated Show resolved Hide resolved
@IgnaceBleukx
Copy link
Collaborator

As no comments remain here, I assume it can be merged as is?

@Wout4 Wout4 merged commit fd2b287 into master Jun 12, 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

Successfully merging this pull request may close these issues.

Global cardinality constraint is not general
4 participants