2using System.Collections.Generic;
22 static void Main(
string[] args)
25 if (Environment.GetCommandLineArgs().Length > 1)
26 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
34 double[] bmultlist =
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
37 foreach (
double b
in bmultlist)
39 GAMSJob t5 = ws.AddJobFromString(
"bmult=" + b +
"; solve transport min z use lp; ms=transport.modelstat; ss=transport.solvestat;", cp);
41 Console.WriteLine(
"Scenario bmult=" + b +
":");
48 static String GetModelText()
52 i canning plants / seattle, san-diego /
53 j markets / new-york, chicago, topeka / ;
57 a(i) capacity of plant i in cases
61 b(j) demand at market j in cases
66 Table d(i,j) distance in thousands of miles
67 new-york chicago topeka
69 san-diego 2.5 1.8 1.4 ;
71 Scalar f freight in dollars per case per thousand miles /90/ ;
72 Scalar bmult demand multiplier /1/;
74 Parameter c(i,j) transport cost in thousands of dollars per case ;
76 c(i,j) = f * d(i,j) / 1000 ;
79 x(i,j) shipment quantities in cases
80 z total transportation costs in thousands of dollars ;
85 cost define objective function
86 supply(i) observe supply limit at plant i
87 demand(j) satisfy demand at market j ;
89 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
91 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
93 demand(j) .. sum(i, x(i,j)) =g= bmult*b(j) ;
95 Model transport /all/ ;
96 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 5th model in a series of tutorial examples. Here we show: How to initialize a GAMSCheckpo...