Pyomo - using gurobi persistent solver to solve subproblems in parallel

Viewed 74

I am trying to solve a MILP with Benders Decomposition using Pyomo.

The model is divided up into a master problem and many sub problems. Later, I want to solve all sub problems in parallel and I found a promising example here.

I want to use gurobi_persistent to solve the model since I need to utilize some of its functions in scripting. I have problems to implement the .set_instance(model) function, which would normaly works like this:

solver = pe.SolverFactory('gurobi_persistent')
solver.set_instance(model)
solver.solve(tee=True)

Comming back to the Benders example I tried to implement the set.instance(model) together with function with SolverManagerFactory as followed, but i got an Error.

solver_manager = SolverManagerFactory("serial")
solver_manager.set_instance(model)
solve_all_instances(solver_manager, 'gurobi_persistent', model)

Exception has occurred: AttributeError 'SolverManager_Serial' object has no attribute 'set_instance'

Clearly SolverManagerFactory does not have this this function. Then I tried the following:

solver = pe.SolverFactory('gurobi_persistent')
solver_manager = SolverManagerFactory("serial")
instance_model= solver.set_instance(model)
solve_all_instances(solver_manager, 'gurobi_persistent', instance_model)

Exception has occurred: TypeError 'NoneType' object is not iterable

So, any help on how to use Gurobi Persistent with SolverManagerFactory would be really appreciated! Also any suggestions on documentation of SolverManagerFactory would be intresting. Thanks a lot!

0 Answers
Related