Changeset 1610:893dacc1866c in lemon0.x
 Timestamp:
 08/01/05 23:16:08 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2116
 Files:

 1 added
 3 edited
Legend:
 Unmodified
 Added
 Removed

demo/lp_demo.cc
r1577 r1610 25 25 /// interface read \ref lemon::LpSolverBase "this". 26 26 27 #ifdef HAVE_CONFIG_H 28 #include <config.h> 29 #endif 27 #include <lemon/lp.h> 30 28 31 29 #include <iostream> 32 30 33 34 #ifdef HAVE_GLPK35 #include <lemon/lp_glpk.h>36 #elif HAVE_CPLEX37 #include <lemon/lp_cplex.h>38 #endif39 40 31 using namespace lemon; 41 42 43 44 #ifdef HAVE_GLPK45 typedef LpGlpk LpDefault;46 const char default_solver_name[]="GLPK";47 #elif HAVE_CPLEX48 typedef LpCplex LpDefault;49 const char default_solver_name[]="CPLEX";50 #endif51 32 52 33 int main() … … 56 37 57 38 //A default solver is taken 58 Lp Defaultlp;59 typedef Lp Default::Row Row;60 typedef Lp Default::Col Col;39 Lp lp; 40 typedef Lp::Row Row; 41 typedef Lp::Col Col; 61 42 62 43 
demo/lp_maxflow_demo.cc
r1583 r1610 24 24 /// constraints that arise in graph theory in our library LEMON . 25 25 26 #ifdef HAVE_CONFIG_H27 #include <config.h>28 #endif29 30 26 #include<lemon/graph_reader.h> 31 27 #include<lemon/list_graph.h> 28 #include <lemon/lp.h> 32 29 33 30 #include <fstream> … … 35 32 36 33 37 #ifdef HAVE_GLPK38 #include <lemon/lp_glpk.h>39 #elif HAVE_CPLEX40 #include <lemon/lp_cplex.h>41 #endif42 34 43 35 using namespace lemon; 44 45 #ifdef HAVE_GLPK46 typedef LpGlpk LpDefault;47 const char default_solver_name[]="GLPK";48 #elif HAVE_CPLEX49 typedef LpCplex LpDefault;50 const char default_solver_name[]="CPLEX";51 #endif52 53 36 54 37 template<class G,class C> 55 38 double maxFlow(const G &g,const C &cap,typename G::Node s,typename G::Node t) 56 39 { 57 Lp Defaultlp;40 Lp lp; 58 41 59 42 typedef G Graph; … … 66 49 67 50 //Define a map on the edges for the variables of the LP problem 68 typename G::template EdgeMap<Lp Default::Col> x(g);51 typename G::template EdgeMap<Lp::Col> x(g); 69 52 lp.addColSet(x); 70 53 … … 78 61 //Flow conservation constraints for the nodes (except for 's' and 't') 79 62 for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) { 80 Lp Default::Expr ex;63 Lp::Expr ex; 81 64 for(InEdgeIt e(g,n);e!=INVALID;++e) ex+=x[e]; 82 65 for(OutEdgeIt e(g,n);e!=INVALID;++e) ex=x[e]; … … 85 68 86 69 //Objective function: the flow value entering 't' 87 Lp Default::Expr obj;70 Lp::Expr obj; 88 71 for(InEdgeIt e(g,t);e!=INVALID;++e) obj+=x[e]; 89 72 for(OutEdgeIt e(g,t);e!=INVALID;++e) obj=x[e]; … … 94 77 lp.max(); 95 78 96 #if def HAVE_GLPK79 #if DEFAULT_LP==GLPK 97 80 lp.presolver(true); 98 81 lp.messageLevel(3); 
lemon/lp_base.h
r1542 r1610 26 26 #include<lemon/error.h> 27 27 #include<lemon/invalid.h> 28 29 //#include"lin_expr.h"30 28 31 29 ///\file
Note: See TracChangeset
for help on using the changeset viewer.