lemon-project-template-glpk
comparison src/main.cc @ 11:4fc6ad2fb8a6
Test GLPK in src/main.cc
author | Alpar Juttner <alpar@cs.elte.hu> |
---|---|
date | Sun, 06 Nov 2011 21:43:29 +0100 |
parents | c941f748eaa8 |
children |
comparison
equal
deleted
inserted
replaced
0:3ed4b8fb6f30 | 1:bdbb62eccc80 |
---|---|
14 * express or implied, and with no claim as to its suitability for any | 14 * express or implied, and with no claim as to its suitability for any |
15 * purpose. | 15 * purpose. |
16 * | 16 * |
17 */ | 17 */ |
18 | 18 |
19 #include<lemon/arg_parser.h> | |
19 #include<lemon/list_graph.h> | 20 #include<lemon/list_graph.h> |
21 #include<lemon/glpk.h> | |
20 | 22 |
21 ///The main entry point | 23 ///The main entry point |
22 int main() | 24 int main(int argc, char **argv) |
23 { | 25 { |
26 | |
27 lemon::ArgParser ap(argc,argv); | |
28 ap.run(); | |
29 | |
24 lemon::ListGraph g; | 30 lemon::ListGraph g; |
25 g.addNode(); | 31 g.addNode(); |
32 | |
33 typedef lemon::GlpkLp Solver; | |
34 Solver lp; | |
35 Solver::Col x = lp.addCol(); | |
36 Solver::Col y = lp.addCol(); | |
37 lp.colLowerBound(x,0); | |
38 lp.colLowerBound(y,0); | |
39 lp.addRow(3<=x+2*y<=10); | |
40 lp.obj(-4*x+3*y); | |
41 lp.max(); | |
42 lp.solve(); | |
43 | |
26 } | 44 } |