No Matches
transport_gt.py File Reference

In this example we show how GAMS Transfer and the Control API work together. More...

Go to the source code of this file.


str transport_gt.GAMS_MODEL
sys transport_gt.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
GamsWorkspace transport_gt.ws = GamsWorkspace(system_directory=sys_dir)
gt transport_gt.m = gt.Container(system_directory=sys_dir)
gt transport_gt.i = m.addSet("i", records=["Seattle", "San-Diego"])
gt transport_gt.j = m.addSet("j", records=["New-York", "Chicago", "Topeka"])
GamsWorkspace transport_gt.job = ws.add_job_from_string(GAMS_MODEL)
GamsWorkspace transport_gt.opt = ws.add_options()
GamsWorkspace transport_gt.cp = ws.add_checkpoint()
gt transport_gt.job_out = gt.Container(os.path.join(ws.working_directory, opt.gdx), sys_dir)
GamsWorkspace transport_gt.mi = cp.add_modelinstance()
GamsWorkspace transport_gt.bmult = mi.sync_db.add_parameter("bmult", 0, "demand multiplier")
list transport_gt.bmultlist = [0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3]
gt transport_gt.gt_bmult = m.addParameter("bmult", records=1.0)
gt transport_gt.m_out = gt.Container(mi.sync_db, sys_dir)
GamsWorkspace transport_gt.x = mi.sync_db.add_variable("x", 2, VarType.Positive)
GamsWorkspace transport_gt.xup = mi.sync_db.add_parameter("xup", 2, "upper bound on x")
gt transport_gt.gt_xup = m.addParameter("xup", ["i", "j"])

Detailed Description

In this example we show how GAMS Transfer and the Control API work together.

Essentially, the gams.transfer.Container takes on the role of GamsDatabase. This example combines elements from transport4.py and transport7.py.

Definition in file transport_gt.py.