COIN-OR::LEMON - Graph Library

Changeset 1610:893dacc1866c in lemon-0.x


Ignore:
Timestamp:
08/01/05 23:16:08 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2116
Message:

A default LP solver is defined in lp.h

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • demo/lp_demo.cc

    r1577 r1610  
    2525/// interface read \ref lemon::LpSolverBase "this".
    2626
    27 #ifdef HAVE_CONFIG_H
    28 #include <config.h>
    29 #endif
     27#include <lemon/lp.h>
    3028
    3129#include <iostream>
    3230
    33 
    34 #ifdef HAVE_GLPK
    35 #include <lemon/lp_glpk.h>
    36 #elif HAVE_CPLEX
    37 #include <lemon/lp_cplex.h>
    38 #endif
    39 
    4031using namespace lemon;
    41 
    42 
    43 
    44 #ifdef HAVE_GLPK
    45 typedef LpGlpk LpDefault;
    46 const char default_solver_name[]="GLPK";
    47 #elif HAVE_CPLEX
    48 typedef LpCplex LpDefault;
    49 const char default_solver_name[]="CPLEX";
    50 #endif
    5132
    5233int main()
     
    5637
    5738  //A default solver is taken
    58   LpDefault lp;
    59   typedef LpDefault::Row Row;
    60   typedef LpDefault::Col Col;
     39  Lp lp;
     40  typedef Lp::Row Row;
     41  typedef Lp::Col Col;
    6142 
    6243
  • demo/lp_maxflow_demo.cc

    r1583 r1610  
    2424/// constraints that arise in graph theory in our library LEMON .
    2525
    26 #ifdef HAVE_CONFIG_H
    27 #include <config.h>
    28 #endif
    29 
    3026#include<lemon/graph_reader.h>
    3127#include<lemon/list_graph.h>
     28#include <lemon/lp.h>
    3229
    3330#include <fstream>
     
    3532
    3633
    37 #ifdef HAVE_GLPK
    38 #include <lemon/lp_glpk.h>
    39 #elif HAVE_CPLEX
    40 #include <lemon/lp_cplex.h>
    41 #endif
    4234
    4335using namespace lemon;
    44 
    45 #ifdef HAVE_GLPK
    46 typedef LpGlpk LpDefault;
    47 const char default_solver_name[]="GLPK";
    48 #elif HAVE_CPLEX
    49 typedef LpCplex LpDefault;
    50 const char default_solver_name[]="CPLEX";
    51 #endif
    52 
    5336
    5437template<class G,class C>
    5538double maxFlow(const G &g,const C &cap,typename G::Node s,typename G::Node t)
    5639{
    57   LpDefault lp;
     40  Lp lp;
    5841 
    5942  typedef G Graph;
     
    6649 
    6750  //Define a map on the edges for the variables of the LP problem
    68   typename G::template EdgeMap<LpDefault::Col> x(g);
     51  typename G::template EdgeMap<Lp::Col> x(g);
    6952  lp.addColSet(x);
    7053 
     
    7861  //Flow conservation constraints for the nodes (except for 's' and 't')
    7962  for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) {
    80     LpDefault::Expr ex;
     63    Lp::Expr ex;
    8164    for(InEdgeIt  e(g,n);e!=INVALID;++e) ex+=x[e];
    8265    for(OutEdgeIt e(g,n);e!=INVALID;++e) ex-=x[e];
     
    8568 
    8669  //Objective function: the flow value entering 't'
    87   LpDefault::Expr obj;
     70  Lp::Expr obj;
    8871  for(InEdgeIt  e(g,t);e!=INVALID;++e) obj+=x[e];
    8972  for(OutEdgeIt e(g,t);e!=INVALID;++e) obj-=x[e];
     
    9477  lp.max();
    9578
    96 #ifdef HAVE_GLPK
     79#if DEFAULT_LP==GLPK
    9780  lp.presolver(true);
    9881  lp.messageLevel(3);
  • lemon/lp_base.h

    r1542 r1610  
    2626#include<lemon/error.h>
    2727#include<lemon/invalid.h>
    28 
    29 //#include"lin_expr.h"
    3028
    3129///\file
Note: See TracChangeset for help on using the changeset viewer.