2using System.Collections.Generic;
 
   25        static void Main(
string[] args)
 
   28            if (Environment.GetCommandLineArgs().Length > 1)
 
   29                ws = 
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
 
   42                opt.
Defines.Add(
"gdxincname", 
"tdata");
 
   43                opt.AllModelTypes = 
"xpress";
 
   46                    Console.WriteLine(
"x(" + rec.Key(0) + 
"," + rec.Key(1) + 
"): level=" + rec.
Level + 
" marginal=" + rec.
Marginal);
 
   56                opt.AllModelTypes = 
"xpress";
 
   59                    Console.WriteLine(
"x(" + rec.Key(0) + 
"," + rec.Key(1) + 
"): level=" + rec.
Level + 
" marginal=" + rec.
Marginal);
 
   64        static String GetDataText()
 
   68       i   canning plants   / seattle, san-diego / 
   69       j   markets          / new-york, chicago, topeka / ; 
   73       a(i)  capacity of plant i in cases 
   77       b(j)  demand at market j in cases 
   82  Table d(i,j)  distance in thousands of miles 
   83                    new-york       chicago      topeka 
   85      san-diego        2.5           1.8          1.4  ; 
   87  Scalar f  freight in dollars per case per thousand miles  /90/ ; 
   92        static String GetModelText()
 
  100       a(i)   capacity of plant i in cases 
  101       b(j)   demand at market j in cases 
  102       d(i,j) distance in thousands of miles 
  103  Scalar f  freight in dollars per case per thousand miles; 
  105$if not set gdxincname $abort 'no include file name for data file provided' 
  110  Parameter c(i,j)  transport cost in thousands of dollars per case ; 
  112            c(i,j) = f * d(i,j) / 1000 ; 
  115       x(i,j)  shipment quantities in cases 
  116       z       total transportation costs in thousands of dollars ; 
  118  Positive Variable x ; 
  121       cost        define objective function 
  122       supply(i)   observe supply limit at plant i 
  123       demand(j)   satisfy demand at market j ; 
  125  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ; 
  127  supply(i) ..   sum(j, x(i,j))  =l=  a(i) ; 
  129  demand(j) ..   sum(i, x(i,j))  =g=  b(j) ; 
  131  Model transport /all/ ; 
  133  Solve transport using lp minimizing z ; 
 
GAMSVariable GetVariable(string variableIdentifier)
 
void Export(string filePath=null)
 
void Run(GAMSOptions gamsOptions=null, GAMSCheckpoint checkpoint=null, TextWriter output=null, Boolean createOutDB=true)
 
Dictionary< string, string > Defines
 
GAMSJob AddJobFromString(string gamsSource, GAMSCheckpoint checkpoint=null, string jobName=null)
 
GAMSOptions AddOptions(GAMSOptions optFrom=null)
 
This is the 3rd model in a series of tutorial examples. Here we show: How to read data from string an...