Skip to main content

Finding Multiple Solutions




  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Julia,

    Regarding the retrieving of solutions, please note that the setParam function does not return the solution. It only sets the solution which you will get via the Xn and the PoolObjVal attributes. Please refer to the documentation on Retrieving Solutions and the example for more details.

    Could this be due to the complexity of my optimization that no further solutions can be found? I would have assumed that no matter how complex the optimization is, the solver can also determine and output further non-optimal solutions.

    Could you post the log file snippet showing the solution process? It is possible that your model has exactly 1 feasible solution (even if it is rather unlikely).

    Best regards,

  • JC
    First Comment
    First Question

    Hi Jaromil,

    thank you very much for your feedback!

    I am aware that I cannot output the solution with setParam.
    First, I would like to query the number of stored solutions with SolCount. Since only one solution (=the optimal solution?) was counted there, I wanted to ask first if it is possible that only one solution exists in my optimization.

    The following is my log file:

    Gurobi 9.1.2 (win64) logging started Tue Aug 24 12:22:39 2021

    Changed value of parameter LogFile to Log
    Prev: Default:
    Changed value of parameter Method to 1
    Prev: -1 Min: -1 Max: 5 Default: -1
    Changed value of parameter PoolSolutions to 50
    Prev: 10 Min: 1 Max: 2000000000 Default: 10
    Changed value of parameter PoolSearchMode to 2
    Prev: 0 Min: 0 Max: 2 Default: 0
    Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
    Thread count: 6 physical cores, 12 logical processors, using up to 12 threads
    Optimize a model with 4323 rows, 3849 columns and 699251 nonzeros
    Model fingerprint: 0x123a83c8
    Coefficient statistics:
    Matrix range [1e-04, 2e+00]
    Objective range [4e+00, 3e+02]
    Bounds range [0e+00, 0e+00]
    RHS range [1e+00, 8e+01]
    Presolve removed 8 rows and 2 columns
    Presolve time: 0.16s
    Presolved: 4315 rows, 3847 columns, 697806 nonzeros

    Iteration Objective Primal Inf. Dual Inf. Time
    0 2.6704171e+03 2.392500e+02 0.000000e+00 0s
    2196 2.0185177e+04 0.000000e+00 0.000000e+00 1s

    Solved in 2196 iterations and 0.71 seconds
    Optimal objective 2.018517748e+04

    Thank you in advance and best regards,

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Julia,

    Your problem is an LP. LPs generally have exactly one optimal solution. The Solution Pool feature is designed for MIPs and will not provide you multiple optimal solutions for LPs.

    The rare cases where an LP has infinitely many optimal solutions are hard to handle and require manual algorithms and/or heuristics to get multiple solution points. As an example, one approach may focus on the computation of all vertices of the optimal facet (which is in general very expensive).

    Best regards,


Please sign in to leave a comment.