Skip to main content

Add constraints to LP minimisation problem and the objective decreases

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Meijun, 

    Question 2. Why is it that directly running `.lp` files gives me lower objective function values than running the model?

    The models solved via the command line are different from the models solved via the API. You might want to double-check that you are solving the same models.

    • The model solved via the API before adding constraints has 416,621 rows, 302,360 columns and 1,101,412 nonzeros with fingerprint 0x7a8b62a7.
    • The model solved via the command line before adding constraints has 416,983 rows, 299,798 columns, and 1,101,413 nonzeros with fingerprint 0x0354d83d.

    Question 1. What might be the reasons for lowering objective when adding constraints?

    Adding more constraints does not necessarily worsen the objective function. The objective value will change if the new constraints affect the feasible region in a way that excludes the current optimal solution. 

    The optimal objective values of the models without and with the new constraints are 664.347807 and 664.344779, respectively. The values differ at the third decimal digit. Given you have set the FeasibilityTol parameter to a high value of 1e-3, this is not unexpected. 

    Since the smallest coefficient value in your model is in the order of 1e-5, please leave the FeasibilityTol, OptimalityTol, and BarConvTol parameters at default values and solve the models again.

    Best regards,

    Maliheh

    0
  • Meijun Chen
    First Comment
    Gurobi-versary
    First Question

    Dear Maliheh,

    Thanks for your answer! Indeed, when I leave the 3 parameters at default values, the objective value matches with the lp file solution. It might be numerical issues before.

    I'm not sure why the model solved via API is not the identical model in the .lp file. It might be the to_lp() method has done something numerically... For now, it's not the greatest concern though!

    Best,

    Meijun

    0

Please sign in to leave a comment.