No Matches
transport11.py File Reference

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

Go to the source code of this file.


def transport11.create_save_restart (sys_dir, cp_file_name)


str transport11.GAMS_BASE_MODEL
str transport11.GAMS_MODEL
sys transport11.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None
os transport11.working_dir = os.path.join(os.curdir, "tmp")
GamsWorkspace transport11.ws = GamsWorkspace(working_dir, sys_dir)
list transport11.plants = ["Seattle", "San-Diego"]
list transport11.markets = ["New-York", "Chicago", "Topeka"]
dict transport11.capacity = {"Seattle": 350.0, "San-Diego": 600.0}
dict transport11.demand = {"New-York": 325.0, "Chicago": 300.0, "Topeka": 275.0}
dict transport11.distance
GamsWorkspace transport11.db = ws.add_database()
GamsWorkspace transport11.i = db.add_set("i", 1, "canning plants")
GamsWorkspace transport11.j = db.add_set("j", 1, "markets")
GamsWorkspace transport11.a = db.add_parameter_dc("a", [i], "capacity of plant i in cases")
GamsWorkspace transport11.b = db.add_parameter_dc("b", [j], "demand at market j in cases")
GamsWorkspace transport11.d = db.add_parameter_dc("d", [i, j], "distance in thousands of miles")
GamsWorkspace transport11.f = db.add_parameter("f", 0, "freight in dollars per case per thousand miles")
GamsWorkspace transport11.cp_base = ws.add_checkpoint("tbase")
GamsWorkspace transport11.job = ws.add_job_from_string(GAMS_MODEL, cp_base)
GamsWorkspace transport11.opt = ws.add_options()

Detailed Description

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

Here we show:

  • How to create and use a save/restart file

Definition in file transport11.py.