Search code examples
optimizationlinear-programminggurobi

Interpret the LP optimization result from Gurobi


I want to use Gurobi to solve for a very simple LP:

minimize z

s.t. x + y <= z

where x, y, z are decision variables generated by gp.Model().addVar() which should be the default variable. The objective of the model is set to be m.setObjective(1.0*z, GRB.MINIMIZE).

Then I solved the model, and the program returns the optimal value for z is 0.000. I don't understand why this is the optimal value? Is there any constraint on the default decision variables of Gurobi, like they are non-positive. Otherwise, why 0.0 is the optimal value for this LP when x, y, and z are unbounded?


Solution

  • The convention for Gurobi and other LP/MIP solvers are that decision variables have a lower bound of zero. If you want another lower bound, then either set the LB attribute, or define it when you call Model.addVar(), ex:

    m = Model()
    x = m.addVar(lb=-20, name='x')