Skip to main content

Print all objective function value?

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Jaromił Najman
    • 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 Xn, ObjNVal 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

Post is closed for comments.