How to get the barrier convergence in the callback
ユーザーの入力を待っています。I am trying to calculate the barrier convergence in the callback. However, when I calculate the barrier convergence:
model.cbGet(gp.GRB.Callback.BARRIER_PRIMOBJ) / model.cbGet(gp.GRB.Callback.BARRIER_DUALOBJ) - 1
It is different from the barrier convergence calculated by Gurobi, since the optimization stops at a different moment than when my calculated convergence drops below the specified barrier convergence tolerance. What is the proper way to calculate the barrier convergence?
-
正式なコメント
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Ruben,
The parameter BarConvTol is related to the complementarity (second last column in the barrier output). The computation of this complementarity measure is quite elaborate and cannot be easily reproduced in the callback.
Additionally, barrier terminates not only based on the BarConvTol value, there is a complicated ruleset involving several different measures and cases.
Is there some specific reason why you want to compute some convergence value?
Best regards,
Mario0 -
Hi Mario,
Thank you for your response!
I have quite a large model (10^7-10^8 variables), but I'm not interested in the absolute global minimum. I'm fine with an objective that's within a few percent of the global minimum. Therefore, I disabled the crossover in the barrier optimization. Unfortunately, the barrier optimization stops quite randomly, depending on the input variables it sometimes finds a 'feasible solution' in minutes, and sometimes it takes hours. The solution that takes shorter is sometimes very far off from the global minimum. I'm therefore interested to see how the convergence value changes during the optimization, so I can find a BarConvTol that gives me both a reasonable optimization duration, but won't stop too early (and return an objective that is >2x the global minimum).
If you have other ideas about finding a 'good enough' solution for such large models, please let me know! I can't find many resources online about it.
Kind regards,Ruben
0 -
Hi Ruben,
Just to be sure, your model is a pure LP without integer variables?
As I mentioned before, the barrier termination criteria are quite complex and do not only consider the BarConvTol parameter value. The main idea is that the barrier is just the first stage while crossover should then clean up the solution. So you might play with different values for parameter "Crossover" to see if it finishes faster.
Further important parameters that have an influence on the barrier and thus also on the final solution quality are "BarHomogeneous" and "BarOrder".
Additionally, different presolving strategies ("Presolve") and scaling techniques ("ObjScale", "ScaleFlag") might help if the coefficient ranges are very large.
Best regards,
Mario0
投稿コメントは受け付けていません。
コメント
4件のコメント