Print all objective function value?
AnsweredHello,
model.objval prints only the optimal objective value. But, I need values of objective function for both optimal (and nonoptimal) solutions.

Hi Tanmoy,
Please refer to the documentation of the Solution Pool and the poolsearch example. Additionally you might want to have a look at the Knowledge Base article How do I find additional solution to a model?
Best regards,
Jaromił1 
Hello Jaromil,
By allowing larger gap (GRB.Param.PoolGap), I retrieved 36 solution counts based on documentation link you provided:
Solution count 36: 1.6 1.4 1.3 ... 0.2
Now I want to print each X & ObjVal for all these 36 solutions. I believe Xn, ObjNVal can help me. But, I cant find how to set the value of k (k dictates whether Xn = X1, X2,..., X36).
0 
The solution to my previous comment is below (for future reference):
print('Print Xn')
k = 34
model2.setParam(GRB.Param.SolutionNumber, k)
[x[s, r].Xn for s in Stations for r in ResourcesD]
[y[s, o, r].Xn for s in Stations for o in OilSpills for r in ResourcesD]
model.PoolObjVal0
Please sign in to leave a comment.
Comments
3 comments