Search code examples
optimizationlinear-programminggurobi

Getting "DUAL_INFEASIBLE" when solving a very simple linear programming problem


I am solving a simple LP problem using Gurobi with dual simplex and presolve. I get the model is unbounded but I couldn't see why such a model is unbounded. Can anyone help to tell me where goes wrong?

I attached the log and also the content in the .mps file.

Thanks very much in advance.

Kind regards,

Hongyu.

The output log and .mps file:

Link to the .mps file: https://studntnu-my.sharepoint.com/:u:/g/personal/hongyuzh_ntnu_no/EV5CBhH2VshForCL-EtPvBUBiFT8uZZkv-DrPtjSFi8PGA?e=VHktwf

Gurobi Optimizer version 9.5.2 build v9.5.2rc0 (mac64[arm])
Thread count: 8 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 1 rows, 579 columns and 575 nonzeros
Coefficient statistics:
  Matrix range     [3e-02, 5e+01]
  Objective range  [7e-01, 5e+01]
  Bounds range     [0e+00, 0e+00]
  RHS range        [7e+03, 7e+03]
Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0      handle free variables                          0s

Solved in 0 iterations and 0.00 seconds (0.00 work units)
Unbounded model

Solution

  • The easiest way to debug this is to put a bound on the objective, so the model is no longer unbounded. Then inspect the solution. This is a super easy trick that somehow few people know about.

    When we do this with a bound of 100000, we see:

     phi = 100000.0000
     gamma[11] = -1887.4290
    

    (the rest zero). Indeed we can make gamma[11] as negative as we want to obey R0. Note that gamma[11] is not in the objective.

    More advice: It is also useful to write out the LP file of the model and study that carefully. You probably would have caught the error and that would have prevented this post.