Enable/disable options for LP/MIP backends (#465)
authorAlpar Juttner <alpar@cs.elte.hu>
Sat, 25 May 2013 06:59:31 +0200 (2013-05-25)
changeset 1064fc3854d936f7
parent 1063 1782aa72495a
child 1065 490d89913a17
Enable/disable options for LP/MIP backends (#465)
CMakeLists.txt
INSTALL
cmake/FindCOIN.cmake
cmake/FindGLPK.cmake
cmake/FindILOG.cmake
lemon/cbc.h
lemon/config.h.in
lemon/lp.h
test/lp_test.cc
     1.1 --- a/CMakeLists.txt	Fri Jul 20 17:09:01 2012 +0200
     1.2 +++ b/CMakeLists.txt	Sat May 25 06:59:31 2013 +0200
     1.3 @@ -61,9 +61,64 @@
     1.4  
     1.5  FIND_PACKAGE(Doxygen)
     1.6  FIND_PACKAGE(Ghostscript)
     1.7 -FIND_PACKAGE(GLPK 4.33)
     1.8 -FIND_PACKAGE(ILOG)
     1.9 -FIND_PACKAGE(COIN)
    1.10 +
    1.11 +SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
    1.12 +SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
    1.13 +SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
    1.14 +
    1.15 +IF(LEMON_ENABLE_GLPK) 
    1.16 +  FIND_PACKAGE(GLPK 4.33)
    1.17 +ENDIF(LEMON_ENABLE_GLPK)
    1.18 +IF(LEMON_ENABLE_ILOG)
    1.19 +  FIND_PACKAGE(ILOG)
    1.20 +ENDIF(LEMON_ENABLE_ILOG)
    1.21 +IF(LEMON_ENABLE_COIN)
    1.22 +  FIND_PACKAGE(COIN)
    1.23 +ENDIF(LEMON_ENABLE_COIN)
    1.24 +
    1.25 +IF(GLPK_FOUND)
    1.26 +  SET(LEMON_HAVE_LP TRUE)
    1.27 +  SET(LEMON_HAVE_MIP TRUE)
    1.28 +  SET(LEMON_HAVE_GLPK TRUE)
    1.29 +ENDIF(GLPK_FOUND)
    1.30 +IF(ILOG_FOUND)
    1.31 +  SET(LEMON_HAVE_LP TRUE)
    1.32 +  SET(LEMON_HAVE_MIP TRUE)
    1.33 +  SET(LEMON_HAVE_ILOG TRUE)
    1.34 +ENDIF(ILOG_FOUND)
    1.35 +IF(COIN_FOUND)
    1.36 +  SET(LEMON_HAVE_LP TRUE)
    1.37 +  SET(LEMON_HAVE_MIP TRUE)
    1.38 +  SET(LEMON_HAVE_CLP TRUE)
    1.39 +  SET(LEMON_HAVE_CBC TRUE)
    1.40 +ENDIF(COIN_FOUND)
    1.41 +
    1.42 +IF(ILOG_FOUND)
    1.43 +  SET(DEFAULT_LP "CPLEX")
    1.44 +  SET(DEFAULT_MIP "CPLEX")
    1.45 +ELSEIF(COIN_FOUND)
    1.46 +  SET(DEFAULT_LP "CLP")
    1.47 +  SET(DEFAULT_MIP "CBC")
    1.48 +ELSEIF(GLPK_FOUND)
    1.49 +  SET(DEFAULT_LP "GLPK")
    1.50 +  SET(DEFAULT_MIP "GLPK")
    1.51 +ENDIF()
    1.52 +
    1.53 +IF(NOT LEMON_DEFAULT_LP OR
    1.54 +    (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
    1.55 +    (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
    1.56 +    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")))
    1.57 +  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    1.58 +    "Default LP solver backend (GLPK, CPLEX or CLP)" FORCE)
    1.59 +ENDIF()
    1.60 +IF(NOT LEMON_DEFAULT_MIP OR
    1.61 +    (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
    1.62 +    (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
    1.63 +    (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
    1.64 +  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
    1.65 +    "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
    1.66 +ENDIF()
    1.67 +
    1.68  
    1.69  IF(DEFINED ENV{LEMON_CXX_WARNING})
    1.70    SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
     2.1 --- a/INSTALL	Fri Jul 20 17:09:01 2012 +0200
     2.2 +++ b/INSTALL	Sat May 25 06:59:31 2013 +0200
     2.3 @@ -106,11 +106,57 @@
     2.4    Build shared library instead of static one. Think twice if you
     2.5    really want to use this option.
     2.6  
     2.7 +-DLEMON_DOC_SOURCE_BROWSER=YES
     2.8 +
     2.9 +  Include the browsable cross referenced LEMON source code into the
    2.10 +  doc. It makes the doc quite bloated, but may be useful for
    2.11 +  developing LEMON itself.
    2.12 +
    2.13 +-DLEMON_DOC_USE_MATHJAX=YES
    2.14 +
    2.15 +  Use MathJax (http://mathjax.org) for rendering the math formulae in
    2.16 +  the doc.  It of much higher quality compared to the default LaTeX
    2.17 +  generated static images and it allows copy&paste of the formulae to
    2.18 +  LaTeX, Open Office, MS Word etc. documents.
    2.19 +
    2.20 +  On the other hand, it needs either Internet access or a locally
    2.21 +  installed version of MathJax to properly render the doc.
    2.22 +
    2.23 +-DLEMON_DOC_MATHJAX_RELPATH=DIRECTORY
    2.24 +  
    2.25 +  The location of the MathJax library. It defaults to
    2.26 +  http://www.mathjax.org/mathjax, which necessitates Internet access
    2.27 +  for proper rendering. The easiest way to make it usable offline is
    2.28 +  to set this parameter to 'mathjax' and copy all files of the MathJax
    2.29 +  library into the 'doc/html/mathjax' subdirectory of the build
    2.30 +  location.
    2.31 +
    2.32 +  See http://docs.mathjax.org/en/latest/installation.html for more details.
    2.33 +
    2.34 +  
    2.35 +-DLEMON_ENABLE_GLPK=NO
    2.36 +-DLEMON_ENABLE_COIN=NO
    2.37 +-DLEMON_ENABLE_ILOG=NO
    2.38 +
    2.39 +  Enable optional third party libraries. They are all enabled by default. 
    2.40 +
    2.41 +-DLEMON_DEFAULT_LP=GLPK
    2.42 +
    2.43 +  Sets the default LP solver backend. The supported values are
    2.44 +  CPLEX, CLP and GLPK. By default, it is set to the first one which
    2.45 +  is enabled and succesfully discovered.
    2.46 +
    2.47 +-DLEMON_DEFAULT_MIP=GLPK
    2.48 +
    2.49 +  Sets the default MIP solver backend. The supported values are
    2.50 +  CPLEX, CBC and GLPK. By default, it is set to the first one which
    2.51 +  is enabled and succesfully discovered.
    2.52 +
    2.53  -DGLPK_ROOT_DIR=DIRECTORY
    2.54  -DCOIN_ROOT_DIR=DIRECTORY
    2.55  -DILOG_ROOT_DIR=DIRECTORY
    2.56  
    2.57 -  Install root directory prefixes of optional third party libraries.
    2.58 +  Root directory prefixes of optional third party libraries.
    2.59  
    2.60  Makefile Variables
    2.61  ==================
     3.1 --- a/cmake/FindCOIN.cmake	Fri Jul 20 17:09:01 2012 +0200
     3.2 +++ b/cmake/FindCOIN.cmake	Sat May 25 06:59:31 2013 +0200
     3.3 @@ -108,10 +108,3 @@
     3.4    COIN_ZLIB_LIBRARY
     3.5    COIN_BZ2_LIBRARY
     3.6  )
     3.7 -
     3.8 -IF(COIN_FOUND)
     3.9 -  SET(LEMON_HAVE_LP TRUE)
    3.10 -  SET(LEMON_HAVE_MIP TRUE)
    3.11 -  SET(LEMON_HAVE_CLP TRUE)
    3.12 -  SET(LEMON_HAVE_CBC TRUE)
    3.13 -ENDIF(COIN_FOUND)
     4.1 --- a/cmake/FindGLPK.cmake	Fri Jul 20 17:09:01 2012 +0200
     4.2 +++ b/cmake/FindGLPK.cmake	Sat May 25 06:59:31 2013 +0200
     4.3 @@ -53,10 +53,3 @@
     4.4  ENDIF(GLPK_FOUND)
     4.5  
     4.6  MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
     4.7 -
     4.8 -IF(GLPK_FOUND)
     4.9 -  SET(LEMON_HAVE_LP TRUE)
    4.10 -  SET(LEMON_HAVE_MIP TRUE)
    4.11 -  SET(LEMON_HAVE_GLPK TRUE)
    4.12 -ENDIF(GLPK_FOUND)
    4.13 -
     5.1 --- a/cmake/FindILOG.cmake	Fri Jul 20 17:09:01 2012 +0200
     5.2 +++ b/cmake/FindILOG.cmake	Sat May 25 06:59:31 2013 +0200
     5.3 @@ -100,9 +100,3 @@
     5.4    ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
     5.5    ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL
     5.6    )
     5.7 -
     5.8 -IF(ILOG_FOUND)
     5.9 -  SET(LEMON_HAVE_LP TRUE)
    5.10 -  SET(LEMON_HAVE_MIP TRUE)
    5.11 -  SET(LEMON_HAVE_CPLEX TRUE)
    5.12 -ENDIF(ILOG_FOUND)
     6.1 --- a/lemon/cbc.h	Fri Jul 20 17:09:01 2012 +0200
     6.2 +++ b/lemon/cbc.h	Sat May 25 06:59:31 2013 +0200
     6.3 @@ -16,7 +16,6 @@
     6.4   *
     6.5   */
     6.6  
     6.7 -// -*- C++ -*-
     6.8  #ifndef LEMON_CBC_H
     6.9  #define LEMON_CBC_H
    6.10  
     7.1 --- a/lemon/config.h.in	Fri Jul 20 17:09:01 2012 +0200
     7.2 +++ b/lemon/config.h.in	Sat May 25 06:59:31 2013 +0200
     7.3 @@ -6,5 +6,7 @@
     7.4  #cmakedefine LEMON_HAVE_CPLEX 1
     7.5  #cmakedefine LEMON_HAVE_CLP 1
     7.6  #cmakedefine LEMON_HAVE_CBC 1
     7.7 +#cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@
     7.8 +#cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@
     7.9  #cmakedefine LEMON_USE_PTHREAD 1
    7.10  #cmakedefine LEMON_USE_WIN32_THREADS 1
     8.1 --- a/lemon/lp.h	Fri Jul 20 17:09:01 2012 +0200
     8.2 +++ b/lemon/lp.h	Sat May 25 06:59:31 2013 +0200
     8.3 @@ -59,32 +59,31 @@
     8.4    ///The default MIP solver identifier.
     8.5    ///\ingroup lp_group
     8.6    ///
     8.7 -  ///Currently, the possible values are \c GLPK or \c CPLEX
     8.8 +  ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC
     8.9  #define LEMON_DEFAULT_MIP SOLVER
    8.10    ///The default MIP solver.
    8.11  
    8.12    ///The default MIP solver.
    8.13    ///\ingroup lp_group
    8.14    ///
    8.15 -  ///Currently, it is either \c GlpkMip or \c CplexMip
    8.16 +  ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip
    8.17    typedef GlpkMip Mip;
    8.18  #else
    8.19 -#ifdef LEMON_HAVE_GLPK
    8.20 -# define LEMON_DEFAULT_LP GLPK
    8.21 +#if LEMON_DEFAULT_LP == GLPK
    8.22    typedef GlpkLp Lp;
    8.23 -# define LEMON_DEFAULT_MIP GLPK
    8.24 -  typedef GlpkMip Mip;
    8.25 -#elif LEMON_HAVE_CPLEX
    8.26 -# define LEMON_DEFAULT_LP CPLEX
    8.27 +#elif LEMON_DEFAULT_LP == CPLEX
    8.28    typedef CplexLp Lp;
    8.29 -# define LEMON_DEFAULT_MIP CPLEX
    8.30 +#elif LEMON_DEFAULT_LP == SOPLEX
    8.31 +  typedef SoplexLp Lp;
    8.32 +#elif LEMON_DEFAULT_LP == CLP
    8.33 +  typedef ClpLp Lp;
    8.34 +#endif
    8.35 +#if LEMON_DEFAULT_MIP == GLPK
    8.36 +  typedef GlpkLp Mip;
    8.37 +#elif LEMON_DEFAULT_MIP == CPLEX
    8.38    typedef CplexMip Mip;
    8.39 -#elif LEMON_HAVE_SOPLEX
    8.40 -# define DEFAULT_LP SOPLEX
    8.41 -  typedef SoplexLp Lp;
    8.42 -#elif LEMON_HAVE_CLP
    8.43 -# define DEFAULT_LP CLP
    8.44 -  typedef ClpLp Lp;
    8.45 +#elif LEMON_DEFAULT_MIP == CBC
    8.46 +  typedef CbcMip Mip;
    8.47  #endif
    8.48  #endif
    8.49  
     9.1 --- a/test/lp_test.cc	Fri Jul 20 17:09:01 2012 +0200
     9.2 +++ b/test/lp_test.cc	Sat May 25 06:59:31 2013 +0200
     9.3 @@ -240,8 +240,7 @@
     9.4  
     9.5    {
     9.6      LP::DualExpr e,f,g;
     9.7 -    LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID,
     9.8 -      p4 = INVALID, p5 = INVALID;
     9.9 +    LP::Row p1 = INVALID, p2 = INVALID;
    9.10  
    9.11      e[p1]=2;
    9.12      e[p1]+=2;