Skip to main content

MIP - Time limit - Extracting best feasible solution in given time limit

Answered

Comments

3 comments

  • Marika Karbstein
    • Gurobi Staff Gurobi Staff

    Hi Kalyana,

    If you are interested in good solutions, experimenting with the parameters NoRelHeurTime and Heuristics is a good idea. 

    The parameters MinRelNodes, PumpPasses, ZeroObjNodes could help if it is hard to find a first feasible solution. But if I understand correctly, it is no problem to find a first (probably trivial) solution. In this case, you should keep these parameters at their default values.

    Since the solution pool might have both feasible and non-feasible, how do we extract out best feasible solution from solution pool?

    I am not sure what you mean by this. Why do you think the solution pool contains infeasible solutions?
    The best solution (with the best objective value) found so far is always the first solution in the solution pool.
    If you are only interested in the best solution, you do not need to handle a solution pool. The best solution can be accessed via the model attribute ObjVal to get the objective value and via the variable attribute X to get the solution value for the variables. You can also write the best solution into a file using the parameter ResultFile.

    If you have a commercial Gurobi license, you can create a support request via our Help Center and share the MPS model file with us. We can then help to find the best parameter setting for this model.

    Best regards,
    Marika

    0
  • Kalyana Namburi
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Marika,

    Thanks a lot for the insights. This is great help !

    I was trying to figure out if further calculations are needed to "check" for feasibility on candidates from the solution pool. Can you please advise if Gurobi stores only feasible solutions as part of the solution pool. 

    Regards

    Kalyan

    0
  • Marika Karbstein
    • Gurobi Staff Gurobi Staff

    Hi Kalyana,

    Yes, the solutions in the solution pool are usually feasible.
    However, if the model has numerical issues, it could be that a solution violates some tolerances. In this case, you will find a warning in the Gurobi log file, for example

    Warning: max bound violation (1.6729e-06) exceeds tolerance
    Best objective 3.320495458346e+10, best bound 3.318538760989e+10, gap 0.0589%

    The solution quality can be checked for example in Python using Model.printQuality() 
    It is also possible to check the solution quality attributes MaxVio or BoundVio for the maximum constraint or bound violation, see Quality Attributes for additional attributes.

    The Python example poolsearch.py shows how the solutions in the solution pool can be accessed.
    This example is also available for the other APIs, see Gurobi Optimizer Example Tour.

    Best regards,
    Marika

     

    0

Please sign in to leave a comment.