COIN-OR::LEMON - Graph Library

Ticket #465: 561cac8fe04f.patch

File 561cac8fe04f.patch, 6.3 KB (added by Alpar Juttner, 11 years ago)
  • CMakeLists.txt

    # HG changeset patch
    # User Alpar Juttner <alpar@cs.elte.hu>
    # Date 1369457971 -7200
    # Node ID 561cac8fe04f8e46f5324eae58a551016cc222db
    # Parent  473c71baff72fa87fce601589e9ac07e88c3e98d
    Enable/disable options for LP/MIP backends (#465)
    
    diff --git a/CMakeLists.txt b/CMakeLists.txt
    a b  
    6161
    6262FIND_PACKAGE(Doxygen)
    6363FIND_PACKAGE(Ghostscript)
    64 FIND_PACKAGE(GLPK 4.33)
    65 FIND_PACKAGE(CPLEX)
    66 FIND_PACKAGE(COIN)
     64
     65SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
     66SET(LEMON_ENABLE_CPLEX YES CACHE STRING "Enable CPLEX solver backend.")
     67SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
     68
     69IF(LEMON_ENABLE_GLPK)
     70  FIND_PACKAGE(GLPK 4.33)
     71ENDIF(LEMON_ENABLE_GLPK)
     72IF(LEMON_ENABLE_CPLEX)
     73  FIND_PACKAGE(CPLEX)
     74ENDIF(LEMON_ENABLE_CPLEX)
     75IF(LEMON_ENABLE_COIN)
     76  FIND_PACKAGE(COIN)
     77ENDIF(LEMON_ENABLE_COIN)
     78
     79IF(GLPK_FOUND)
     80  SET(LEMON_HAVE_LP TRUE)
     81  SET(LEMON_HAVE_MIP TRUE)
     82  SET(LEMON_HAVE_GLPK TRUE)
     83ENDIF(GLPK_FOUND)
     84IF(CPLEX_FOUND)
     85  SET(LEMON_HAVE_LP TRUE)
     86  SET(LEMON_HAVE_MIP TRUE)
     87  SET(LEMON_HAVE_CPLEX TRUE)
     88ENDIF(CPLEX_FOUND)
     89IF(COIN_FOUND)
     90  SET(LEMON_HAVE_LP TRUE)
     91  SET(LEMON_HAVE_MIP TRUE)
     92  SET(LEMON_HAVE_CLP TRUE)
     93  SET(LEMON_HAVE_CBC TRUE)
     94ENDIF(COIN_FOUND)
     95
     96IF(CPLEX_FOUND)
     97  SET(DEFAULT_LP "CPLEX")
     98  SET(DEFAULT_MIP "CPLEX")
     99ELSEIF(COIN_FOUND)
     100  SET(DEFAULT_LP "CLP")
     101  SET(DEFAULT_MIP "CBC")
     102ELSEIF(GLPK_FOUND)
     103  SET(DEFAULT_LP "GLPK")
     104  SET(DEFAULT_MIP "GLPK")
     105ENDIF()
     106
     107IF(NOT LEMON_DEFAULT_LP OR
     108    (NOT CPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
     109    (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
     110    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")))
     111  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
     112    "Default LP solver backend (GLPK, CPLEX or CLP)" FORCE)
     113ENDIF()
     114IF(NOT LEMON_DEFAULT_MIP OR
     115    (NOT CPLEX_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
     116    (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
     117    (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
     118  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
     119    "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
     120ENDIF()
     121
    67122
    68123IF(DEFINED ENV{LEMON_CXX_WARNING})
    69124  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
  • INSTALL

    diff --git a/INSTALL b/INSTALL
    a b  
    134134  See http://docs.mathjax.org/en/latest/installation.html for more details.
    135135
    136136 
     137-DLEMON_ENABLE_GLPK=NO
     138-DLEMON_ENABLE_COIN=NO
     139-DLEMON_ENABLE_CPLEX=NO
     140
     141  Enable optional third party libraries. They are all enabled by default.
     142
     143-DLEMON_DEFAULT_LP=GLPK
     144
     145  Sets the default LP solver backend. The supported values are
     146  CPLEX, CLP and GLPK. By default, it is set to the first one which
     147  is enabled and succesfully discovered.
     148
     149-DLEMON_DEFAULT_MIP=GLPK
     150
     151  Sets the default MIP solver backend. The supported values are
     152  CPLEX, CBC and GLPK. By default, it is set to the first one which
     153  is enabled and succesfully discovered.
     154
    137155-DGLPK_ROOT_DIR=DIRECTORY
    138156-DCOIN_ROOT_DIR=DIRECTORY
    139157-DCPLEX_ROOT_DIR=DIRECTORY
    140158
    141   Install root directory prefixes of optional third party libraries.
     159  Root directory prefixes of optional third party libraries.
    142160
    143161Makefile Variables
    144162==================
  • cmake/FindCOIN.cmake

    diff --git a/cmake/FindCOIN.cmake b/cmake/FindCOIN.cmake
    a b  
    108108  COIN_ZLIB_LIBRARY
    109109  COIN_BZ2_LIBRARY
    110110)
    111 
    112 IF(COIN_FOUND)
    113   SET(LEMON_HAVE_LP TRUE)
    114   SET(LEMON_HAVE_MIP TRUE)
    115   SET(LEMON_HAVE_CLP TRUE)
    116   SET(LEMON_HAVE_CBC TRUE)
    117 ENDIF(COIN_FOUND)
  • cmake/FindCPLEX.cmake

    diff --git a/cmake/FindCPLEX.cmake b/cmake/FindCPLEX.cmake
    a b  
    3232ENDIF(CPLEX_FOUND)
    3333
    3434MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
    35 
    36 IF(CPLEX_FOUND)
    37   SET(LEMON_HAVE_LP TRUE)
    38   SET(LEMON_HAVE_MIP TRUE)
    39   SET(LEMON_HAVE_CPLEX TRUE)
    40 ENDIF(CPLEX_FOUND)
  • cmake/FindGLPK.cmake

    diff --git a/cmake/FindGLPK.cmake b/cmake/FindGLPK.cmake
    a b  
    5353ENDIF(GLPK_FOUND)
    5454
    5555MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
    56 
    57 IF(GLPK_FOUND)
    58   SET(LEMON_HAVE_LP TRUE)
    59   SET(LEMON_HAVE_MIP TRUE)
    60   SET(LEMON_HAVE_GLPK TRUE)
    61 ENDIF(GLPK_FOUND)
  • lemon/cbc.h

    diff --git a/lemon/cbc.h b/lemon/cbc.h
    a b  
    1616 *
    1717 */
    1818
    19 // -*- C++ -*-
    2019#ifndef LEMON_CBC_H
    2120#define LEMON_CBC_H
    2221
  • lemon/config.h.in

    diff --git a/lemon/config.h.in b/lemon/config.h.in
    a b  
    66#cmakedefine LEMON_HAVE_CPLEX 1
    77#cmakedefine LEMON_HAVE_CLP 1
    88#cmakedefine LEMON_HAVE_CBC 1
     9#cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@
     10#cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@
    911#cmakedefine LEMON_USE_PTHREAD 1
    1012#cmakedefine LEMON_USE_WIN32_THREADS 1
  • lemon/lp.h

    diff --git a/lemon/lp.h b/lemon/lp.h
    a b  
    5959  ///The default MIP solver identifier.
    6060  ///\ingroup lp_group
    6161  ///
    62   ///Currently, the possible values are \c GLPK or \c CPLEX
     62  ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC
    6363#define LEMON_DEFAULT_MIP SOLVER
    6464  ///The default MIP solver.
    6565
    6666  ///The default MIP solver.
    6767  ///\ingroup lp_group
    6868  ///
    69   ///Currently, it is either \c GlpkMip or \c CplexMip
     69  ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip
    7070  typedef GlpkMip Mip;
    7171#else
    72 #ifdef LEMON_HAVE_GLPK
    73 # define LEMON_DEFAULT_LP GLPK
     72#if LEMON_DEFAULT_LP == GLPK
    7473  typedef GlpkLp Lp;
    75 # define LEMON_DEFAULT_MIP GLPK
    76   typedef GlpkMip Mip;
    77 #elif LEMON_HAVE_CPLEX
    78 # define LEMON_DEFAULT_LP CPLEX
     74#elif LEMON_DEFAULT_LP == CPLEX
    7975  typedef CplexLp Lp;
    80 # define LEMON_DEFAULT_MIP CPLEX
     76#elif LEMON_DEFAULT_LP == SOPLEX
     77  typedef SoplexLp Lp;
     78#elif LEMON_DEFAULT_LP == CLP
     79  typedef ClpLp Lp;
     80#endif
     81#if LEMON_DEFAULT_MIP == GLPK
     82  typedef GlpkLp Mip;
     83#elif LEMON_DEFAULT_MIP == CPLEX
    8184  typedef CplexMip Mip;
    82 #elif LEMON_HAVE_SOPLEX
    83 # define DEFAULT_LP SOPLEX
    84   typedef SoplexLp Lp;
    85 #elif LEMON_HAVE_CLP
    86 # define DEFAULT_LP CLP
    87   typedef ClpLp Lp;
     85#elif LEMON_DEFAULT_MIP == CBC
     86  typedef CbcMip Mip;
    8887#endif
    8988#endif
    9089
  • test/lp_test.cc

    diff --git a/test/lp_test.cc b/test/lp_test.cc
    a b  
    240240
    241241  {
    242242    LP::DualExpr e,f,g;
    243     LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID,
    244       p4 = INVALID, p5 = INVALID;
     243    LP::Row p1 = INVALID, p2 = INVALID;
    245244
    246245    e[p1]=2;
    247246    e[p1]+=2;