No Matches
transport8.py File Reference

This is the 8th model in a series of examples. More...

Go to the source code of this file.


def transport8.scen_solve (checkpoint, bmult_list, list_lock, io_lock)


str transport8.GAMS_MODEL
sys transport8.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
GamsWorkspace transport8.ws = GamsWorkspace(system_directory=sys_dir)
GamsWorkspace transport8.cp = ws.add_checkpoint()
GamsWorkspace transport8.job = ws.add_job_from_string(GAMS_MODEL)
list transport8.bmult_list = [1.3, 1.2, 1.1, 1.0, 0.9, 0.8, 0.7, 0.6]
Lock transport8.list_lock = Lock()
Lock transport8.io_lock = Lock()
int transport8.nr_workers = 2
dict transport8.threads = {}

Detailed Description

This is the 8th model in a series of examples.

Here we show:

  • How to use a queue to solve multiple GamsModelInstances in parallel
  • Note that the CPython implementation will not run threads in parallel due to its Global Interpreter Lock. See the transport8a.py example that uses the multiprocessing Python package for parallel computation.

Definition in file transport8.py.