Skip to main content

Total number of feasible solutions in Python/Gurobi

Answered

Comments

5 comments

  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Hi Prasanna,
    Did you check this article How do I find additional solutions to a model?

    0
  • Yes Marika, I did. I know how to find N different solutions but my question is how would we know whats the maximum value of N ?

    0
  • Silke Horn
    Gurobi Staff Gurobi Staff

    Hi Prasanna,

    Counting the total number of feasible solutions is a very difficult problem and this number can easily get gigantic. Gurobi cannot do this since it is not an optimization problem.

    You may want to look into the open-source software polymake, which is the best tool for polyhedral geometry. polymake can answer such questions (if the polytope is not too big): the documentation section about lattice points should contain the methods/properties needed for this.

    1
  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    You could set the PoolSearchMode parameter s.t. the MIP search will continue after a feasible solution was found and set the PoolSolutions parameter to a very high value. In the end, you could check with the model attribute SolCount how many solutions were found. Gurobi will stop if all solutions were found or the parameter PoolSolutions is reached. However, if your problem is very complex Gurobi might take a while to find all solutions.

    1
  • Understood. That's all I need.

     

    Thank you so much. Marika Karbstein and Silke Horn

    0

Please sign in to leave a comment.