transport6 Namespace Reference

Functions

def get_model_text ()
 
def run_scenario (workspace, checkpoint, io_lock, b)
 

Variables

 ws = GamsWorkspace(system_directory = sys.argv[1])
 
 cp = ws.add_checkpoint()
 
 t6 = ws.add_job_from_string(get_model_text())
 
 checkpoint
 
list bmultlist = [ 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 ]
 
 io_lock = threading.Lock()
 
dictionary threads = {}
 
 target
 
 run_scenario
 
 args
 

Function Documentation

◆ get_model_text()

def transport6.get_model_text ( )

Definition at line 13 of file transport6.py.

13def get_model_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 Scalar bmult demand multiplier /1/;
37
38 Parameter c(i,j) transport cost in thousands of dollars per case ;
39
40 c(i,j) = f * d(i,j) / 1000 ;
41
42 Variables
43 x(i,j) shipment quantities in cases
44 z total transportation costs in thousands of dollars ;
45
46 Positive Variable x ;
47
48 Equations
49 cost define objective function
50 supply(i) observe supply limit at plant i
51 demand(j) satisfy demand at market j ;
52
53 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
54
55 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
56
57 demand(j) .. sum(i, x(i,j)) =g= bmult*b(j) ;
58
59 Model transport /all/ ;
60 Scalar ms 'model status', ss 'solve status'; '''
61
62
def get_model_text()
Definition: warehouse.py:18

◆ run_scenario()

def transport6.run_scenario (   workspace,
  checkpoint,
  io_lock,
  b 
)

Definition at line 63 of file transport6.py.

References run_scenario.

63def run_scenario(workspace, checkpoint, io_lock, b):
64 t6 = workspace.add_job_from_string("bmult=" + str(b) + "; solve transport min z use lp; ms=transport.modelstat; ss=transport.solvestat;", checkpoint)
65 t6.run()
66 # we need to make the ouput a critical section to avoid messed up report informations
67 io_lock.acquire()
68 print("Scenario bmult=" + str(b) + ":")
69 print(" Modelstatus: " + str(t6.out_db["ms"][()].value))
70 print(" Solvestatus: " + str(t6.out_db["ss"][()].value))
71 print(" Obj: " + str(t6.out_db["z"][()].level))
72 io_lock.release()
73
74
def run_scenario(workspace, checkpoint, io_lock, b)
Definition: transport6.py:63

Variable Documentation

◆ args

transport6.args

Definition at line 92 of file transport6.py.

◆ bmultlist

list transport6.bmultlist = [ 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 ]

Definition at line 86 of file transport6.py.

◆ checkpoint

transport6.checkpoint

Definition at line 85 of file transport6.py.

◆ cp

transport6.cp = ws.add_checkpoint()

Definition at line 81 of file transport6.py.

◆ io_lock

transport6.io_lock = threading.Lock()

Definition at line 89 of file transport6.py.

◆ run_scenario

transport6.run_scenario

Definition at line 92 of file transport6.py.

Referenced by run_scenario().

◆ t6

transport6.t6 = ws.add_job_from_string(get_model_text())

Definition at line 84 of file transport6.py.

◆ target

transport6.target

Definition at line 92 of file transport6.py.

◆ threads

dictionary transport6.threads = {}

Definition at line 90 of file transport6.py.

◆ ws

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

Definition at line 77 of file transport6.py.