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 12 of file transport2.py.

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

◆ get_model_text()

def transport2.get_model_text ( )

Definition at line 37 of file transport2.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 incname $abort 'no include file name for data file provided'
50$include %incname%
51
52 Parameter c(i,j) transport cost in thousands of dollars per case ;
53
54 c(i,j) = f * d(i,j) / 1000 ;
55
56 Variables
57 x(i,j) shipment quantities in cases
58 z total transportation costs in thousands of dollars ;
59
60 Positive Variable x ;
61
62 Equations
63 cost define objective function
64 supply(i) observe supply limit at plant i
65 demand(j) satisfy demand at market j ;
66
67 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
68
69 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
70
71 demand(j) .. sum(i, x(i,j)) =g= b(j) ;
72
73 Model transport /all/ ;
74
75 Solve transport using lp minimizing z ;
76
77 Display x.l, x.m ; '''
78
79
def get_model_text()
Definition: warehouse.py:17

Variable Documentation

◆ file

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

Definition at line 86 of file transport2.py.

◆ opt

transport2.opt = ws.add_options()

Definition at line 91 of file transport2.py.

◆ t2

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

Definition at line 90 of file transport2.py.

◆ ws

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

Definition at line 82 of file transport2.py.