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] RealVar operations with LB<0 and UB>0 leads to SolverException #692

Closed
fhpg opened this issue Jul 7, 2020 · 3 comments
Closed

[BUG] RealVar operations with LB<0 and UB>0 leads to SolverException #692

fhpg opened this issue Jul 7, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@fhpg
Copy link

fhpg commented Jul 7, 2020

Hello,

at first, thank you for this great software!

Maybe I have found an issue having the following code:

Model model = new Model();
RealVar a = model.realVar("A", -10, 10, 1e-8);
RealVar b = model.realVar("B", -10, 10, 1e-8);
a.div(b).realVar(1e-8);

Executing this leads to a SolverException:

Exception in thread "main" org.chocosolver.solver.exception.SolverException: RV_1: wrong domain definition, lower bound > upper bound at org.chocosolver.solver.variables.IVariableFactory.checkRealDomainRange(IVariableFactory.java:854) at org.chocosolver.solver.variables.IVariableFactory.realVar(IVariableFactory.java:642) at org.chocosolver.solver.variables.IVariableFactory.realVar(IVariableFactory.java:630) at org.chocosolver.solver.expression.continuous.arithmetic.BiCArExpression.realVar(BiCArExpression.java:105) at solver.SolverTester.main(SolverTester.java:18)

Actually my real world problem code uses ibex and a far more complex formula but I reduced the problem to these simple lines of code. Is this a BUG or am I missing something?

  • Choco-solver version: 4.10.3
  • Java version: OpenJDK Runtime Environment (build 11.0.7+10-post-Debian-3deb10u1)

Best regards,
Florian

@cprudhom
Copy link
Member

cprudhom commented Jul 7, 2020

Hmmm. you're right, there is something wrong in RealUtils.odiv(x,y).
I'll fix that asap.

Thank you for the bug reporting.
Meanwhile, you can replace the call to .ibex() by a call to .equation() that may fix the issue.

@cprudhom cprudhom self-assigned this Jul 7, 2020
@cprudhom cprudhom added the bug label Jul 7, 2020
@cprudhom cprudhom added this to the 4.10.4 milestone Jul 7, 2020
@fhpg
Copy link
Author

fhpg commented Jul 7, 2020

Thank you for your reply. I had an eye on RealUtils.odiv() but I had no clue how to fix that correctly.
BTW: I am using pow() which is obviously only supported with Ibex. So I will wait for you to fix this and keep watching the upstream.

@cprudhom
Copy link
Member

cprudhom commented Jul 8, 2020

RealUtils.odiv() returns an interval that represents the result of a division of 'x' by 'y'.
I think that since the 2 intervals include the value 0, the return domain can't be anything else but (-infinity,+infinity).

cprudhom added a commit that referenced this issue Jul 8, 2020
@cprudhom cprudhom closed this as completed Jul 8, 2020
cprudhom added a commit that referenced this issue Jul 8, 2020
cprudhom added a commit that referenced this issue Jul 8, 2020
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