I've been using Gurobi to solve an MILP problem, and Pyomo for generating the model. Gurobi supports returning a Solution pool, and I want to be able to generate multiple solutions using this pool. Is this supported in Pyomo?
I've tried using model.solCount, and model.params.SolutionNumber, but I found out that it works for gurobipy models, and not models in Pyomo.
Is it possible to somehow load(iteratively) these solutions into the model? If it isn't, what are my other options, if I have to do this with Pyomo?
You should be able to use Gurobi's feature of writing solution files to disk. Just set the parameter SolFiles to some name and Gurobi will save all solutions:
from pyomo.opt import SolverFactory
opt = SolverFactory('gurobi')
opt.options['Solfiles'] = 'solution'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With