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
 
tuple keys = ( str(distance.cell_value(rx, 0)), str(distance.cell_value(0, cx)) )
 
 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 12 of file transport10.py.

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

Variable Documentation

◆ all_model_types

transport10.all_model_types

Definition at line 97 of file transport10.py.

◆ capacity

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

Definition at line 60 of file transport10.py.

◆ capacity_param

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

Definition at line 76 of file transport10.py.

◆ databases

transport10.databases

Definition at line 98 of file transport10.py.

◆ db

transport10.db = ws.add_database()

Definition at line 73 of file transport10.py.

◆ demand

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

Definition at line 61 of file transport10.py.

◆ demand_param

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

Definition at line 77 of file transport10.py.

◆ distance

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

Definition at line 62 of file transport10.py.

◆ distance_param

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

Definition at line 78 of file transport10.py.

◆ i

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

Definition at line 74 of file transport10.py.

◆ j

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

Definition at line 75 of file transport10.py.

◆ keys

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

Definition at line 90 of file transport10.py.

◆ opt

transport10.opt = ws.add_options()

Definition at line 95 of file transport10.py.

◆ t10

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

Definition at line 94 of file transport10.py.

◆ value

transport10.value

Definition at line 82 of file transport10.py.

◆ wb

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

Definition at line 58 of file transport10.py.

◆ ws

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

Definition at line 69 of file transport10.py.