COIN-OR::LEMON - Graph Library

Changeset 2218:50f1a780a5ff in lemon-0.x for lemon


Ignore:
Timestamp:
09/21/06 16:46:28 (14 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2952
Message:

Interface to the cplex MIP solver: it is little, a bit sour but it is ours.

Location:
lemon
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • lemon/Makefile.am

    r2211 r2218  
    2626if HAVE_CPLEX
    2727lemon_libemon_la_SOURCES += lemon/lp_cplex.cc
     28lemon_libemon_la_SOURCES += lemon/mip_cplex.cc
    2829endif
    2930
     
    7980        lemon/min_cut.h \
    8081        lemon/mip_glpk.h \
     82        lemon/mip_cplex.h \
    8183        lemon/path.h \
    8284        lemon/polynomial.h \
  • lemon/lp.h

    r2144 r2218  
    2222#include<lemon/config.h>
    2323
     24
    2425#ifdef HAVE_GLPK
    2526#include <lemon/lp_glpk.h>
     
    2728#elif HAVE_CPLEX
    2829#include <lemon/lp_cplex.h>
     30#include <lemon/mip_cplex.h>
    2931#endif
    3032
     
    3335///\ingroup gen_opt_group
    3436namespace lemon {
    35  
     37
    3638#ifdef DOXYGEN
    3739  ///The default LP solver identifier
     
    7375#define DEFAULT_LP CPLEX
    7476  typedef LpCplex Lp;
     77  typedef MipCplex Mip;
    7578  const char default_solver_name[]="CPLEX";
    7679#endif
  • lemon/lp_base.h

    r2185 r2218  
    7676        return cross[n];
    7777      }
    78       ///\todo Create an own exception type.
    79       else throw LogicError(); //floatingId-s must form a continuous range;
     78      else {
     79        ///\todo Create an own exception type.
     80        throw LogicError(); //floatingId-s must form a continuous range;
     81      }
    8082    }
    8183    ///Remove a fix id.
     
    11701172      REAL = 0,
    11711173      ///Integer variable
    1172       INTEGER = 1
     1174
     1175      ///Unfortunately, cplex 7.5 somewhere writes something like
     1176      ///#define INTEGER 'I'
     1177      LEMON_INTEGER = 1
    11731178      ///\todo No support for other types yet.
    11741179    };
     
    11931198    void integer(Col c, bool enable) {
    11941199      if (enable)
    1195         colType(c,INTEGER);
     1200        colType(c,LEMON_INTEGER);
    11961201      else
    11971202        colType(c,REAL);
     
    12031208    ///\return true if the column has integer type and false if not.
    12041209    bool integer(Col c){
    1205       return (colType(c)==INTEGER);
     1210      return (colType(c)==LEMON_INTEGER);
    12061211    }
    12071212
  • lemon/lp_cplex.cc

    r2168 r2218  
    270270    status = CPXlpopt(env, lp);
    271271    //status = CPXprimopt(env, lp);
    272 #if CPX_VERSION >= 900
     272#if CPX_VERSION >= 800
    273273    if (status)
    274274    {
     
    417417  LpCplex::SolutionStatus LpCplex::_getPrimalStatus()
    418418  {
     419    //Unboundedness not treated well: the following is from cplex 9.0 doc
     420    // About Unboundedness
     421
     422    // The treatment of models that are unbounded involves a few
     423    // subtleties. Specifically, a declaration of unboundedness means that
     424    // ILOG CPLEX has determined that the model has an unbounded
     425    // ray. Given any feasible solution x with objective z, a multiple of
     426    // the unbounded ray can be added to x to give a feasible solution
     427    // with objective z-1 (or z+1 for maximization models). Thus, if a
     428    // feasible solution exists, then the optimal objective is
     429    // unbounded. Note that ILOG CPLEX has not necessarily concluded that
     430    // a feasible solution exists. Users can call the routine CPXsolninfo
     431    // to determine whether ILOG CPLEX has also concluded that the model
     432    // has a feasible solution.
     433
    419434    int stat = CPXgetstat(env, lp);
    420 #if CPX_VERSION >= 900
     435#if CPX_VERSION >= 800
    421436    switch (stat)
    422437    {
     
    486501  {
    487502    int stat = CPXgetstat(env, lp);
    488 #if CPX_VERSION >= 900
     503#if CPX_VERSION >= 800
    489504    switch (stat)
    490505    {
     
    515530  {
    516531    int stat = CPXgetstat(env, lp);
    517 #if CPX_VERSION >= 900
     532#if CPX_VERSION >= 800
    518533    switch (stat)
    519534    {
  • lemon/lp_cplex.h

    r1956 r2218  
    3535  ///
    3636  /// This class implements an interface for the CPLEX LP solver.
    37   class LpCplex : public LpSolverBase {
     37  class LpCplex :virtual public LpSolverBase {
    3838
    3939  public:
  • lemon/mip_glpk.cc

    r2213 r2218  
    1717 */
    1818
    19 #ifndef LEMON_ILP_GLPK_CC
    20 #define LEMON_ILP_GLPK_CC
     19#ifndef LEMON_MIP_GLPK_CC
     20#define LEMON_MIP_GLPK_CC
    2121
    2222///\file
    23 ///\brief Implementation of the LEMON-GLPK lp solver interface.
     23///\brief Implementation of the LEMON-GLPK mip solver interface.
    2424
    2525#include <lemon/mip_glpk.h>
     
    3333  void MipGlpk::_colType(int i, MipGlpk::ColTypes col_type){
    3434    switch (col_type){
    35       case INTEGER:
     35      case LEMON_INTEGER:
    3636        lpx_set_col_kind(lp,i,LPX_IV);
    3737        break;
     
    4747    switch (lpx_get_col_kind(lp,i)){
    4848    case LPX_IV:
    49       return INTEGER;//Or binary
     49      return LEMON_INTEGER;//Or binary
    5050    case LPX_CV:
    5151      return REAL;
     
    111111    return lpx_mip_obj_val(lp);
    112112  }
    113 } //END OG NAMESPACE LEMON
     113} //END OF NAMESPACE LEMON
    114114
    115 #endif
     115#endif //END OF MIP_GLPK_CC
  • lemon/mip_glpk.h

    r2185 r2218  
    1717 */
    1818
    19 #ifndef LEMON_ILP_GLPK_H
    20 #define LEMON_ILP_GLPK_H
     19#ifndef LEMON_MIP_GLPK_H
     20#define LEMON_MIP_GLPK_H
    2121
    2222///\file
    23 ///\brief Header of the LEMON-GLPK lp solver interface.
     23///\brief Header of the LEMON-GLPK mip solver interface.
    2424///\ingroup gen_opt_group
    2525
     
    2828
    2929namespace lemon {
    30   /// \brief Interface for the GLPK ILP solver
     30  /// \brief Interface for the GLPK MIP solver
    3131  ///
    32   /// This class implements an interface for the GLPK ILP solver.
     32  /// This class implements an interface for the GLPK MIP solver.
    3333  ///\ingroup gen_opt_group
    3434  class MipGlpk : public MipSolverBase, public LpGlpk{
     
    5757} //END OF NAMESPACE LEMON
    5858
    59 #endif // END OF LEMON_ILP_GLPK_H
     59#endif // END OF LEMON_MIP_GLPK_H
Note: See TracChangeset for help on using the changeset viewer.