COIN-OR::LEMON - Graph Library

Changes in / [1065:490d89913a17:1061:473c71baff72] in lemon-main


Ignore:
Files:
1 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r1064 r1017  
    6262FIND_PACKAGE(Doxygen)
    6363FIND_PACKAGE(Ghostscript)
    64 
    65 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
    66 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
    67 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
    68 
    69 IF(LEMON_ENABLE_GLPK)
    70   FIND_PACKAGE(GLPK 4.33)
    71 ENDIF(LEMON_ENABLE_GLPK)
    72 IF(LEMON_ENABLE_ILOG)
    73   FIND_PACKAGE(ILOG)
    74 ENDIF(LEMON_ENABLE_ILOG)
    75 IF(LEMON_ENABLE_COIN)
    76   FIND_PACKAGE(COIN)
    77 ENDIF(LEMON_ENABLE_COIN)
    78 
    79 IF(GLPK_FOUND)
    80   SET(LEMON_HAVE_LP TRUE)
    81   SET(LEMON_HAVE_MIP TRUE)
    82   SET(LEMON_HAVE_GLPK TRUE)
    83 ENDIF(GLPK_FOUND)
    84 IF(ILOG_FOUND)
    85   SET(LEMON_HAVE_LP TRUE)
    86   SET(LEMON_HAVE_MIP TRUE)
    87   SET(LEMON_HAVE_ILOG TRUE)
    88 ENDIF(ILOG_FOUND)
    89 IF(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)
    94 ENDIF(COIN_FOUND)
    95 
    96 IF(ILOG_FOUND)
    97   SET(DEFAULT_LP "CPLEX")
    98   SET(DEFAULT_MIP "CPLEX")
    99 ELSEIF(COIN_FOUND)
    100   SET(DEFAULT_LP "CLP")
    101   SET(DEFAULT_MIP "CBC")
    102 ELSEIF(GLPK_FOUND)
    103   SET(DEFAULT_LP "GLPK")
    104   SET(DEFAULT_MIP "GLPK")
    105 ENDIF()
    106 
    107 IF(NOT LEMON_DEFAULT_LP OR
    108     (NOT ILOG_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)
    113 ENDIF()
    114 IF(NOT LEMON_DEFAULT_MIP OR
    115     (NOT ILOG_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)
    120 ENDIF()
    121 
     64FIND_PACKAGE(GLPK 4.33)
     65FIND_PACKAGE(CPLEX)
     66FIND_PACKAGE(COIN)
    12267
    12368IF(DEFINED ENV{LEMON_CXX_WARNING})
  • INSTALL

    r1065 r1040  
    135135
    136136 
    137 -DLEMON_ENABLE_GLPK=NO
    138 -DLEMON_ENABLE_COIN=NO
    139 -DLEMON_ENABLE_ILOG=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 
    155137-DGLPK_ROOT_DIR=DIRECTORY
    156138-DCOIN_ROOT_DIR=DIRECTORY
    157 -DILOG_ROOT_DIR=DIRECTORY
     139-DCPLEX_ROOT_DIR=DIRECTORY
    158140
    159   Root directory prefixes of optional third party libraries.
     141  Install root directory prefixes of optional third party libraries.
    160142
    161143Makefile Variables
  • cmake/FindCOIN.cmake

    r1064 r973  
    109109  COIN_BZ2_LIBRARY
    110110)
     111
     112IF(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)
     117ENDIF(COIN_FOUND)
  • cmake/FindGLPK.cmake

    r1064 r638  
    5454
    5555MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
     56
     57IF(GLPK_FOUND)
     58  SET(LEMON_HAVE_LP TRUE)
     59  SET(LEMON_HAVE_MIP TRUE)
     60  SET(LEMON_HAVE_GLPK TRUE)
     61ENDIF(GLPK_FOUND)
  • lemon/CMakeLists.txt

    r1062 r981  
    3737IF(LEMON_HAVE_CPLEX)
    3838  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
    39   INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS})
     39  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
    4040ENDIF()
    4141
  • lemon/cbc.h

    r1064 r877  
    1717 */
    1818
     19// -*- C++ -*-
    1920#ifndef LEMON_CBC_H
    2021#define LEMON_CBC_H
  • lemon/config.h.in

    r1064 r981  
    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@
    119#cmakedefine LEMON_USE_PTHREAD 1
    1210#cmakedefine LEMON_USE_WIN32_THREADS 1
  • lemon/cplex.cc

    r1063 r1016  
    492492                   _message_enabled ? CPX_ON : CPX_OFF);
    493493  }
    494 
    495   void CplexBase::_write(std::string file, std::string format) const
    496   {
    497     if(format == "MPS" || format == "LP")
    498       CPXwriteprob(cplexEnv(), cplexLp(), file.c_str(), format.c_str());
    499     else if(format == "SOL")
    500       CPXsolwrite(cplexEnv(), cplexLp(), file.c_str());
    501     else throw UnsupportedFormatError(format);
    502   }
    503 
    504 
    505494
    506495  // CplexLp members
  • lemon/cplex.h

    r1063 r746  
    151151    bool _message_enabled;
    152152
    153     void _write(std::string file, std::string format) const;
    154 
    155153  public:
    156154
     
    173171    const cpxlp* cplexLp() const { return _prob; }
    174172
    175 #ifdef DOXYGEN
    176     /// Write the problem or the solution to a file in the given format
    177 
    178     /// This function writes the problem or the solution
    179     /// to a file in the given format.
    180     /// Trying to write in an unsupported format will trigger
    181     /// \ref UnsupportedFormatError.
    182     /// \param file The file path
    183     /// \param format The output file format.
    184     /// Supportted formats are "MPS", "LP" and "SOL".
    185     void write(std::string file, std::string format = "MPS") const {}
    186 #endif
    187 
    188173  };
    189174
  • lemon/glpk.cc

    r1063 r989  
    581581      break;
    582582    }
    583   }
    584 
    585   void GlpkBase::_write(std::string file, std::string format) const
    586   {
    587     if(format == "MPS")
    588       glp_write_mps(lp, GLP_MPS_FILE, 0, file.c_str());
    589     else if(format == "LP")
    590       glp_write_lp(lp, 0, file.c_str());
    591     else throw UnsupportedFormatError(format);
    592583  }
    593584
     
    1008999  const char* GlpkMip::_solverName() const { return "GlpkMip"; }
    10091000
    1010 
    1011 
    10121001} //END OF NAMESPACE LEMON
  • lemon/glpk.h

    r1063 r877  
    116116    virtual void _messageLevel(MessageLevel level);
    117117
    118     virtual void _write(std::string file, std::string format) const;
    119 
    120118  private:
    121119
     
    147145    int lpxCol(Col c) const { return cols(id(c)); }
    148146
    149 #ifdef DOXYGEN
    150     /// Write the problem or the solution to a file in the given format
    151    
    152     /// This function writes the problem or the solution
    153     /// to a file in the given format.
    154     /// Trying to write in an unsupported format will trigger
    155     /// \ref UnsupportedFormatError.
    156     /// \param file The file path
    157     /// \param format The output file format.
    158     /// Supportted formats are "MPS" and "LP".
    159     void write(std::string file, std::string format = "MPS") const {}
    160 #endif
    161 
    162147  };
    163148
  • lemon/lp.h

    r1064 r877  
    6060  ///\ingroup lp_group
    6161  ///
    62   ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC
     62  ///Currently, the possible values are \c GLPK or \c CPLEX
    6363#define LEMON_DEFAULT_MIP SOLVER
    6464  ///The default MIP solver.
     
    6767  ///\ingroup lp_group
    6868  ///
    69   ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip
     69  ///Currently, it is either \c GlpkMip or \c CplexMip
    7070  typedef GlpkMip Mip;
    7171#else
    72 #if LEMON_DEFAULT_LP == GLPK
     72#ifdef LEMON_HAVE_GLPK
     73# define LEMON_DEFAULT_LP GLPK
    7374  typedef GlpkLp Lp;
    74 #elif LEMON_DEFAULT_LP == CPLEX
     75# define LEMON_DEFAULT_MIP GLPK
     76  typedef GlpkMip Mip;
     77#elif LEMON_HAVE_CPLEX
     78# define LEMON_DEFAULT_LP CPLEX
    7579  typedef CplexLp Lp;
    76 #elif LEMON_DEFAULT_LP == SOPLEX
     80# define LEMON_DEFAULT_MIP CPLEX
     81  typedef CplexMip Mip;
     82#elif LEMON_HAVE_SOPLEX
     83# define DEFAULT_LP SOPLEX
    7784  typedef SoplexLp Lp;
    78 #elif LEMON_DEFAULT_LP == CLP
     85#elif LEMON_HAVE_CLP
     86# define DEFAULT_LP CLP
    7987  typedef ClpLp Lp;
    80 #endif
    81 #if LEMON_DEFAULT_MIP == GLPK
    82   typedef GlpkLp Mip;
    83 #elif LEMON_DEFAULT_MIP == CPLEX
    84   typedef CplexMip Mip;
    85 #elif LEMON_DEFAULT_MIP == CBC
    86   typedef CbcMip Mip;
    8788#endif
    8889#endif
  • lemon/lp_base.h

    r1063 r989  
    10081008  public:
    10091009
    1010     ///\e
    1011     class UnsupportedFormatError : public Exception
    1012     {
    1013       std::string _format;
    1014       mutable std::string _what;
    1015     public:
    1016       explicit UnsupportedFormatError(std::string format) throw()
    1017         : _format(format) { }
    1018       virtual ~UnsupportedFormatError() throw() {}
    1019       virtual const char* what() const throw() {
    1020         try {
    1021           _what.clear();
    1022           std::ostringstream oss;
    1023           oss << "lemon::UnsupportedFormatError: " << _format;
    1024           _what = oss.str();
    1025         }
    1026         catch (...) {}
    1027         if (!_what.empty()) return _what.c_str();
    1028         else return "lemon::UnsupportedFormatError";
    1029       }
    1030     };
    1031    
    1032   protected:
    1033     virtual void _write(std::string, std::string format) const
    1034     {
    1035       throw UnsupportedFormatError(format);
    1036     }
    1037    
    1038   public:
    1039 
    10401010    /// Virtual destructor
    10411011    virtual ~LpBase() {}
     
    15861556    void min() { _setSense(MIN); }
    15871557
    1588     ///Clear the problem
     1558    ///Clears the problem
    15891559    void clear() { _clear(); rows.clear(); cols.clear(); }
    15901560
    1591     /// Set the message level of the solver
     1561    /// Sets the message level of the solver
    15921562    void messageLevel(MessageLevel level) { _messageLevel(level); }
    1593 
    1594     /// Write the problem to a file in the given format
    1595 
    1596     /// This function writes the problem to a file in the given format.
    1597     /// Different solver backends may support different formats.
    1598     /// Trying to write in an unsupported format will trigger
    1599     /// \ref UnsupportedFormatError. For the supported formats,
    1600     /// visit the documentation of the base class of the related backends
    1601     /// (\ref CplexBase, \ref GlpkBase etc.)
    1602     /// \param file The file path
    1603     /// \param format The output file format.
    1604     void write(std::string file, std::string format = "MPS") const
    1605     {
    1606       _write(file.c_str(),format.c_str());
    1607     }
    16081563
    16091564    ///@}
  • lemon/lp_skeleton.cc

    r1063 r877  
    9292  void SkeletonSolverBase::_messageLevel(MessageLevel) {}
    9393
    94   void SkeletonSolverBase::_write(std::string, std::string) const {}
    95 
    9694  LpSkeleton::SolveExitStatus LpSkeleton::_solve() { return SOLVED; }
    9795
  • lemon/lp_skeleton.h

    r1063 r877  
    145145    ///\e
    146146    virtual void _messageLevel(MessageLevel);
    147 
    148     ///\e
    149     virtual void _write(std::string file, std::string format) const;
    150 
    151147  };
    152148
     
    227223    ///\e
    228224    virtual const char* _solverName() const;
    229 
    230225  };
    231226
  • test/CMakeLists.txt

    r1065 r1060  
    7070  ENDIF()
    7171  IF(LEMON_HAVE_CPLEX)
    72     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES})
     72    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    7373  ENDIF()
    7474  IF(LEMON_HAVE_CLP)
     
    9494    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    9595    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    96       COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
     96      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    9797    )
    9898  ENDIF()
     
    112112  ENDIF()
    113113  IF(LEMON_HAVE_CPLEX)
    114     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES})
     114    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    115115  ENDIF()
    116116  IF(LEMON_HAVE_CBC)
     
    136136    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    137137    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    138       COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
     138      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    139139    )
    140140  ENDIF()
  • test/lp_test.cc

    r1064 r988  
    241241  {
    242242    LP::DualExpr e,f,g;
    243     LP::Row p1 = INVALID, p2 = INVALID;
     243    LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID,
     244      p4 = INVALID, p5 = INVALID;
    244245
    245246    e[p1]=2;
Note: See TracChangeset for help on using the changeset viewer.