2using System.Collections.Generic;
6using System.Threading.Tasks;
20 static void Main(
string[] args)
22 double[] bmultlist =
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
24 Parallel.ForEach(bmultlist, delegate(
double bmult)
26 Console.WriteLine(
"Scenario bmult=" + bmult +
", Obj:" + optim.solve(bmult));
37 if (Environment.GetCommandLineArgs().Length > 1)
38 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
43 public double solve(
double mult)
54 gModJob.
Run(gOption, gDb);
59 private String GetModelText()
63 i canning plants / seattle, san-diego /
64 j markets / new-york, chicago, topeka / ;
68 a(i) capacity of plant i in cases
72 b(j) demand at market j in cases
77 Table d(i,j) distance in thousands of miles
78 new-york chicago topeka
80 san-diego 2.5 1.8 1.4 ;
82 Scalar f freight in dollars per case per thousand miles;
84$if not set gdxincname $abort 'no include file name for data file provided'
89 Parameter c(i,j) transport cost in thousands of dollars per case ;
91 c(i,j) = f * d(i,j) / 1000 ;
94 x(i,j) shipment quantities in cases
95 z total transportation costs in thousands of dollars ;
100 cost define objective function
101 supply(i) observe supply limit at plant i
102 demand(j) satisfy demand at market j ;
104 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
106 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
108 demand(j) .. sum(i, x(i,j)) =g= b(j) ;
110 Model transport /all/ ;
112 Solve transport using lp minimizing z ;
GAMSVariable GetVariable(string variableIdentifier)
GAMSParameter AddParameter(string identifier, int dimension, string explanatoryText="")
void Run(GAMSOptions gamsOptions=null, GAMSCheckpoint checkpoint=null, TextWriter output=null, Boolean createOutDB=true)
Dictionary< string, string > Defines
new GAMSParameterRecord AddRecord(params string[] keys)
new GAMSVariableRecord FirstRecord()
GAMSJob AddJobFromString(string gamsSource, GAMSCheckpoint checkpoint=null, string jobName=null)
GAMSDatabase AddDatabase(string databaseName=null, string inModelName=null)
GAMSOptions AddOptions(GAMSOptions optFrom=null)
This is the 14th model in a series of tutorial examples. Here we show: How to run multiple GAMSJobs i...