Skip to main content

Print all objective function value?

Answered

Comments

3 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • Tanmoy Das
    Gurobi-versary
    Investigator
    Collaborator

    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 XnObjNVal can help me. But, I cant find how to set the value of k (k dictates whether Xn = X1, X2,..., X36).

     

    0
  • Tanmoy Das
    Gurobi-versary
    Investigator
    Collaborator

    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.PoolObjVal
    0

Please sign in to leave a comment.