Add presolver() to turn on/off the GLPK presolver
authoralpar
Fri, 08 Apr 2005 14:40:37 +0000
changeset 132685f1c483279e
parent 1325 916ec8699dc3
child 1327 ecc1cdea2ee7
Add presolver() to turn on/off the GLPK presolver
src/demo/lp_demo.cc
src/lemon/lp_glpk.cc
src/lemon/lp_glpk.h
     1.1 --- a/src/demo/lp_demo.cc	Fri Apr 08 14:21:40 2005 +0000
     1.2 +++ b/src/demo/lp_demo.cc	Fri Apr 08 14:40:37 2005 +0000
     1.3 @@ -38,6 +38,11 @@
     1.4      lp.setObj(ex);
     1.5    }
     1.6    lp.max();
     1.7 +
     1.8 +  lp.presolver(true);
     1.9 +  
    1.10 +  lp.messageLevel(3);
    1.11 +
    1.12    lp.solve();
    1.13  
    1.14    return lp.primalValue();
    1.15 @@ -45,13 +50,10 @@
    1.16  
    1.17  int main() 
    1.18  {
    1.19 -  LpGlpk lp_glpk;
    1.20 -
    1.21    ListGraph g;
    1.22    ListGraph::Node s;
    1.23    ListGraph::Node t;
    1.24    
    1.25 -
    1.26    ListGraph::EdgeMap<double> cap(g);
    1.27    
    1.28    GraphReader<ListGraph> reader(std::cin,g);
     2.1 --- a/src/lemon/lp_glpk.cc	Fri Apr 08 14:21:40 2005 +0000
     2.2 +++ b/src/lemon/lp_glpk.cc	Fri Apr 08 14:40:37 2005 +0000
     2.3 @@ -313,6 +313,11 @@
     2.4      lpx_set_int_parm(lp, LPX_K_MSGLEV, m);
     2.5    }
     2.6  
     2.7 +  void LpGlpk::presolver(bool b)
     2.8 +  {
     2.9 +    lpx_set_int_parm(lp, LPX_K_PRESOL, b);
    2.10 +  }
    2.11 +
    2.12   
    2.13  } //END OF NAMESPACE LEMON
    2.14  
     3.1 --- a/src/lemon/lp_glpk.h	Fri Apr 08 14:21:40 2005 +0000
     3.2 +++ b/src/lemon/lp_glpk.h	Fri Apr 08 14:40:37 2005 +0000
     3.3 @@ -22,7 +22,7 @@
     3.4  
     3.5  #include "lp_base.h"
     3.6  extern "C" {
     3.7 -#include "glpk.h"
     3.8 +#include <glpk.h>
     3.9  }
    3.10  
    3.11  namespace lemon {
    3.12 @@ -76,6 +76,8 @@
    3.13    public:
    3.14      ///Set the verbosity of the messages
    3.15  
    3.16 +    ///Set the verbosity of the messages
    3.17 +    ///
    3.18      ///\param m is the level of the messages output by the solver routines.
    3.19      ///The possible values are:
    3.20      ///- 0 --- no output (default value)
    3.21 @@ -83,6 +85,12 @@
    3.22      ///- 2 --- normal output
    3.23      ///- 3 --- full output (includes informational messages)
    3.24      void messageLevel(int m);
    3.25 +    ///Turns on or off the presolver
    3.26 +
    3.27 +    ///Turns on (\c b is \c true) or off (\c b is \c false) the presolver
    3.28 +    ///
    3.29 +    ///The presolver is off by default.
    3.30 +    void presolver(bool b);
    3.31      
    3.32    };
    3.33  } //END OF NAMESPACE LEMON