Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Pyomo support generation of multiple solutions?

Tags:

gurobi

pyomo

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?

like image 741
Suhas Pai Avatar asked Nov 06 '22 15:11

Suhas Pai


1 Answers

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'
like image 92
mattmilten Avatar answered Dec 03 '22 12:12

mattmilten