[AMPL 24827] Unexpected and weir result

Hi AMPLteam,

I am working on a MILP model about aggregate planning. The problem is that at the end I defined two auxiliary variables to save the values of cost (f1) and staff layoffs (f2) and my objective function is a simple subtraction: z: f1 -f2; and the results are very weir:

z = 2129100
f1 = 2129150
f2 = 45

As is evident, z is not the subtraction of f1 and f2, there are 5 units that are missing. What’s going on here? Thank you for being so helpful.

I am using Cplex with cplex_options ‘mipgap 0’; the complete model (mod, dat and run files) is available at: https://pastebin.com/u3GMF2aw


You must be using AMPL’s “display” command to view these values. By default, it shows numbers to 6 significant digits. Thus,

ampl: display 2129150 - 45;
2129150 - 45 = 2129100

To get a more precise display, set option display_precision to a higher value:

ampl: option display_precision 8;
ampl: display 2129150 - 45;
2129150 - 45 = 2129105

Hi AMPL team, thank you, that was the problem.