diff -r f83d5d39469a -r 893dacc1866c demo/lp_maxflow_demo.cc --- a/demo/lp_maxflow_demo.cc Mon Aug 01 20:20:43 2005 +0000 +++ b/demo/lp_maxflow_demo.cc Mon Aug 01 21:16:08 2005 +0000 @@ -23,38 +23,21 @@ /// the emphasis on the simplicity of the way one can formulate LP /// constraints that arise in graph theory in our library LEMON . -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include +#include #include #include -#ifdef HAVE_GLPK -#include -#elif HAVE_CPLEX -#include -#endif using namespace lemon; -#ifdef HAVE_GLPK -typedef LpGlpk LpDefault; -const char default_solver_name[]="GLPK"; -#elif HAVE_CPLEX -typedef LpCplex LpDefault; -const char default_solver_name[]="CPLEX"; -#endif - - template double maxFlow(const G &g,const C &cap,typename G::Node s,typename G::Node t) { - LpDefault lp; + Lp lp; typedef G Graph; typedef typename G::Node Node; @@ -65,7 +48,7 @@ typedef typename G::InEdgeIt InEdgeIt; //Define a map on the edges for the variables of the LP problem - typename G::template EdgeMap x(g); + typename G::template EdgeMap x(g); lp.addColSet(x); //Nonnegativity and capacity constraints @@ -77,14 +60,14 @@ //Flow conservation constraints for the nodes (except for 's' and 't') for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) { - LpDefault::Expr ex; + Lp::Expr ex; for(InEdgeIt e(g,n);e!=INVALID;++e) ex+=x[e]; for(OutEdgeIt e(g,n);e!=INVALID;++e) ex-=x[e]; lp.addRow(ex==0); } //Objective function: the flow value entering 't' - LpDefault::Expr obj; + Lp::Expr obj; for(InEdgeIt e(g,t);e!=INVALID;++e) obj+=x[e]; for(OutEdgeIt e(g,t);e!=INVALID;++e) obj-=x[e]; lp.setObj(obj); @@ -93,7 +76,7 @@ //Maximization lp.max(); -#ifdef HAVE_GLPK +#if DEFAULT_LP==GLPK lp.presolver(true); lp.messageLevel(3); #endif