using gurobi persistent solver to solve subproblems in parallel

291 views
Skip to first unread message

Mike1712

unread,
May 31, 2022, 1:29:04 PM5/31/22
to Pyomo Forum

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!

Michael Bynum

unread,
Jun 1, 2022, 10:50:40 AM6/1/22
to Pyomo Forum
There is another example of Benders decomposition that uses the Gurobi persistent interface here: https://github.com/Pyomo/pyomo/blob/main/pyomo/contrib/benders/examples/farmer.py. Maybe it will help.

Michael

arg...@gmail.com

unread,
Jun 2, 2022, 2:23:40 AM6/2/22
to pyomo...@googlegroups.com

In these slides you can also find an implementation of Benders decomposition applied to the fixed-cost transportation problem

https://pascua.iit.comillas.edu/aramos/simio/transpa/s_GoodOptimizationModelingPracticesPyomo.pdf

Andrés

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/cd52f44c-a803-4251-a832-c8f246db9aafn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages