How to get bounds in solfile
AnsweredHi, I am using SolFile to output intermediate solutions found in an optimization process, but the solution files do not have bounds in them. Is there any way I can get the bounds?
Thanks.
-
Official comment
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. -
There is no option to automatically write variable bounds to solution files. You would have to write an additional file after the optimization is finished which writes all variable bounds.
file = open("bounds.txt",'w')
for v in model.getVars():
file.write("%s %f %f\n"%(v.VarName,v.lb,v.ub))
file.close()Best regards,
Jaromił0 -
Thanks for the reply. Sorry, I was not being clear, is there a way to find objective bounds when getting intermediate solutions? It seems like ObjBound can only be accessed after the optimization, is that true?
0 -
By ObjBound, do you mean the dual bound or the objective value at the given solution point? The objective value is reported at the top of SolFiles. The ObjBound is not reported, because it is independent of a given solution point.
Best regards,
Jaromił0
Post is closed for comments.
Comments
4 comments