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 11 of file transport10.py.

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

Variable Documentation

◆ all_model_types

transport10.all_model_types

Definition at line 96 of file transport10.py.

◆ capacity

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

Definition at line 59 of file transport10.py.

◆ capacity_param

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

Definition at line 75 of file transport10.py.

◆ databases

transport10.databases

Definition at line 97 of file transport10.py.

◆ db

transport10.db = ws.add_database()

Definition at line 72 of file transport10.py.

◆ demand

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

Definition at line 60 of file transport10.py.

◆ demand_param

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

Definition at line 76 of file transport10.py.

◆ distance

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

Definition at line 61 of file transport10.py.

◆ distance_param

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

Definition at line 77 of file transport10.py.

◆ i

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

Definition at line 73 of file transport10.py.

◆ j

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

Definition at line 74 of file transport10.py.

◆ keys

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

Definition at line 89 of file transport10.py.

◆ opt

transport10.opt = ws.add_options()

Definition at line 94 of file transport10.py.

◆ t10

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

Definition at line 93 of file transport10.py.

◆ value

transport10.value

Definition at line 81 of file transport10.py.

◆ wb

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

Definition at line 57 of file transport10.py.

◆ ws

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

Definition at line 68 of file transport10.py.

def get_model_text()
Definition: warehouse.py:16