transport10 Namespace Reference

Functions

def get_model_text ()
 

Variables

 wb = open_workbook("..\\Data\\transport.xls")
 
 capacity = wb.sheet_by_name("capacity")
 
 demand = wb.sheet_by_name("demand")
 
 distance = wb.sheet_by_name("distance")
 
 ws = GamsWorkspace(system_directory = sys.argv[1])
 
 db = ws.add_database()
 
 i = db.add_set("i", 1, "Plants")
 
 j = db.add_set("j", 1, "Markets")
 
 capacity_param = db.add_parameter_dc("a", [i], "Capacity")
 
 demand_param = db.add_parameter_dc("b", [j], "Demand")
 
 distance_param = db.add_parameter_dc("d", [i,j], "Distance")
 
 value
 
 rowx
 
 colx
 
tuple keys = ( str(distance.cell_value(rowx=rx, colx=0)), str(distance.cell_value(rowx=0, colx=cx)) )
 
 rx
 
 t10 = ws.add_job_from_string(get_model_text())
 
 opt = ws.add_options()
 
 all_model_types
 
 databases
 

Function Documentation

◆ get_model_text()

def transport10.get_model_text ( )

Definition at line 13 of file transport10.py.

13def get_model_text():
14 return '''
15 Sets
16 i canning plants
17 j markets
18
19 Parameters
20 a(i) capacity of plant i in cases
21 b(j) demand at market j in cases
22 d(i,j) distance in thousands of miles
23 Scalar f freight in dollars per case per thousand miles /90/;
24
25$if not set gdxincname $abort 'no include file name for data file provided'
26$gdxin %gdxincname%
27$load i j a b d
28$gdxin
29
30 Parameter c(i,j) transport cost in thousands of dollars per case ;
31
32 c(i,j) = f * d(i,j) / 1000 ;
33
34 Variables
35 x(i,j) shipment quantities in cases
36 z total transportation costs in thousands of dollars ;
37
38 Positive Variable x ;
39
40 Equations
41 cost define objective function
42 supply(i) observe supply limit at plant i
43 demand(j) satisfy demand at market j ;
44
45 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
46
47 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
48
49 demand(j) .. sum(i, x(i,j)) =g= b(j) ;
50
51 Model transport /all/ ;
52
53 Solve transport using lp minimizing z ;
54
55 Display x.l, x.m ; '''
56
57
def get_model_text()
Definition: warehouse.py:18

Variable Documentation

◆ all_model_types

transport10.all_model_types

Definition at line 98 of file transport10.py.

◆ capacity

transport10.capacity = wb.sheet_by_name("capacity")

Definition at line 61 of file transport10.py.

◆ capacity_param

transport10.capacity_param = db.add_parameter_dc("a", [i], "Capacity")

Definition at line 77 of file transport10.py.

◆ colx

transport10.colx

Definition at line 83 of file transport10.py.

◆ databases

transport10.databases

Definition at line 99 of file transport10.py.

◆ db

transport10.db = ws.add_database()

Definition at line 74 of file transport10.py.

◆ demand

transport10.demand = wb.sheet_by_name("demand")

Definition at line 62 of file transport10.py.

◆ demand_param

transport10.demand_param = db.add_parameter_dc("b", [j], "Demand")

Definition at line 78 of file transport10.py.

◆ distance

transport10.distance = wb.sheet_by_name("distance")

Definition at line 63 of file transport10.py.

◆ distance_param

transport10.distance_param = db.add_parameter_dc("d", [i,j], "Distance")

Definition at line 79 of file transport10.py.

◆ i

transport10.i = db.add_set("i", 1, "Plants")

Definition at line 75 of file transport10.py.

◆ j

transport10.j = db.add_set("j", 1, "Markets")

Definition at line 76 of file transport10.py.

◆ keys

tuple transport10.keys = ( str(distance.cell_value(rowx=rx, colx=0)), str(distance.cell_value(rowx=0, colx=cx)) )

Definition at line 91 of file transport10.py.

◆ opt

transport10.opt = ws.add_options()

Definition at line 96 of file transport10.py.

◆ rowx

transport10.rowx

Definition at line 83 of file transport10.py.

◆ rx

transport10.rx

Definition at line 92 of file transport10.py.

◆ t10

transport10.t10 = ws.add_job_from_string(get_model_text())

Definition at line 95 of file transport10.py.

◆ value

transport10.value

Definition at line 83 of file transport10.py.

◆ wb

transport10.wb = open_workbook("..\\Data\\transport.xls")

Definition at line 59 of file transport10.py.

◆ ws

transport10.ws = GamsWorkspace(system_directory = sys.argv[1])

Definition at line 70 of file transport10.py.