Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the Solution Pool using Julia/CPLEX? #197

Open
GiAbreu opened this issue Oct 23, 2018 · 5 comments
Open

How to get the Solution Pool using Julia/CPLEX? #197

GiAbreu opened this issue Oct 23, 2018 · 5 comments
Labels
Wrapper: MathOptInterface Relates to the MathOptInterface API

Comments

@GiAbreu
Copy link

GiAbreu commented Oct 23, 2018

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?

@IssamT
Copy link
Contributor

IssamT commented Oct 24, 2018

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

@GiAbreu
Copy link
Author

GiAbreu commented Oct 24, 2018

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.

@odow odow added the Wrapper: MathOptInterface Relates to the MathOptInterface API label Oct 30, 2019
@odow
Copy link
Member

odow commented Oct 5, 2020

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.

@davide-f
Copy link

davide-f commented Nov 16, 2021

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

@odow
Copy link
Member

odow commented Nov 16, 2021

@jd-foster worked out the details here: jump-dev/jump-dev.github.io#58. It just needs implementing at the MOI level. PRs accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Wrapper: MathOptInterface Relates to the MathOptInterface API
Development

No branches or pull requests

4 participants