Skip to main content

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

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • 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 = gp.read('<installdir>/examples/data/p0033.mps')
    model.optimize()

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

     

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

    model.reset()
    model = model.relax()
    model.optimize()

    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:

    model.reset()
    model.Params.PreSolve=0
    model.optimize()

    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
    model.reset()
    presolve_model = model.presolve()

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

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

    1

Post is closed for comments.