35Optimizer::Optimizer(
int argc,
char *argv[])
43double Optimizer::solve(
double mult)
50 GAMSJob gModJob = ws.addJobFromString(getModelText());
54 gModJob.
run(gOption, gDb);
59string Optimizer::getModelText()
62 " i canning plants / seattle, san-diego / \n"
63 " j markets / new-york, chicago, topeka / ; \n"
67 " a(i) capacity of plant i in cases \n"
71 " b(j) demand at market j in cases \n"
76 " Table d(i,j) distance in thousands of miles \n"
77 " new-york chicago topeka \n"
78 " seattle 2.5 1.7 1.8 \n"
79 " san-diego 2.5 1.8 1.4 ; \n"
81 " Scalar f freight in dollars per case per thousand miles; \n"
83 "$if not set gdxincname $abort 'no include file name for data file provided'\n"
84 "$gdxin %gdxincname% \n"
88 " Parameter c(i,j) transport cost in thousands of dollars per case ; \n"
90 " c(i,j) = f * d(i,j) / 1000 ; \n"
93 " x(i,j) shipment quantities in cases \n"
94 " z total transportation costs in thousands of dollars ; \n"
96 " Positive Variable x ; \n"
99 " cost define objective function \n"
100 " supply(i) observe supply limit at plant i \n"
101 " demand(j) satisfy demand at market j ; \n"
103 " cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ; \n"
105 " supply(i) .. sum(j, x(i,j)) =l= a(i) ; \n"
107 " demand(j) .. sum(i, x(i,j)) =g= b(j) ; \n"
109 " Model transport /all/ ; \n"
111 " Solve transport using lp minimizing z ; \n"
113 "Display x.l, x.m ; \n";
GAMSParameter addParameter(const std::string &name, const int dimension, const std::string &explanatoryText="")
GAMSVariable getVariable(const std::string &name)
void setDefine(const std::string &key, const std::string &value)
void setValue(const double val)
GAMSParameterRecord addRecord(const std::vector< std::string > &keys)
GAMSVariableRecord firstRecord(const std::vector< std::string > &slice)
void setSystemDirectory(std::string systemDir)
Wrapper class definition for executing transport14.