Skip to main content

Solution count

Answered

Comments

4 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    While searching for an optimal solution, Gurobi often finds other (suboptimal) solutions along the way. These could be obtained via branching or heuristics. In your case, Gurobi found not only the optimal solution, but also eight other feasible solutions.

    After optimizing, you can retrieve multiple solutions by setting the SolutionNumber parameter, then querying the variable Xn attributes and the model PoolObjVal attribute. For a programmatic example of how to do this, see the \( \texttt{poolsearch} \) example here.

    2
  • Eli Towle
    Gurobi Staff Gurobi Staff

    These are the only nine feasible solutions that Gurobi found. The final solution found by Gurobi is an optimal solution (subject to your optimality tolerance of 0.5%), but there are no guarantees on the quality of the other solutions. Additionally, there could be many more feasible solutions that Gurobi did not find.

    Note that you can change Gurobi's approach to finding multiple solutions. For example, if you set the PoolSearchMode parameter to 2 and the PoolSolutions parameter to 10, Gurobi will search for the best 10 solutions to the problem.

    2
  • 永宁 赵
    Gurobi-versary
    First Comment
    First Question

    Hi Eli,

    Many thanks for your answer.

    Are the 9 solutions the only feasible solutions the solver could find, or are they the best 9 feasible solutions selected among others?

    0
  • 永宁 赵
    Gurobi-versary
    First Comment
    First Question

    Thanks, Eli. That helps a lot.

    0

Please sign in to leave a comment.