Access starting solution variables
AnsweredHi all,
I'm using gurobipy and am setting starting values for some variables by using the .Start attribute. The initial solution is then correctly loaded.
After the optimization is done, how can I retrieve the values for all the variables related to the starting solution?
Maybe with a callback?
Or maybe it's possible to access all the solutions found? (it seems that the starting solution appears within the 'Solution count' list)
Thanks!
0
-
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 why not try our AI Gurobot?. -
Try something like the following:
m.optimize()
for v in m.getVars():
if v.Start != GRB.UNDEFINED:
print('%s start %f, optimized %f' % (v.VarName, v.Start, v.X))0
Post is closed for comments.
Comments
2 comments