Hi,
I am also interested in obtaining a solution pool from a MILP using Gurobi. I have looked at the docs but I cannot manage to retrieve the different solutions. For example, for the model mentioned by @davide-f here above:
using JuMP
m = Model(optimizer_with_attributes(Gurobi.Optimizer, “PoolSearchMode”=>2, “PoolSolutions” => 1000))
@variables(m,begin
0 <= x <= 5
0 <= y <= 10, Int
z, Bin
zz, Bin
end)
@objective(m, Max, x + 2y + 5*(z+zz))
@constraint(m, x + y + z + zz<= 10)
@constraint(m, x + 2y + z + zz <= 15)
@constraint(m, z + zz <= 1)
optimize!(m)
I get:
Academic license - for non-commercial use only
Optimize a model with 3 rows, 4 columns and 10 nonzeros
Variable types: 1 continuous, 3 integer (2 binary)
Coefficient statistics:
Matrix range [1e+00, 2e+00]
Objective range [1e+00, 5e+00]
Bounds range [5e+00, 1e+01]
RHS range [1e+00, 2e+01]
Found heuristic solution: objective 15.0000000
Presolve time: 0.00s
Presolved: 3 rows, 4 columns, 10 nonzeros
Variable types: 1 continuous, 3 integer (2 binary)
…
Explored 47 nodes (10 simplex iterations) in 0.01 seconds
Thread count was 8 (of 8 available processors)
Solution count 24: 19 19 19 … 5
No other solutions better than -1e+100
Optimal solution found (tolerance 1.00e-04)
Best objective 1.900000000000e+01, best bound 1.900000000000e+01, gap 0.0000%
And so we have:
- 24 solutions (by running result_count(m))
- But then value(z; result=i) and objective_value(m; result=i) always return the same value (for each i in {1,…,24})
Any idea of what is going on? Is the “result” argument not functioning?
Thank you!