42int main(
int argc,
char* argv[])
44 cout <<
"---------- Transport 13 --------------" << endl;
47 vector<string> plants {
"Seattle",
"San-Diego"};
48 vector<string> markets {
"New-York",
"Chicago",
"Topeka"};
49 map<string, double> capacity {
50 {
"Seattle", 350.0 }, {
"San-Diego", 600.0 }
52 map<string, double> demand {
53 {
"New-York", 325.0 }, {
"Chicago", 300.0 }, {
"Topeka", 275.0 }
55 map<tuple<string, string>,
double> distance {
56 { make_tuple(
"Seattle",
"New-York"), 2.5 },
57 { make_tuple(
"Seattle",
"Chicago"), 1.7 },
58 { make_tuple(
"Seattle",
"Topeka"), 1.8 },
59 { make_tuple(
"San-Diego",
"New-York"), 2.5 },
60 { make_tuple(
"San-Diego",
"Chicago"), 1.8 },
61 { make_tuple(
"San-Diego",
"Topeka"), 1.4 }
71 for (
string p : plants)
74 for (
string m : markets)
77 for (
string p : plants)
80 for (
string m : markets)
83 for (
auto dis : distance)
94 cout <<
"x(" << rec.key(0) <<
"," << rec.key(1) <<
"): level=" << rec.level() <<
95 " marginal=" << rec.marginal() << endl;
98 cout <<
"GAMSException occured: " << ex.what() << endl;
99 }
catch (exception &ex) {
100 cout << ex.what() << endl;
gams::GAMSSet j() const
j(j): markets
void run(gams::GAMSCheckpoint checkpoint, std::ostream &output)
Executes the trnsport model.
gams::GAMSParameter b() const
b(i): demand at market j in cases
gams::GAMSParameter f() const
f: freight in dollars per case per thousand miles
gams::GAMSVariable x() const
x(i,j): shipment quantities in cases
gams::GAMSParameter a() const
a(i): capacity of plant i in cases
gams::GAMSParameter d() const
d(i,j): distance in thousands of miles
gams::GAMSVariable z() const
z: total transportation costs in thousands of dollars
gams::GAMSOptions opt() const
Options for the execution of the trnsport model.
gams::GAMSSet i() const
i(i): canning plants
void setAllModelTypes(const std::string &solver)
void setValue(const double val)
GAMSParameterRecord addRecord(const std::vector< std::string > &keys)
GAMSSetRecord addRecord(const std::vector< std::string > &keys)
GAMSVariableRecord firstRecord(const std::vector< std::string > &slice)
void setSystemDirectory(const std::string &systemDir)
int main(int argc, char *argv[])
Wrapper class definition for GAMS trnsport model.