lemon-project-template-glpk

diff 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
line diff
     1.1 --- a/src/main.cc	Sun Nov 06 21:42:23 2011 +0100
     1.2 +++ b/src/main.cc	Sun Nov 06 21:43:29 2011 +0100
     1.3 @@ -16,11 +16,29 @@
     1.4   *
     1.5   */
     1.6  
     1.7 +#include<lemon/arg_parser.h>
     1.8  #include<lemon/list_graph.h>
     1.9 +#include<lemon/glpk.h>
    1.10  
    1.11  ///The main entry point
    1.12 -int main()
    1.13 +int main(int argc, char **argv)
    1.14  {
    1.15 +
    1.16 +  lemon::ArgParser ap(argc,argv);
    1.17 +  ap.run();
    1.18 +
    1.19    lemon::ListGraph g;
    1.20    g.addNode();
    1.21 +  
    1.22 +  typedef lemon::GlpkLp Solver;
    1.23 +  Solver lp;
    1.24 +  Solver::Col x = lp.addCol();
    1.25 +  Solver::Col y = lp.addCol();
    1.26 +  lp.colLowerBound(x,0);
    1.27 +  lp.colLowerBound(y,0);
    1.28 +  lp.addRow(3<=x+2*y<=10);
    1.29 +  lp.obj(-4*x+3*y);
    1.30 +  lp.max();
    1.31 +  lp.solve();
    1.32 +
    1.33  }