Loading...
Searching...
No Matches
transport11 Namespace Reference

Functions

def create_save_restart (sys_dir, cp_file_name)
 

Variables

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

Function Documentation

◆ create_save_restart()

def transport11.create_save_restart (   sys_dir,
  cp_file_name 
)

Definition at line 60 of file transport11.py.

60def create_save_restart(sys_dir, cp_file_name):
61 ws = GamsWorkspace(os.path.dirname(cp_file_name), sys_dir)
62 job_1 = ws.add_job_from_string(GAMS_BASE_MODEL)
63 opt = ws.add_options()
64 opt.action = Action.CompileOnly
65 cp = ws.add_checkpoint(os.path.basename(cp_file_name))
66 job_1.run(opt, cp)
67
68

Variable Documentation

◆ a

GamsWorkspace transport11.a = db.add_parameter_dc("a", [i], "capacity of plant i in cases")

Definition at line 106 of file transport11.py.

◆ all_model_types

transport11.all_model_types

Definition at line 126 of file transport11.py.

◆ b

GamsWorkspace transport11.b = db.add_parameter_dc("b", [j], "demand at market j in cases")

Definition at line 110 of file transport11.py.

◆ capacity

dict transport11.capacity = {"Seattle": 350.0, "San-Diego": 600.0}

Definition at line 82 of file transport11.py.

◆ cp_base

GamsWorkspace transport11.cp_base = ws.add_checkpoint("tbase")

Definition at line 122 of file transport11.py.

◆ d

GamsWorkspace transport11.d = db.add_parameter_dc("d", [i, j], "distance in thousands of miles")

Definition at line 114 of file transport11.py.

◆ databases

transport11.databases

Definition at line 127 of file transport11.py.

◆ db

GamsWorkspace transport11.db = ws.add_database()

Definition at line 95 of file transport11.py.

◆ demand

dict transport11.demand = {"New-York": 325.0, "Chicago": 300.0, "Topeka": 275.0}

Definition at line 84 of file transport11.py.

◆ distance

dict transport11.distance
Initial value:
1= {
2 ("Seattle", "New-York"): 2.5,
3 ("Seattle", "Chicago"): 1.7,
4 ("Seattle", "Topeka"): 1.8,
5 ("San-Diego", "New-York"): 2.5,
6 ("San-Diego", "Chicago"): 1.8,
7 ("San-Diego", "Topeka"): 1.4,
8 }

Definition at line 86 of file transport11.py.

◆ f

GamsWorkspace transport11.f = db.add_parameter("f", 0, "freight in dollars per case per thousand miles")

Definition at line 118 of file transport11.py.

◆ GAMS_BASE_MODEL

str transport11.GAMS_BASE_MODEL

Definition at line 11 of file transport11.py.

◆ GAMS_MODEL

str transport11.GAMS_MODEL
Initial value:
1= """
2$if not set gdxincname $abort 'no include file name for data file provided'
3$gdxIn %gdxincname%
4$onMulti
5$load i j a b d f
6$gdxIn
7
8display x.l, x.m;
9"""

Definition at line 49 of file transport11.py.

◆ i

GamsWorkspace transport11.i = db.add_set("i", 1, "canning plants")

Definition at line 98 of file transport11.py.

◆ j

GamsWorkspace transport11.j = db.add_set("j", 1, "markets")

Definition at line 102 of file transport11.py.

◆ job

GamsWorkspace transport11.job = ws.add_job_from_string(GAMS_MODEL, cp_base)

Definition at line 123 of file transport11.py.

◆ markets

list transport11.markets = ["New-York", "Chicago", "Topeka"]

Definition at line 80 of file transport11.py.

◆ opt

transport11.opt = ws.add_options()

Definition at line 124 of file transport11.py.

◆ plants

list transport11.plants = ["Seattle", "San-Diego"]

Definition at line 78 of file transport11.py.

◆ sys_dir

sys transport11.sys_dir = sys.argv[1] if len(sys.argv) > 1 else None

Definition at line 70 of file transport11.py.

◆ value

transport11.value

Definition at line 108 of file transport11.py.

◆ working_dir

os transport11.working_dir = os.path.join(os.curdir, "tmp")

Definition at line 71 of file transport11.py.

◆ ws

GamsWorkspace transport11.ws = GamsWorkspace(working_dir, sys_dir)

Definition at line 72 of file transport11.py.