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 14 of file transport3.py.

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

◆ get_model_text()

def transport3.get_model_text ( )

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

Variable Documentation

◆ all_model_types

transport3.all_model_types

Definition at line 96 of file transport3.py.

◆ databases

transport3.databases

Definition at line 105 of file transport3.py.

◆ opt

transport3.opt = ws.add_options()

Definition at line 94 of file transport3.py.

◆ t3

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

Definition at line 89 of file transport3.py.

◆ t3a

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

Definition at line 101 of file transport3.py.

◆ t3b

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

Definition at line 102 of file transport3.py.

◆ ws

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

Definition at line 85 of file transport3.py.