transport4.py File Reference

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

Go to the source code of this file.

Functions

def transport4.get_model_text ()
 

Variables

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

Detailed Description

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

Here we show:

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

Definition in file transport4.py.