Decimal display

Hello community,

I have an issue displaying the results, and I hope you can help me. I have a MILP model with two binary variables (y, w) and one continuous variable (x). Despite using the command:

option cplex_options ‘integrality=0 mipgap=0 absmipgap=0’;

CPLEX solves the model, but when I use:

display x, y, w;

I get values with decimals. For example, y[3,3] is 4.44089e-16. I know this value is almost zero, but I would like to understand two things:

  1. Why do decimal values appear even though the “integrality” option is set to 0?
  2. How can I fix this issue so that the results display the correct integer values?

All files are available at: https://pastebin.com/d4N2MCJs

Thanks in advance!

IBM’s documentation of the CPLEX integrality tolerance states:

Specifies the amount by which an integer variable can be different from an integer and still be considered feasible.

A value of zero is permitted, and the optimizer will attempt to meet this tolerance.

However, in some models, computer round-off may still result in small, nonzero deviations from integrality.

There is no further explanation as to why small devations like 4.44089e-16 occur in this situation, but here are two AMPL options that you can use to suppress these values when using the display statement:

  • solution_round causes all values returned by the solver to be rounded at a specified number of digits past the decimal point. Thus, for example, option solution_round 10; will cause any solution value less than 5e-11 to be changed to zero.

  • display_round causes all values shown by the display statement to be rounded at a specified number of digits past the decimal point. Thus option display_round 10; will cause any displayed value less than 5e-11 to be shown as zero.

I would try solution_round first, since it does not affect the display command’s formatting of fractional values.