Skip to main content

Total number of feasible solutions in Python/Gurobi

Answered

Comments

6 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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.
  • Marika Karbstein
    • 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

    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

    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

Post is closed for comments.