2using System.Collections.Generic;
6using System.Globalization;
23 static void Main(
string[] args)
26 if (Environment.GetCommandLineArgs().Length > 1)
27 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
35 double[] bmultlist =
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
38 foreach (
double b
in bmultlist)
40 string b_formatted = b.ToString(CultureInfo.InvariantCulture);
41 GAMSJob t5 = ws.AddJobFromString(
"bmult=" +
43 "; solve transport min z use lp; ms=transport.modelstat; ss=transport.solvestat;", cp);
47 Console.WriteLine(
"Scenario bmult=" + b_formatted +
":");
54 static String GetModelText()
58 i canning plants / seattle, san-diego /
59 j markets / new-york, chicago, topeka / ;
63 a(i) capacity of plant i in cases
67 b(j) demand at market j in cases
72 Table d(i,j) distance in thousands of miles
73 new-york chicago topeka
75 san-diego 2.5 1.8 1.4 ;
77 Scalar f freight in dollars per case per thousand miles /90/ ;
78 Scalar bmult demand multiplier /1/;
80 Parameter c(i,j) transport cost in thousands of dollars per case ;
82 c(i,j) = f * d(i,j) / 1000 ;
85 x(i,j) shipment quantities in cases
86 z total transportation costs in thousands of dollars ;
91 cost define objective function
92 supply(i) observe supply limit at plant i
93 demand(j) satisfy demand at market j ;
95 cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
97 supply(i) .. sum(j, x(i,j)) =l= a(i) ;
99 demand(j) .. sum(i, x(i,j)) =g= bmult*b(j) ;
101 Model transport /all/ ;
102 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...