Skip to main content

Find the variable values for different solutions by PoolSolutions

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Ahmad, 

    After setting the parameter SolutionNumber to the \(i\)-th best solution, the value of each variable can be accessed by querying the attribute Xn and not X (this attribute always reports the variable values in the current solution). In the last part of your code when checking whether a variable is assigned to value 1 or not, you need to check:

    if x[i, j].Xn > 0.5:

    I ran your code and I was able to see different values assigned to variables \(x\).

    Best regards,

    Maliheh

    1
  • ahmad alanaqreh
    Gurobi-versary
    Conversationalist
    Investigator

    Thank you so much Maliheh, now it is working in a proper way 

    0

Please sign in to leave a comment.