22 string b_formatted = b.ToString(CultureInfo.InvariantCulture);
25 "; solve transport min z use lp; ms=transport.modelstat; ss=transport.solvestat;", cp);
30 Console.WriteLine(
"Scenario bmult=" + b_formatted +
":");
36 static void Main(
string[] args)
39 if (Environment.GetCommandLineArgs().Length > 1)
40 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
48 double[] bmultlist =
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
51 Object ioMutex =
new Object();
52 System.Threading.Tasks.Parallel.ForEach(bmultlist, delegate (
double b) { RunScenario(ws, cp, ioMutex, b); });
55 static String GetModelText()
59 i canning plants / seattle, san-diego /
60 j markets / new-york, chicago, topeka / ;
64 a(i) capacity of plant i in cases
68 b(j) demand at market j in cases
73 Table d(i,j) distance in thousands of miles
74 new-york chicago topeka
76 san-diego 2.5 1.8 1.4 ;
78 Scalar f freight in dollars per case per thousand miles /90/ ;
79 Scalar bmult demand multiplier /1/;
81 Parameter c(i,j) transport cost in thousands of dollars per case ;
83 c(i,j) = f * d(i,j) / 1000 ;
86 x(i,j) shipment quantities in cases
87 z total transportation costs in thousands of dollars ;
92 cost define objective function
93 supply(i) observe supply limit at plant i
94 demand(j) satisfy demand at market j ;
96 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
98 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
100 demand(j) .. sum(i, x(i,j)) =g= bmult*b(j) ;
102 Model transport /all/ ;
103 Scalar ms 'model status', ss 'solve status';