Changeset 1381:998e8def9676 in lemon-0.x
- Timestamp:
- 04/22/05 19:47:01 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1834
- Location:
- src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/demo/Makefile.am
r1362 r1381 1 1 AM_CPPFLAGS = -I$(top_srcdir)/src 2 2 LDADD = $(top_builddir)/src/lemon/libemon.la 3 4 if HAVE_GLPK 5 LP_CFLAGS = $(GLPK_CFLAGS) -DHAVE_GLPK 6 LP_LIBS = $(GLPK_LIBS) 7 else !HAVE_GLPK 8 if HAVE_CPLEX 9 LP_CFLAGS = $(CPLEX_CFLAGS) -DHAVE_CPLEX 10 LP_LIBS = $(CPLEX_LIBS) 11 endif HAVE_CPLEX 12 endif !HAVE_GLPK 13 3 14 4 15 EXTRA_DIST = sub_graph_wrapper_demo.dim … … 13 24 if HAVE_GLPK 14 25 noinst_PROGRAMS += lp_demo lp_maxflow_demo 15 endif 26 else !HAVE_GLPK 27 if HAVE_CPLEX 28 noinst_PROGRAMS += lp_demo lp_maxflow_demo 29 endif HAVE_CPLEX 30 endif !HAVE_GLPK 31 16 32 17 33 dim_to_dot_SOURCES = dim_to_dot.cc … … 28 44 29 45 lp_demo_SOURCES = lp_demo.cc 30 lp_demo_CXXFLAGS = $( GLPK_CFLAGS)31 lp_demo_LDFLAGS = $( GLPK_LIBS)46 lp_demo_CXXFLAGS = $(LP_CFLAGS) 47 lp_demo_LDFLAGS = $(LP_LIBS) 32 48 33 49 lp_maxflow_demo_SOURCES = lp_maxflow_demo.cc 34 lp_maxflow_demo_CXXFLAGS = $( GLPK_CFLAGS)35 lp_maxflow_demo_LDFLAGS = $( GLPK_LIBS)50 lp_maxflow_demo_CXXFLAGS = $(LP_CFLAGS) 51 lp_maxflow_demo_LDFLAGS = $(LP_LIBS) -
src/demo/lp_demo.cc
r1362 r1381 1 1 #include <iostream> 2 3 4 #ifdef HAVE_GLPK 2 5 #include <lemon/lp_glpk.h> 6 #elif HAVE_CPLEX 7 #include <lemon/lp_cplex.h> 8 #endif 9 3 10 using namespace lemon; 11 12 #ifdef HAVE_GLPK 13 typedef LpGlpk LpDefault; 14 #elif HAVE_CPLEX 15 typedef LpCplex LpDefault; 16 #endif 4 17 5 18 int main() … … 7 20 //The following example is taken from the documentation of the GLPK library. 8 21 //See it in the GLPK reference manual and among the GLPK sample files (sample.c) 9 Lp Glpklp;10 typedef Lp Glpk::Row Row;11 typedef Lp Glpk::Col Col;22 LpDefault lp; 23 typedef LpDefault::Row Row; 24 typedef LpDefault::Col Col; 12 25 13 26 lp.max(); -
src/demo/lp_maxflow_demo.cc
r1361 r1381 1 #include<lemon/lp_glpk.h>2 1 #include<lemon/graph_reader.h> 3 2 #include<lemon/list_graph.h> 4 3 4 5 #ifdef HAVE_GLPK 6 #include <lemon/lp_glpk.h> 7 #elif HAVE_CPLEX 8 #include <lemon/lp_cplex.h> 9 #endif 10 5 11 using namespace lemon; 12 13 #ifdef HAVE_GLPK 14 typedef LpGlpk LpDefault; 15 #elif HAVE_CPLEX 16 typedef LpCplex LpDefault; 17 #endif 18 6 19 7 20 template<class G,class C> 8 21 double maxFlow(const G &g,const C &cap,typename G::Node s,typename G::Node t) 9 22 { 10 Lp Glpklp;23 LpDefault lp; 11 24 12 25 typedef G Graph; … … 18 31 typedef typename G::InEdgeIt InEdgeIt; 19 32 20 typename G::template EdgeMap<Lp Glpk::Col> x(g);33 typename G::template EdgeMap<LpDefault::Col> x(g); 21 34 lp.addColSet(x); 22 35 … … 27 40 28 41 for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) { 29 Lp Glpk::Expr ex;42 LpDefault::Expr ex; 30 43 for(InEdgeIt e(g,n);e!=INVALID;++e) ex+=x[e]; 31 44 for(OutEdgeIt e(g,n);e!=INVALID;++e) ex-=x[e]; … … 33 46 } 34 47 { 35 Lp Glpk::Expr ex;48 LpDefault::Expr ex; 36 49 for(InEdgeIt e(g,t);e!=INVALID;++e) ex+=x[e]; 37 50 for(OutEdgeIt e(g,t);e!=INVALID;++e) ex-=x[e]; … … 40 53 lp.max(); 41 54 55 #ifdef HAVE_GLPK 42 56 lp.presolver(true); 43 44 57 lp.messageLevel(3); 58 #endif 45 59 46 60 lp.solve(); -
src/lemon/Makefile.am
r1378 r1381 14 14 libemon_la_CXXFLAGS = $(GLPK_CFLAGS) 15 15 libemon_la_LDFLAGS = $(GLPK_LIBS) 16 endif 17 18 if HAVE_CPLEX 19 libemon_la_SOURCES += lp_cplex.cc 20 libemon_la_CXXFLAGS = $(CPLEX_CFLAGS) 21 libemon_la_LDFLAGS = $(CPLEX_LIBS) 16 22 endif 17 23 … … 33 39 list_graph.h \ 34 40 lp_base.h \ 41 lp_cplex.h \ 35 42 lp_glpk.h \ 36 43 lp_skeleton.h \ -
src/lemon/lp_base.h
r1379 r1381 465 465 ///Creates a new LP problem 466 466 LpSolverBase &newLp() {return _newLp();} 467 ///Make a copy of the LP problem467 ///Makes a copy of the LP problem 468 468 LpSolverBase ©Lp() {return _copyLp();} 469 469
Note: See TracChangeset
for help on using the changeset viewer.