transport3 Namespace Reference

Functions

def get_data_text ()
 
def get_model_text ()
 

Variables

 ws = GamsWorkspace(system_directory = sys.argv[1])
 
 t3 = ws.add_job_from_string(get_data_text())
 
 opt = ws.add_options()
 
 all_model_types
 
 t3a = ws.add_job_from_string(get_data_text())
 
 t3b = ws.add_job_from_string(get_model_text())
 
 databases
 

Function Documentation

◆ get_data_text()

def transport3.get_data_text ( )

Definition at line 13 of file transport3.py.

13def get_data_text():
14 return '''
15 Sets
16 i canning plants / seattle, san-diego /
17 j markets / new-york, chicago, topeka / ;
18
19 Parameters
20
21 a(i) capacity of plant i in cases
22 / seattle 350
23 san-diego 600 /
24
25 b(j) demand at market j in cases
26 / new-york 325
27 chicago 300
28 topeka 275 / ;
29
30 Table d(i,j) distance in thousands of miles
31 new-york chicago topeka
32 seattle 2.5 1.7 1.8
33 san-diego 2.5 1.8 1.4 ;
34
35 Scalar f freight in dollars per case per thousand miles /90/ ; '''
36
def get_data_text()
Definition: transport3.py:13

◆ get_model_text()

def transport3.get_model_text ( )

Definition at line 37 of file transport3.py.

37def get_model_text():
38 return '''
39 Sets
40 i canning plants
41 j markets
42
43 Parameters
44 a(i) capacity of plant i in cases
45 b(j) demand at market j in cases
46 d(i,j) distance in thousands of miles
47 Scalar f freight in dollars per case per thousand miles;
48
49$if not set gdxincname $abort 'no include file name for data file provided'
50$gdxin %gdxincname%
51$load i j a b d f
52$gdxin
53
54 Parameter c(i,j) transport cost in thousands of dollars per case ;
55
56 c(i,j) = f * d(i,j) / 1000 ;
57
58 Variables
59 x(i,j) shipment quantities in cases
60 z total transportation costs in thousands of dollars ;
61
62 Positive Variable x ;
63
64 Equations
65 cost define objective function
66 supply(i) observe supply limit at plant i
67 demand(j) satisfy demand at market j ;
68
69 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
70
71 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
72
73 demand(j) .. sum(i, x(i,j)) =g= b(j) ;
74
75 Model transport /all/ ;
76
77 Solve transport using lp minimizing z ;
78
79 Display x.l, x.m ; '''
80
81
def get_model_text()
Definition: warehouse.py:17

Variable Documentation

◆ all_model_types

transport3.all_model_types

Definition at line 95 of file transport3.py.

◆ databases

transport3.databases

Definition at line 104 of file transport3.py.

◆ opt

transport3.opt = ws.add_options()

Definition at line 93 of file transport3.py.

◆ t3

transport3.t3 = ws.add_job_from_string(get_data_text())

Definition at line 88 of file transport3.py.

◆ t3a

transport3.t3a = ws.add_job_from_string(get_data_text())

Definition at line 100 of file transport3.py.

◆ t3b

transport3.t3b = ws.add_job_from_string(get_model_text())

Definition at line 101 of file transport3.py.

◆ ws

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

Definition at line 84 of file transport3.py.