Q: I am getting results back from my MIP model, which I don’t expect. Although I define a variable to be integer, the output file shows values that they aren’t (eg, 0.194, etc).
Please check the solution status. It must read something like:
**** SOLVER STATUS 1 NORMAL COMPLETION **** MODEL STATUS 8 INTEGER SOLUTION
**** MODEL STATUS 1 OPTIMAL
If the solver status is 4 (
TERMINATED BY SOLVER) check the number of iterations or the resource usage (old fashioned term for CPU time):
RESOURCE USAGE, LIMIT 0.054 1000.000 ITERATION COUNT, LIMIT 9 10000
If the solver hits one of these limits before finding an integer solution, you may get fractional values.
Sometimes (slightly) non integer levels for integer variables can also appear due to the default integrality tolerance of the MIP solver. All solver are using numerical methods of finite-precision arithmetic. Consequently, the feasibility and integrality of a solution depends on the value given to tolerances. This phenomenon is especially noticeable in models with numeric diffculties, for example, in models with Big M coefficients.
Below is an example, where the binary variable
xbin was used in a big-M formulation. After the optimization using GAMS/Cplex had finished successfully a display statement showed:
--- VAR xbin LOWER LEVEL UPPER MARGINAL xbin . 6.4273E-7 1.000 1600.000
6.4273E-7 is smaller than the integrality tolerance of 1e-5 used by default and thus GAMS/Cplex accepted this value as being integral.
If you are using a recent version of GAMS/Cplex), you can change the integrality tolerance. The GAMS/CPLEX option for this is
epint (default = 1e-5, range: [0, 0.5]. Tightening the integrality tolerance (e.g setting
epint 0) can increase the solve time for the model significantly.