src/demo/lp_demo.cc
changeset 1381 998e8def9676
parent 1362 b4330c52caeb
child 1387 37d1b20cd9ef
equal deleted inserted replaced
3:a5bbfad64609 4:e5230ea2ef55
     1 #include <iostream>
     1 #include <iostream>
       
     2 
       
     3 
       
     4 #ifdef HAVE_GLPK
     2 #include <lemon/lp_glpk.h>
     5 #include <lemon/lp_glpk.h>
       
     6 #elif HAVE_CPLEX
       
     7 #include <lemon/lp_cplex.h>
       
     8 #endif
       
     9 
     3 using namespace lemon;
    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 int main()
    18 int main()
     6 {     
    19 {     
     7  //The following example is taken from the documentation of the GLPK library.
    20  //The following example is taken from the documentation of the GLPK library.
     8  //See it in the GLPK reference manual and among the GLPK sample files (sample.c)
    21  //See it in the GLPK reference manual and among the GLPK sample files (sample.c)
     9   LpGlpk lp;
    22   LpDefault lp;
    10   typedef LpGlpk::Row Row;
    23   typedef LpDefault::Row Row;
    11   typedef LpGlpk::Col Col;
    24   typedef LpDefault::Col Col;
    12 
    25 
    13   lp.max();
    26   lp.max();
    14 
    27 
    15   Col x1 = lp.addCol();
    28   Col x1 = lp.addCol();
    16   Col x2 = lp.addCol();
    29   Col x2 = lp.addCol();