Originally posted by: JorisK
Dear,
Currently I'm building a complex column generation model using Java and cplex. Unfortunately, often my application crashes with weird bugs I cannot explain. After many hours of testing and debugging, I've got the feeling that the issues are related to rounding errors. In Java, I have to use doubles to represent my values due to some arithmetics involved. Java's double has at least 12 decimals precision.
I have added an LP as an attachment to this topic. The solution is very easy: z0=1, all other variables equal 0. From the objective it is clear that its value must be 30.2382993503219. When I read this LP in the interactive solver, I get the following dual values:
CPLEX> display solution dual -
Constraint Name Dual Price
StudConstr8 10.895337
StudConstr12 15.864056
StudConstr19 0.300000
StudConstr37 3.179396
All other dual prices in the range 1-167 are 0.
When I sum all the dual values I obtain: 30.238789. From duality theory we know that the optimal dual value of an LP equals the optimal value of the primal. However, in this particular example, the dual objective is 0.00049 higher then the primal objective, which I think is quite a lot! I don't need a 50 decimal precision, but the precision needs to be large enough to distinguish between rounding errors and calculation errors. If I would have for example a solution like 0.1000000000004, anyone would agree that the 4 at the end is likely due to a rounding issue, but 0.1004 isn't exactly a rounding error anymore?
1. Why is the precision of cplex (version 12.4) so bad?
2. Can I somehow improve its precision? I noticed that there are several parameters I can tune but I haven't found the right one?
3. What are the consequences of increasing the precision? Slower solving?
4. Imagine that I had many more variables and fractional scalars. In such a case, the rounding error can become arbitrarily high right? How can I measure the expected rounding error such that I can distinguish rounding errors from mathematical errors?
5. I could round each scalar, but rounding intermediate values obtained from calculations is a very bad (and dangerous) habit.
Currently, whenever I have to check in my code whether a variable 'var' equals for example 1.0, I do it like this: if(|1.0-var|<= epsilon) ...., where epsilon is a very small value e.g. 0.0000000001
#CPLEXOptimizers#DecisionOptimization