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

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

◆ run_scenario()

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

Definition at line 62 of file transport6.py.

References run_scenario.

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

Variable Documentation

◆ args

transport6.args

Definition at line 91 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 85 of file transport6.py.

◆ checkpoint

transport6.checkpoint

Definition at line 84 of file transport6.py.

◆ cp

transport6.cp = ws.add_checkpoint()

Definition at line 80 of file transport6.py.

◆ io_lock

transport6.io_lock = threading.Lock()

Definition at line 88 of file transport6.py.

◆ run_scenario

transport6.run_scenario

Definition at line 91 of file transport6.py.

Referenced by run_scenario().

◆ t6

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

Definition at line 83 of file transport6.py.

◆ target

transport6.target

Definition at line 91 of file transport6.py.

◆ threads

dictionary transport6.threads = {}

Definition at line 89 of file transport6.py.

◆ ws

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

Definition at line 76 of file transport6.py.