How to enumerate all solutions

Tells how to enumerate all solutions of a MIP model.

About this task

You can also enumerate all solutions that are valid for a specific criterion. For example, if you want to enumerate all alternative optimal solutions, do the following steps:


  1. Set the absolute gap for solution pool parameter (SolnPoolAGap, CPX_PARAM_SOLNPOOLAGAP) to 0.0 (zero).
  2. Set the solution pool intensity parameter to 4 (SolnPoolIntensity, CPX_PARAM_SOLNPOOLINTENSITY).
  3. Set the maximum number of solutions generated for solution pool by populate (PopulateLim, CPX_PARAM_POPULATELIM) to a value sufficiently large for your model; for example, 2 100 000 000.
  4. Call populate.


Beware, however, that, even for small models, the number of possible solutions is likely to be huge. Consequently, enumerating all of them will take time and consume a large quantity of memory.

In the Interactive Optimizer, for example, to write all the solutions to a file named mySolutions.sol in the SOL file format, execute that procedure and then use the following command:

write mySolutions.sol all

In addition, when you attempt to enumerate all solutions, some restrictions apply, as explained in the following sections.