transport2 Namespace Reference

Functions

def get_data_text ()
 
def get_model_text ()
 

Variables

 ws = GamsWorkspace(system_directory = sys.argv[1])
 
 file = open(os.path.join(ws.working_directory, "tdata.gms"), "w")
 
 t2 = ws.add_job_from_string(get_model_text())
 
 opt = ws.add_options()
 

Function Documentation

◆ get_data_text()

def transport2.get_data_text ( )

Definition at line 13 of file transport2.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
37
def get_data_text()
Definition: transport2.py:13

◆ get_model_text()

def transport2.get_model_text ( )

Definition at line 38 of file transport2.py.

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

Variable Documentation

◆ file

transport2.file = open(os.path.join(ws.working_directory, "tdata.gms"), "w")

Definition at line 87 of file transport2.py.

◆ opt

transport2.opt = ws.add_options()

Definition at line 92 of file transport2.py.

◆ t2

transport2.t2 = ws.add_job_from_string(get_model_text())

Definition at line 91 of file transport2.py.

◆ ws

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

Definition at line 83 of file transport2.py.