2using System.Collections.Generic;
21 GAMSJob t6 = ws.
AddJobFromString(
"bmult=" + b +
"; solve transport min z use lp; ms=transport.modelstat; ss=transport.solvestat;", cp);
26 Console.WriteLine(
"Scenario bmult=" + b +
":");
32 static void Main(
string[] args)
35 if (Environment.GetCommandLineArgs().Length > 1)
36 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
44 double[] bmultlist =
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
47 Object ioMutex =
new Object();
48 System.Threading.Tasks.Parallel.ForEach(bmultlist, delegate(
double b) { RunScenario(ws, cp, ioMutex, b); });
51 static String GetModelText()
55 i canning plants / seattle, san-diego /
56 j markets / new-york, chicago, topeka / ;
60 a(i) capacity of plant i in cases
64 b(j) demand at market j in cases
69 Table d(i,j) distance in thousands of miles
70 new-york chicago topeka
72 san-diego 2.5 1.8 1.4 ;
74 Scalar f freight in dollars per case per thousand miles /90/ ;
75 Scalar bmult demand multiplier /1/;
77 Parameter c(i,j) transport cost in thousands of dollars per case ;
79 c(i,j) = f * d(i,j) / 1000 ;
82 x(i,j) shipment quantities in cases
83 z total transportation costs in thousands of dollars ;
88 cost define objective function
89 supply(i) observe supply limit at plant i
90 demand(j) satisfy demand at market j ;
92 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
94 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
96 demand(j) .. sum(i, x(i,j)) =g= bmult*b(j) ;
98 Model transport /all/ ;
99 Scalar ms 'model status', ss 'solve status';
GAMSVariable GetVariable(string variableIdentifier)
GAMSParameter GetParameter(string parameterIdentifier)
void Run(GAMSOptions gamsOptions=null, GAMSCheckpoint checkpoint=null, TextWriter output=null, Boolean createOutDB=true)
new GAMSParameterRecord FindRecord(params string[] keys)
new GAMSVariableRecord FindRecord(params string[] keys)
GAMSJob AddJobFromString(string gamsSource, GAMSCheckpoint checkpoint=null, string jobName=null)
GAMSCheckpoint AddCheckpoint(string checkpointName=null)
This is the 6th model in a series of tutorial examples. Here we show: How to run multiple GAMSJobs in...