1 | #include <iostream>
|
---|
2 | #include <lemon/lp.h>
|
---|
3 |
|
---|
4 | using namespace std;
|
---|
5 | using namespace lemon;
|
---|
6 |
|
---|
7 | int main() {
|
---|
8 | Lp lp;
|
---|
9 |
|
---|
10 | Lp::Col x1 = lp.addCol();
|
---|
11 | Lp::Col x2 = lp.addCol();
|
---|
12 |
|
---|
13 | lp.addRow(x1 <= 10);
|
---|
14 | lp.addRow(x2 <= 20);
|
---|
15 |
|
---|
16 | lp.obj(x1 + x2);
|
---|
17 | lp.max();
|
---|
18 |
|
---|
19 | lp.solve();
|
---|
20 |
|
---|
21 | cout << "Primal status: " << lp.primalStatus() << endl;
|
---|
22 | cout << "Primal objective value: " << lp.primalValue() << endl << endl;
|
---|
23 |
|
---|
24 | cout << "Primal value of the columns:" << endl;
|
---|
25 | cout << "x1 = " << lp.primal(x1) << endl;
|
---|
26 | cout << "x2 = " << lp.primal(x2) << endl;
|
---|
27 |
|
---|
28 | return 0;
|
---|
29 | }
|
---|