Loading...
Searching...
No Matches
transport4.py File Reference

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

Go to the source code of this file.

Variables

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

Detailed Description

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

Here we show:

  • How to define data using Python data structures
  • How to prepare a GamsDatabase from Python data structures

Definition in file transport4.py.