This example demonstrates a parallel implementation of a simple Benders decomposition method for a stochastic linear program. More...
Go to the source code of this file.
Detailed Description
This example demonstrates a parallel implementation of a simple Benders decomposition method for a stochastic linear program.
The underlying model implements a simple distribution system with stochastic demand data. This parallel version extends the benders_2stage.py example by solving the independent sub problems in parallel. For that we need to instantiate a separate GamsModelInstance for each parallel worker. We use the efficient GamsModelInstance.copy_modelinstance method to accomplish this in the most efficient way. The number of demand scenarios can be larger than the number of parallel workers. The distribution of work is handled through a work queue. The parallel execution of the sub problems is done in separate threads (the mt in the name of the example stands for multi threading), so there is very little overhead from disk activity. Note that the CPython implementation will not run threads in parallel due to its Global Interpreter Lock.
Definition in file benders_2stage_mt.py.