#include #include #include // use this for CPLEX //#include // use this for GLPK using namespace std; using namespace lemon; int main() { typedef CplexLp LP; // use this for CPLEX // typedef GlpkLp LP; // use this for GLPK // typedef Lp LP; // use this for the default LP solver LP lp; LP::Col x1 = lp.addCol(); LP::Col x2 = lp.addCol(); lp.addRow(0 <= x1 + x2 <= 100); lp.addRow(2 * x1 <= x2 + 32); lp.colLowerBound(x1, 0); lp.colUpperBound(x2, 100); lp.max(); lp.obj(10 * x1 + 6 * x2); lp.solve(); cout << "Objective function value: " << lp.primal() << endl; cout << "x1 = " << lp.primal(x1) << endl; cout << "x2 = " << lp.primal(x2) << endl; return 0; }