How to get the Solution Pool using Julia/CPLEX?
Hi everyone,
I need the solution pool for storing multiple solutions of a MIP model. I using Julia and the packages JuMP and CPLEX as a solver. So I need to collect solutions within a given percentage of the optimal solution but I don’t know how to do it in Julia, anybody can help me, please?
I don't think it's available on the JuMP layer since it's solver specific. If you are ready to do a bit of hacking, then you can maybe try using setincumbentcallbackfunc of CPLEX.jl
I set the parameters as explained on the IBM website, but I don't know how to call the populate solution pool. Using callbacks I only got the values of the objective function, best bound, numbers of nodes of B&B tree, but I need the values of the multiple solutions for the variables that have the same objective function value, which means populate the solution pool.
We now wrap CPXpopulate(model.env, model.lp), but there is still no nice way of accessing multiple solutions via MOI. Ideally, we would have something like the following:
model = CPLEX.Optimizer()
x = MOI.add_variable(model)
# ... model definition ...
MOI.optimize!(model)
CPXpopulate(model.env, model.lp)
for n = 1:MOI.get(model, MOI.ResultCount())
x_n = MOI.get(model, MOI.VariablePrimal(n), x)
println("Value of x in solution $(n) is $(x_n)")
end
This is all possible via the exposed C API, so it just needs some plumbing. I won't be implementing this, but I will leave the issue open for a motivated person in the community.
Hi, are there updates on this issue? More and more solvers are now providing solution pools and it would be an useful feature Thank you
@jd-foster worked out the details here: https://github.com/jump-dev/jump-dev.github.io/pull/58. It just needs implementing at the MOI level. PRs accepted.