I would like to solve an ILP and get all feasible solutions (even the worst one). How could I do that using docplex.cp?

I've seen a similar question in: Using CPLEX "solution pool" to count feasible points

However, if I am not wrong, the answers were only focused on MIP problem, instead of ILP. I was not able to find a function in docplex for ILP problems able to call all feasible solutions. I was wondering that I need to do an intermediate step in order to get these solutions, but I really do not know if it is possible. Could someone help me?


1 Answer 1


I am answering my own question because it may help other people.

I could not find a function in docplex able to get all feasible solutions for a ILP problem. For my best knowledge, docplex only has this kind of function for MIP problems. If you are dealing with MIP, you can check additional information here: https://www.ibm.com/support/knowledgecenter/SS9UKU_12.8.0/com.ibm.cplex.zos.help/CPLEX/Parameters/topics/listSolnPool.html https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.SolnPoolInterface-class.html

Feasible solutions for ILP problems:

With OR-tools I could find a way to get all feasible solutions for constrained problems by using SearchForAllSolutions. As expected, this functions is available for CP-SAT and you cannot state any objective function.

If you are interested in it, I suggest you to take a look at this example: https://developers.google.com/optimization/cp/cp_solver#first_sol_program

PS: In my case, I was trying to solve a 01LP, so it generated many solutions, but with several duplicates. In order to avoid that, you can state a limit (time or number of solutions found). Please, check CP-SAT documentation for additional information.

Hope it will help someone!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.