Imprecision in Gurobi
Answeredgbm.addConstr(f <= t + (1 - d) *M - e, f 'B1')
gbm.addConstr(f>=t-d*M, f 'A1')
this create equation
B1: f + 1e+09 d
<= 1.0000000003888891e+09
A1: f + 1e+09 d >= 0.388889015
I have taken
B1: f + 1e+09 d
<= 1.0000000003888891e+09
A1: f + 1e+09 d >= 0.388889015
I have taken
M=1e9
e=1e-12
Do you have any suggestions on resolving this, or am I wrong somewhere?
f=0.3888890743255615
t=0.388889015
and gurobi is setting it to
d = 0.9999999999999999
Also I noticed that , the equation set to correctly for one variable i.e d=0 , and then for second variable , having same values , same equation , It is setting 0.9999999
d = 0.9999999999999999
Also I noticed that , the equation set to correctly for one variable i.e d=0 , and then for second variable , having same values , same equation , It is setting 0.9999999
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Namrita,
This is usual behavior for large values and finite precision. Short answer: you should try to reduce the value of your big-M. For the full answer, please have a look at
- Why does Gurobi sometimes return non-integral values for integer variables?
- Dealing with big-M constraints
- Gurobi tolerances and the limitations of double-precision arithmetic
Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments