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

Rewrite decompose_globals to work at tree level #293

Closed
IgnaceBleukx opened this issue May 12, 2023 · 2 comments
Closed

Rewrite decompose_globals to work at tree level #293

IgnaceBleukx opened this issue May 12, 2023 · 2 comments

Comments

@IgnaceBleukx
Copy link
Collaborator

We should rewrite the decompose_globals transformation to work with non-flattened constraints.
This way, less auxiliary variables are introduced.

Some special edge cases to take care of in this transformation:

  • Nesting of global numerical constraints:
    For example: AllDiff(max(x,y,z), p,q) when AllDiff is supported but not max should become [AllDiff(aux,pq), max(x,y,z).decompose_comparison('==',aux)]
  • Global constraints in negative context: make sure to use decompose_negation
  • Partial global constraints: see discussion in Incomplete functions on rhs of implication #184

In essence, this function should walk trough the expression tree and decompose any unsupported global constraint/function BEFORE flattening. This allows downstream transformations to completely ignore global constraints and allows solvers such as z3 which directly work on the expression tree level to not worry about special global constraint cases.

@Wout4
Copy link
Collaborator

Wout4 commented May 14, 2023

The advantage of flattening first however, is that there is no need for the whole decompose_negation thing
Do you have an example or insight of why this leads to more auxiliary variables?

@IgnaceBleukx
Copy link
Collaborator Author

We have to implement the logic for any object-oriented solver (such as Z3) anyway. So I think it would be best to just make it a transformation and let all solvers benefit from the effort.

@Wout4 Wout4 closed this as completed Jun 30, 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

When branches are created from issues, their pull requests are automatically linked.

2 participants