How to return the solution for each iteration when using barrier method? (C++)
回答済みI'm using barrier method to solve a continuous linear programming in C++ environment. Now I want to know how the solutions of each iteration change and draw them as figures. I see getsolution() in class GRBCallback, but it is only available when and where member variable is equal to GRB_CB_MIPSOL or GRB_CB_MULTIOBJ. So how can I get the solution for each iteration when using barrier method?
-
正式なコメント
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?. -
Hi,
There is no direct way to access the solution of each Barrier iteration. However, you can get each solution point by a small workaround.
You can set the Method parameter to 2 to enforce the Barrier algorithm and set the Crossover parameter to 0 to turn off crossover. Then you can set the BarIterLimit parameter to a value \(n\) which will be the last iteration of the Barrier algorithm.
With these settings you can optimize your model, which will run only up to iteration \(n\) and then get the current iteration solution via
model.getVars()
and get the current iteration solution value via
m.objVal()
To get all solutions, you will have to re-iterate the above for different \(n\).
Best regards,
Jaromił1
投稿コメントは受け付けていません。
コメント
2件のコメント