Reputation: 401
I am using gurobi solver to solve MIP. It's an NP-hard formulation with many constraints. It takes a significantly large amount of time to find an optimal solution; so, I had to add time constraints to the problem. I do not require to save the solution, and value of variables obtained by gurobi in the specified time only, but require to save the upper bound, and solution gap as well which get reported when we solve MIP. May you provide a way to do that?
Upvotes: 0
Views: 1407
Reputation: 401
I found a solution, Gurobi website has given all the attributes and these can be used in some other languages, specifically C, C++, C#, Java, and VBA in addition to python; fortunately, there is attribute MIPGap and ObjBoundC that meets my specification. model.Runtime
provides the time duration in which problem was solved; if model.Runtime
>= Time Constraint then model.MIPGap
provides MIPGap = abs(ObjVal - ObjBound)/ abs(ObjVal), and model.ObjBoundC
provides 'ObjBound' dubble.
Upvotes: 1