transport11 Namespace Reference

Functions

def get_base_model_text ()
 
def get_model_text ()
 
def create_save_restart (cp_file_name)
 

Variables

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

Function Documentation

◆ create_save_restart()

def transport11.create_save_restart (   cp_file_name)

Definition at line 59 of file transport11.py.

59def create_save_restart(cp_file_name):
60  if len(sys.argv) > 1:
61  ws = GamsWorkspace(os.path.dirname(cp_file_name), sys.argv[1])
62  else:
63  ws = GamsWorkspace(os.path.dirname(cp_file_name))
64 
65  j1 = ws.add_job_from_string(get_base_model_text())
66  opt = ws.add_options()
67 
68  opt.action = Action.CompileOnly
69  cp = ws.add_checkpoint(os.path.basename(cp_file_name))
70  j1.run(opt, cp)
71  del opt
72 
73 

References get_base_model_text().

◆ get_base_model_text()

def transport11.get_base_model_text ( )

Definition at line 11 of file transport11.py.

Referenced by create_save_restart().

◆ get_model_text()

def transport11.get_model_text ( )

Definition at line 49 of file transport11.py.

Variable Documentation

◆ a

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

Definition at line 109 of file transport11.py.

◆ all_model_types

transport11.all_model_types

Definition at line 129 of file transport11.py.

◆ b

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

Definition at line 113 of file transport11.py.

◆ capacity

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

Definition at line 82 of file transport11.py.

◆ cp_base

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

Definition at line 125 of file transport11.py.

◆ d

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

Definition at line 117 of file transport11.py.

◆ databases

transport11.databases

Definition at line 130 of file transport11.py.

◆ db

transport11.db = ws.add_database()

Definition at line 98 of file transport11.py.

◆ demand

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

Definition at line 83 of file transport11.py.

◆ distance

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

Definition at line 85 of file transport11.py.

◆ f

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

Definition at line 121 of file transport11.py.

◆ i

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

Definition at line 101 of file transport11.py.

◆ j

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

Definition at line 105 of file transport11.py.

◆ markets

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

Definition at line 81 of file transport11.py.

◆ opt

transport11.opt = ws.add_options()

Definition at line 127 of file transport11.py.

◆ plants

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

Definition at line 80 of file transport11.py.

◆ t4

transport11.t4 = ws.add_job_from_string(get_model_text(), cp_base)

Definition at line 126 of file transport11.py.

◆ value

transport11.value

Definition at line 111 of file transport11.py.

◆ w_dir

transport11.w_dir = os.path.join(".", "tmp")

Definition at line 77 of file transport11.py.

◆ ws

transport11.ws = GamsWorkspace(w_dir, sys.argv[1])

Definition at line 94 of file transport11.py.

def get_base_model_text()
Definition: transport11.py:11
def create_save_restart(cp_file_name)
Definition: transport11.py:59