Skip to main content

Root relaxation objective value is different from the objective value from continuous model



1 comment

  • Alison Cozad
    Gurobi Staff Gurobi Staff

    It sounds like you are relaxing your problem correctly. However, the root relaxation in Gurobi is more sophisticated than relaxing the integrality of a MIP. You can access this information by saving the presolved model or turn it off by turning off presolve.

    For those just reading this article, you can follow along using the p0033.mps example model that comes packaged with Gurobi.

    First, solve the original model:

    model ='<installdir>/examples/data/p0033.mps')

    The root relaxation for the original model is 2,839.


    Next, you can solve the relaxed MIP using the model.relax() method:

    model = model.relax()

    The optimal solution of the relaxed MIP is 2,521. You can see that the root relaxation provides a tighter solution than the relaxed MIP.


    To explore this difference further, it's interesting to do the following two solves:

    First, turn off the presolve routine and solve as follows:


    Solving without presolve will give you a root relaxation of 2,521. You can see that this matches the relaxed MIP solution.


    Next, you can solve the relaxed presolve model:

    # Store the presolve model
    presolve_model = model.presolve()

    # Relax integrality, then solve
    presolve_model = presolve_model.relax()

    The final solve gives an optimal objective of 2,839. This matches our root relaxation from the original model.


Please sign in to leave a comment.