COIN-OR::LEMON - Graph Library

Ticket #324: lp_test_0x.cpp

File lp_test_0x.cpp, 592 bytes (added by Peter Kovacs, 14 years ago)
Line 
1#include <iostream>
2#include <lemon/lp.h>
3
4using namespace std;
5using namespace lemon;
6
7int 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}