Frieda12
Frieda12

Reputation: 37

Influence of tolerances on the binary variable?

I am using OPL CPLEX 12.9. In my model, a dvar float + variable disregards the non-negativity condition and returns the value -4.4409e-16. I have already read that this is due to the tolerances in Cplex. This does not bother the actual process either. It will still be counted with the value 0. However, it seems to affect the binary variables. Because at the same time the binary variables in my model also disregard their constraints. The binary variables disregard their constraints is undesirable Is a connection possible and how can I avoid it?

Upvotes: 1

Views: 154

Answers (1)

Daniel Junglas
Daniel Junglas

Reputation: 5930

As stated in the comments to your question this is expected behavior for variables of all types (due to numerical roundoff).

In case you want to increase the chances that your integer/binary variables have exact integer values, you can set the CPX_PARAM_EPINT parameter ("integrality tolerance") to 0. In the OPL settings editor you do this via Mixed Integer Programming > Tolerances.

For binary variables you could also explicitly cast the results to integer values by using something like value < 0.5 ? 0 : 1.

Upvotes: 1

Related Questions