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

[BUG] Incomplete bounding of expressions with products or powers #980

Open
arnaud-m opened this issue Nov 29, 2022 · 1 comment
Open

[BUG] Incomplete bounding of expressions with products or powers #980

arnaud-m opened this issue Nov 29, 2022 · 1 comment
Assignees
Labels
Milestone

Comments

@arnaud-m
Copy link
Contributor

Describe the bug

The computation of bounds of the auxiliary variable is not accurate for mul or pow expressions.
It raises an exception because it does not take into account the right member of the relation.

However, the constraint times does not meet the same issue.

To Reproduce

Define the model below.

Model m = new Model();
IntVar[] x = m.intVarArray("x", 3, 0, IntVar.MAX_INT_BOUND);        
model.times(x[0], x[1], x[2]).post(); // Valid and posted
x[0].mul(x[1]).eq(x[2]).post(); // Valid, but raise an exception

The issue is also encountered with pow expression.

x[0].pow(x[1]).eq(x[2]).post(); // Valid, but raise an exception

Expected behavior
No exception.

@cprudhom
Copy link
Member

I can sharp the bounds computed in VariableUtils to [IntVar.MIN_INT_BOUND, IntVar.MAX_INT_BOUND].
That will not fail anymore in the cases you depicted (well, the one with pow should be reduced, because there is no power constraint, it is turned into a table constraint).

BUT, the following example (from cryptator) will be problematic:

Model model = new Model("copper*neon=iron*silver");
IntVar copper = model.intVar("copper", 100000, 999999);
IntVar neon = model.intVar("neon", 1000, 9999);
IntVar iron = model.intVar("iron", 1000, 9999);
IntVar silver = model.intVar("silver", 100000, 999999);
copper.mul(neon).eq(iron.mul(silver)).post();

Indeed, the bounds of the intermediate variable for copper.mul(neon) will be [100000000L, 9998990001L] and an exception will be raised because the intermediate variable cannot be instantiated to an int value.

@cprudhom cprudhom modified the milestones: 4.10.11, 4.10.12 Feb 14, 2023
axkr added a commit to axkr/symja_android_library that referenced this issue Mar 1, 2023
- enabled choco-solver 4.10.10 for integer constraints
- update to v4.10.11 didn't worked, because Maven couldn't resolve
slf4j dependencies
- see https://github.com/chocoteam/choco-solver/releases/tag/v4.10.10
- see chocoteam/choco-solver#980
@cprudhom cprudhom modified the milestones: 4.10.12, 4.10.13 Mar 6, 2023
@cprudhom cprudhom modified the milestones: 4.10.13, 4.11.0 Jun 5, 2023
@cprudhom cprudhom modified the milestones: 4.10.14, 4.11.0 Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants