2using System.Collections.Generic;
 
   25        static void Main(
string[] args)
 
   28            if (Environment.GetCommandLineArgs().Length > 1)
 
   29                ws = 
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
 
   43            opt.AllModelTypes = 
"cplex";
 
   49            double[] bmultlist = 
new double[] { 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 };
 
   51            foreach (
double b 
in bmultlist)
 
   53                bmult.FirstRecord().Value = b;
 
   55                Console.WriteLine(
"Scenario bmult=" + b + 
":");
 
   56                Console.WriteLine(
"  Modelstatus: " + mi.ModelStatus);
 
   57                Console.WriteLine(
"  Solvestatus: " + mi.SolveStatus);
 
   58                Console.WriteLine(
"  Obj: " + mi.SyncDB.GetVariable(
"z").FindRecord().Level);
 
   62            mi = cp.AddModelInstance();
 
   65            GAMSParameter xup = mi.SyncDB.AddParameter(
"xup", 2, 
"upper bound on x");
 
   74                    xup.AddRecord(i.Key(0),j.Key(0)).Value = 0;
 
   76                    Console.WriteLine(
"Scenario link blocked: " + i.Key(0)  + 
" - " + j.Key(0));
 
   77                    Console.WriteLine(
"  Modelstatus: " + mi.ModelStatus);
 
   78                    Console.WriteLine(
"  Solvestatus: " + mi.SolveStatus);
 
   79                    Console.WriteLine(
"  Obj: " + mi.SyncDB.GetVariable(
"z").FindRecord().Level);
 
   83        static String GetModelText()
 
   87       i   canning plants   / seattle, san-diego / 
   88       j   markets          / new-york, chicago, topeka / ; 
   92       a(i)  capacity of plant i in cases 
   96       b(j)  demand at market j in cases 
  101  Table d(i,j)  distance in thousands of miles 
  102                    new-york       chicago      topeka 
  104      san-diego        2.5           1.8          1.4  ; 
  106  Scalar f      freight in dollars per case per thousand miles  /90/ ; 
  107  Scalar bmult  demand multiplier /1/; 
  109  Parameter c(i,j)  transport cost in thousands of dollars per case ; 
  111            c(i,j) = f * d(i,j) / 1000 ; 
  114       x(i,j)  shipment quantities in cases 
  115       z       total transportation costs in thousands of dollars ; 
  117  Positive Variable x ; 
  120       cost        define objective function 
  121       supply(i)   observe supply limit at plant i 
  122       demand(j)   satisfy demand at market j ; 
  124  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ; 
  126  supply(i) ..   sum(j, x(i,j))  =l=  a(i) ; 
  128  demand(j) ..   sum(i, x(i,j))  =g=  bmult*b(j) ; 
  130  Model transport /all/ ; 
 
GAMSModelInstance AddModelInstance(string modelInstanceName=null)
 
GAMSParameter AddParameter(string identifier, int dimension, string explanatoryText="")
 
void Run(GAMSOptions gamsOptions=null, GAMSCheckpoint checkpoint=null, TextWriter output=null, Boolean createOutDB=true)
 
void Instantiate(string modelDefinition, params GAMSModifier[] modifiers)
 
new GAMSParameterRecord AddRecord(params string[] keys)
 
GAMSJob AddJobFromString(string gamsSource, GAMSCheckpoint checkpoint=null, string jobName=null)
 
GAMSCheckpoint AddCheckpoint(string checkpointName=null)
 
GAMSOptions AddOptions(GAMSOptions optFrom=null)
 
This is the 7th model in a series of tutorial examples. Here we show: How to create a GAMSModelInstan...