COIN-OR::LEMON - Graph Library

Ignore:
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r1334 r1335  
    1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     1CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
     2
     3IF(POLICY CMP0048)
     4  CMAKE_POLICY(SET CMP0048 OLD)
     5ENDIF(POLICY CMP0048)
    26
    37IF(POLICY CMP0043)
     
    126130  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    127131    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
     132ELSE()
     133  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
     134    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
    128135ENDIF()
    129136IF(NOT LEMON_DEFAULT_MIP OR
     
    133140  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
    134141    "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
     142ELSE()
     143  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
     144    "Default MIP solver backend (GLPK, CPLEX or CBC)")
    135145ENDIF()
    136146
     
    145155  ELSEIF(MSVC)
    146156    # This part is unnecessary 'casue the same is set by the lemon/core.h.
    147     # Still keep it as an example.
    148     SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
     157    # Still kept as an example.
     158
     159    # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
     160
    149161    # Suppressed warnings:
    150162    # C4250: 'class1' : inherits 'class2::member' via dominance
     163    # C4267: conversion from 'size_t' to 'type', possible loss of data
    151164    # C4355: 'this' : used in base member initializer list
    152165    # C4503: 'function' : decorated name length exceeded, name was truncated
     
    163176
    164177IF(MSVC)
     178  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    165179  SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    166180    "Flags used by the C++ compiler during maintainer builds."
     
    185199    )
    186200  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    187     "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
     201    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    188202    "Flags used for linking binaries during maintainer builds."
    189203    )
    190204  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    191     "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
     205    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    192206    "Flags used by the shared libraries linker during maintainer builds."
    193207    )
  • cmake/FindILOG.cmake

    r1232 r1331  
    6363  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    6464  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
     65  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
     66  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
    6567  ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    6668  NO_DEFAULT_PATH
     
    7375  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    7476  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
     77  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic
     78  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic
    7579  ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    7680  NO_DEFAULT_PATH
  • lemon/CMakeLists.txt

    r1264 r1315  
    5656
    5757ADD_LIBRARY(lemon ${LEMON_SOURCES})
     58
     59TARGET_LINK_LIBRARIES(lemon
     60  ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
     61  )
     62
    5863IF(UNIX)
    59   SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
     64  SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION})
    6065ENDIF()
    6166
  • lemon/arg_parser.h

    r959 r1327  
    2727#include <sstream>
    2828#include <algorithm>
     29#include <lemon/core.h>
    2930#include <lemon/assert.h>
    3031
  • lemon/capacity_scaling.h

    r1270 r1298  
    164164
    165165    // Parameters of the problem
    166     bool _have_lower;
     166    bool _has_lower;
    167167    Value _sum_supply;
    168168
     
    357357    template <typename LowerMap>
    358358    CapacityScaling& lowerMap(const LowerMap& map) {
    359       _have_lower = true;
     359      _has_lower = true;
    360360      for (ArcIt a(_graph); a != INVALID; ++a) {
    361361        _lower[_arc_idf[a]] = map[a];
    362         _lower[_arc_idb[a]] = map[a];
    363362      }
    364363      return *this;
     
    544543        _cost[j] = _forward[j] ? 1 : -1;
    545544      }
    546       _have_lower = false;
     545      _has_lower = false;
    547546      return *this;
    548547    }
     
    755754      const Value MAX = std::numeric_limits<Value>::max();
    756755      int last_out;
    757       if (_have_lower) {
     756      if (_has_lower) {
    758757        for (int i = 0; i != _root; ++i) {
    759758          last_out = _first_out[i+1];
     
    840839    }
    841840
    842     // Check if the upper bound is greater or equal to the lower bound
    843     // on each arc.
     841    // Check if the upper bound is greater than or equal to the lower bound
     842    // on each forward arc.
    844843    bool checkBoundMaps() {
    845844      for (int j = 0; j != _res_arc_num; ++j) {
    846         if (_upper[j] < _lower[j]) return false;
     845        if (_forward[j] && _upper[j] < _lower[j]) return false;
    847846      }
    848847      return true;
     
    858857
    859858      // Handle non-zero lower bounds
    860       if (_have_lower) {
     859      if (_has_lower) {
    861860        int limit = _first_out[_root];
    862861        for (int j = 0; j != limit; ++j) {
    863           if (!_forward[j]) _res_cap[j] += _lower[j];
     862          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    864863        }
    865864      }
  • lemon/config.h.in

    r1264 r1306  
    11#define LEMON_VERSION "@PROJECT_VERSION@"
    22#cmakedefine LEMON_HAVE_LONG_LONG 1
     3
    34#cmakedefine LEMON_HAVE_LP 1
    45#cmakedefine LEMON_HAVE_MIP 1
     
    89#cmakedefine LEMON_HAVE_CLP 1
    910#cmakedefine LEMON_HAVE_CBC 1
    10 #cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@
    11 #cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@
     11
     12#define _LEMON_CPLEX 1
     13#define _LEMON_CLP 2
     14#define _LEMON_GLPK 3
     15#define _LEMON_SOPLEX 4
     16#define _LEMON_CBC 5
     17
     18#cmakedefine LEMON_DEFAULT_LP _LEMON_@LEMON_DEFAULT_LP@
     19#cmakedefine LEMON_DEFAULT_MIP _LEMON_@LEMON_DEFAULT_MIP@
     20
    1221#cmakedefine LEMON_USE_PTHREAD 1
    1322#cmakedefine LEMON_USE_WIN32_THREADS 1
  • lemon/core.h

    r1270 r1327  
    3030// Disable the following warnings when compiling with MSVC:
    3131// C4250: 'class1' : inherits 'class2::member' via dominance
     32// C4267: conversion from 'size_t' to 'type', possible loss of data
    3233// C4355: 'this' : used in base member initializer list
    3334// C4503: 'function' : decorated name length exceeded, name was truncated
     
    3536// C4996: 'function': was declared deprecated
    3637#ifdef _MSC_VER
    37 #pragma warning( disable : 4250 4355 4503 4800 4996 )
     38#pragma warning( disable : 4250 4267 4355 4503 4800 4996 )
    3839#endif
    3940
    40 #ifdef __GNUC__
    41 #define GCC_VERSION (__GNUC__ * 10000                   \
    42                      + __GNUC_MINOR__ * 100             \
    43                      + __GNUC_PATCHLEVEL__)
    44 #endif
    45 
    46 #if GCC_VERSION >= 40800
     41#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
    4742// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8
    4843#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
  • lemon/cost_scaling.h

    r1271 r1298  
    257257
    258258    // Parameters of the problem
    259     bool _have_lower;
     259    bool _has_lower;
    260260    Value _sum_supply;
    261261    int _sup_node_num;
     
    373373    template <typename LowerMap>
    374374    CostScaling& lowerMap(const LowerMap& map) {
    375       _have_lower = true;
     375      _has_lower = true;
    376376      for (ArcIt a(_graph); a != INVALID; ++a) {
    377377        _lower[_arc_idf[a]] = map[a];
    378         _lower[_arc_idb[a]] = map[a];
    379378      }
    380379      return *this;
     
    569568        _scost[_reverse[j]] = 0;
    570569      }
    571       _have_lower = false;
     570      _has_lower = false;
    572571      return *this;
    573572    }
     
    781780      const Value MAX = std::numeric_limits<Value>::max();
    782781      int last_out;
    783       if (_have_lower) {
     782      if (_has_lower) {
    784783        for (int i = 0; i != _root; ++i) {
    785784          last_out = _first_out[i+1];
     
    838837        sup[n] = _supply[_node_id[n]];
    839838      }
    840       if (_have_lower) {
     839      if (_has_lower) {
    841840        for (ArcIt a(_graph); a != INVALID; ++a) {
    842841          int j = _arc_idf[a];
     
    908907    }
    909908
    910     // Check if the upper bound is greater or equal to the lower bound
    911     // on each arc.
     909    // Check if the upper bound is greater than or equal to the lower bound
     910    // on each forward arc.
    912911    bool checkBoundMaps() {
    913912      for (int j = 0; j != _res_arc_num; ++j) {
    914         if (_upper[j] < _lower[j]) return false;
     913        if (_forward[j] && _upper[j] < _lower[j]) return false;
    915914      }
    916915      return true;
     
    992991
    993992      // Handle non-zero lower bounds
    994       if (_have_lower) {
     993      if (_has_lower) {
    995994        int limit = _first_out[_root];
    996995        for (int j = 0; j != limit; ++j) {
    997           if (!_forward[j]) _res_cap[j] += _lower[j];
     996          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    998997        }
    999998      }
  • lemon/counter.h

    r833 r1327  
    2222#include <string>
    2323#include <iostream>
     24
     25#include <lemon/core.h>
    2426
    2527///\ingroup timecount
  • lemon/cplex.cc

    r1270 r1330  
    116116                         ExprIterator e, Value ub) {
    117117    int i = CPXgetnumrows(cplexEnv(), _prob);
     118
     119    int rmatbeg = 0;
     120   
     121    std::vector<int> indices;
     122    std::vector<Value> values;
     123
     124    for(ExprIterator it=b; it!=e; ++it) {
     125      indices.push_back(it->first);
     126      values.push_back(it->second);
     127    }
     128
    118129    if (lb == -INF) {
    119130      const char s = 'L';
    120       CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
     131      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s,
     132                 &rmatbeg, &indices.front(), &values.front(), 0, 0);
    121133    } else if (ub == INF) {
    122134      const char s = 'G';
    123       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     135      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s,
     136                 &rmatbeg, &indices.front(), &values.front(), 0, 0);
    124137    } else if (lb == ub){
    125138      const char s = 'E';
    126       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     139      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s,
     140                 &rmatbeg, &indices.front(), &values.front(), 0, 0);
    127141    } else {
    128142      const char s = 'R';
    129143      double len = ub - lb;
    130       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, &len, 0);
    131     }
    132 
    133     std::vector<int> indices;
    134     std::vector<int> rowlist;
    135     std::vector<Value> values;
    136 
    137     for(ExprIterator it=b; it!=e; ++it) {
    138       indices.push_back(it->first);
    139       values.push_back(it->second);
    140       rowlist.push_back(i);
    141     }
    142 
    143     CPXchgcoeflist(cplexEnv(), _prob, values.size(),
    144                    &rowlist.front(), &indices.front(), &values.front());
    145 
     144      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s,
     145                 &rmatbeg, &indices.front(), &values.front(), 0, 0);
     146      CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
     147    }
     148   
    146149    return i;
    147150  }
  • lemon/cycle_canceling.h

    r1270 r1298  
    196196
    197197    // Parameters of the problem
    198     bool _have_lower;
     198    bool _has_lower;
    199199    Value _sum_supply;
    200200
     
    279279    template <typename LowerMap>
    280280    CycleCanceling& lowerMap(const LowerMap& map) {
    281       _have_lower = true;
     281      _has_lower = true;
    282282      for (ArcIt a(_graph); a != INVALID; ++a) {
    283283        _lower[_arc_idf[a]] = map[a];
    284         _lower[_arc_idb[a]] = map[a];
    285284      }
    286285      return *this;
     
    472471        _cost[_reverse[j]] = 0;
    473472      }
    474       _have_lower = false;
     473      _has_lower = false;
    475474      return *this;
    476475    }
     
    685684      const Value MAX = std::numeric_limits<Value>::max();
    686685      int last_out;
    687       if (_have_lower) {
     686      if (_has_lower) {
    688687        for (int i = 0; i != _root; ++i) {
    689688          last_out = _first_out[i+1];
     
    728727        sup[n] = _supply[_node_id[n]];
    729728      }
    730       if (_have_lower) {
     729      if (_has_lower) {
    731730        for (ArcIt a(_graph); a != INVALID; ++a) {
    732731          int j = _arc_idf[a];
     
    785784    }
    786785
    787     // Check if the upper bound is greater or equal to the lower bound
    788     // on each arc.
     786    // Check if the upper bound is greater than or equal to the lower bound
     787    // on each forward arc.
    789788    bool checkBoundMaps() {
    790789      for (int j = 0; j != _res_arc_num; ++j) {
    791         if (_upper[j] < _lower[j]) return false;
     790        if (_forward[j] && _upper[j] < _lower[j]) return false;
    792791      }
    793792      return true;
     
    836835
    837836      // Handle non-zero lower bounds
    838       if (_have_lower) {
     837      if (_has_lower) {
    839838        int limit = _first_out[_root];
    840839        for (int j = 0; j != limit; ++j) {
    841           if (!_forward[j]) _res_cap[j] += _lower[j];
     840          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    842841        }
    843842      }
  • lemon/dim2.h

    r761 r1311  
    2121
    2222#include <iostream>
     23#include <algorithm>
    2324
    2425///\ingroup geomdat
  • lemon/elevator.h

    r628 r1328  
    168168    int onLevel(int l) const
    169169    {
    170       return _first[l+1]-_first[l];
     170      return static_cast<int>(_first[l+1]-_first[l]);
    171171    }
    172172    ///Return true if level \c l is empty.
     
    178178    int aboveLevel(int l) const
    179179    {
    180       return _first[_max_level+1]-_first[l+1];
     180      return static_cast<int>(_first[_max_level+1]-_first[l+1]);
    181181    }
    182182    ///Return the number of active items on level \c l.
    183183    int activesOnLevel(int l) const
    184184    {
    185       return _last_active[l]-_first[l]+1;
     185      return static_cast<int>(_last_active[l]-_first[l]+1);
    186186    }
    187187    ///Return true if there is no active item on level \c l.
  • lemon/lp.h

    r1270 r1323  
    2323
    2424
    25 #ifdef LEMON_HAVE_GLPK
     25#if LEMON_DEFAULT_LP == _LEMON_GLPK || LEMON_DEFAULT_MIP == _LEMON_GLPK
    2626#include <lemon/glpk.h>
    27 #elif LEMON_HAVE_CPLEX
     27#endif
     28#if LEMON_DEFAULT_LP == _LEMON_CPLEX || LEMON_DEFAULT_MIP == _LEMON_CPLEX
    2829#include <lemon/cplex.h>
    29 #elif LEMON_HAVE_SOPLEX
     30#endif
     31#if LEMON_DEFAULT_LP == _LEMON_SOPLEX
    3032#include <lemon/soplex.h>
    31 #elif LEMON_HAVE_CLP
     33#endif
     34#if LEMON_DEFAULT_LP == _LEMON_CLP
    3235#include <lemon/clp.h>
     36#endif
     37#if LEMON_DEFAULT_MIP == _LEMON_CBC
     38#include <lemon/cbc.h>
    3339#endif
    3440
     
    4450  ///\ingroup lp_group
    4551  ///
    46   ///Currently, the possible values are \c GLPK, \c CPLEX,
    47   ///\c SOPLEX or \c CLP
     52  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX,
     53  ///\c _LEMON_SOPLEX or \c LEMON__CLP
    4854#define LEMON_DEFAULT_LP SOLVER
    4955  ///The default LP solver
     
    6066  ///\ingroup lp_group
    6167  ///
    62   ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC
     68  ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX
     69  ///or \c _LEMON_CBC
    6370#define LEMON_DEFAULT_MIP SOLVER
    6471  ///The default MIP solver.
     
    7077  typedef GlpkMip Mip;
    7178#else
    72 #if LEMON_DEFAULT_LP == GLPK
     79#if LEMON_DEFAULT_LP == _LEMON_GLPK
    7380  typedef GlpkLp Lp;
    74 #elif LEMON_DEFAULT_LP == CPLEX
     81#elif LEMON_DEFAULT_LP == _LEMON_CPLEX
    7582  typedef CplexLp Lp;
    76 #elif LEMON_DEFAULT_LP == SOPLEX
     83#elif LEMON_DEFAULT_LP == _LEMON_SOPLEX
    7784  typedef SoplexLp Lp;
    78 #elif LEMON_DEFAULT_LP == CLP
     85#elif LEMON_DEFAULT_LP == _LEMON_CLP
    7986  typedef ClpLp Lp;
    8087#endif
    81 #if LEMON_DEFAULT_MIP == GLPK
    82   typedef GlpkLp Mip;
    83 #elif LEMON_DEFAULT_MIP == CPLEX
     88#if LEMON_DEFAULT_MIP == _LEMON_GLPK
     89  typedef GlpkMip Mip;
     90#elif LEMON_DEFAULT_MIP == _LEMON_CPLEX
    8491  typedef CplexMip Mip;
    85 #elif LEMON_DEFAULT_MIP == CBC
     92#elif LEMON_DEFAULT_MIP == _LEMON_CBC
    8693  typedef CbcMip Mip;
    8794#endif
  • lemon/math.h

    r1270 r1311  
    6868  ///Round a value to its closest integer
    6969  inline double round(double r) {
    70     return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
     70    return (r > 0.0) ? std::floor(r + 0.5) : std::ceil(r - 0.5);
    7171  }
    7272
  • lemon/network_simplex.h

    r1270 r1318  
    199199
    200200    // Parameters of the problem
    201     bool _have_lower;
     201    bool _has_lower;
    202202    SupplyType _stype;
    203203    Value _sum_supply;
     
    683683    template <typename LowerMap>
    684684    NetworkSimplex& lowerMap(const LowerMap& map) {
    685       _have_lower = true;
     685      _has_lower = true;
    686686      for (ArcIt a(_graph); a != INVALID; ++a) {
    687687        _lower[_arc_id[a]] = map[a];
     
    880880        _cost[i] = 1;
    881881      }
    882       _have_lower = false;
     882      _has_lower = false;
    883883      _stype = GEQ;
    884884      return *this;
     
    937937        _node_id[n] = i;
    938938      }
    939       if (_arc_mixing) {
     939      if (_arc_mixing && _node_num > 1) {
    940940        // Store the arcs in a mixed order
    941941        const int skip = std::max(_arc_num / _node_num, 3);
     
    10731073
    10741074      // Remove non-zero lower bounds
    1075       if (_have_lower) {
     1075      if (_has_lower) {
    10761076        for (int i = 0; i != _arc_num; ++i) {
    10771077          Value c = _lower[i];
     
    12361236    }
    12371237
    1238     // Check if the upper bound is greater or equal to the lower bound
     1238    // Check if the upper bound is greater than or equal to the lower bound
    12391239    // on each arc.
    12401240    bool checkBoundMaps() {
     
    16131613
    16141614      // Transform the solution and the supply map to the original form
    1615       if (_have_lower) {
     1615      if (_has_lower) {
    16161616        for (int i = 0; i != _arc_num; ++i) {
    16171617          Value c = _lower[i];
  • lemon/radix_sort.h

    r1270 r1328  
    329329      Allocator allocator;
    330330
    331       int length = std::distance(first, last);
     331      int length = static_cast<int>(std::distance(first, last));
    332332      Key* buffer = allocator.allocate(2 * length);
    333333      try {
  • lemon/random.h

    r631 r1328  
    200200        initState(init);
    201201
    202         num = length > end - begin ? length : end - begin;
     202        num = static_cast<int>(length > end - begin ? length : end - begin);
    203203        while (num--) {
    204204          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
     
    214214        }
    215215
    216         num = length - 1; cnt = length - (curr - state) - 1;
     216        num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
    217217        while (num--) {
    218218          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
  • lemon/static_graph.h

    r956 r1328  
    204204
    205205      node_num = n;
    206       arc_num = std::distance(first, last);
     206      arc_num = static_cast<int>(std::distance(first, last));
    207207
    208208      node_first_out = new int[node_num + 1];
  • test/arc_look_up_test.cc

    r1270 r1312  
    2525using namespace lemon;
    2626
    27 const int lgfn = 4;
    2827const std::string lgf =
    2928  "@nodes\n"
  • test/lp_test.cc

    r1270 r1300  
    4040#endif
    4141
     42#ifdef LEMON_HAVE_LP
     43#include <lemon/lp.h>
     44#endif
    4245using namespace lemon;
    4346
     
    417420  lpTest(lp_skel);
    418421
     422#ifdef LEMON_HAVE_LP
     423  {
     424    Lp lp,lp2;
     425    lpTest(lp);
     426    aTest(lp2);
     427    cloneTest<Lp>();
     428  }
     429#endif
     430
    419431#ifdef LEMON_HAVE_GLPK
    420432  {
  • test/min_cost_flow_test.cc

    r1270 r1318  
    396396  checkMcf(mcf3, mcf3.run(param), neg2_gr, neg2_l, neg2_u, neg2_c, neg2_s,
    397397           mcf3.OPTIMAL, true,     -300, test_str + "-18", GEQ);
     398
     399  // Tests for empty graph
     400  Digraph gr0;
     401  MCF mcf0(gr0);
     402  mcf0.run(param);
     403  check(mcf0.totalCost() == 0, "Wrong total cost"); 
    398404}
    399405
  • test/mip_test.cc

    r795 r1300  
    3131#ifdef LEMON_HAVE_CBC
    3232#include <lemon/cbc.h>
     33#endif
     34
     35#ifdef LEMON_HAVE_MIP
     36#include <lemon/lp.h>
    3337#endif
    3438
     
    129133{
    130134
     135#ifdef LEMON_HAVE_MIP
     136  {
     137    Mip mip1;
     138    aTest(mip1);
     139    cloneTest<Mip>();
     140  }
     141#endif
     142
    131143#ifdef LEMON_HAVE_GLPK
    132144  {
  • test/tsp_test.cc

    r1271 r1303  
    133133    int esize = n <= 1 ? 0 : n;
    134134
    135     TSP alg(g, constMap<Edge, int>(1));
     135    ConstMap<Edge, int> cost_map(1);
     136    TSP alg(g, cost_map);
    136137
    137138    check(alg.run() == esize, alg_name + ": Wrong total cost");
  • tools/lgf-gen.cc

    r701 r1308  
    247247  struct BeachIt;
    248248
    249   typedef std::multimap<double, BeachIt> SpikeHeap;
     249  typedef std::multimap<double, BeachIt*> SpikeHeap;
    250250
    251251  typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach;
     
    330330
    331331      if (bit->second != spikeheap.end()) {
     332        delete bit->second->second;
    332333        spikeheap.erase(bit->second);
    333334      }
     
    343344          circle_form(points[prev], points[curr], points[site])) {
    344345        double x = circle_point(points[prev], points[curr], points[site]);
    345         pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    346         pit->second.it =
     346        pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
     347        pit->second->it =
    347348          beach.insert(std::make_pair(Part(prev, curr, site), pit));
    348349      } else {
     
    356357          circle_form(points[site], points[curr],points[next])) {
    357358        double x = circle_point(points[site], points[curr], points[next]);
    358         nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    359         nit->second.it =
     359        nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
     360        nit->second->it =
    360361          beach.insert(std::make_pair(Part(site, curr, next), nit));
    361362      } else {
     
    367368      sweep = spit->first;
    368369
    369       Beach::iterator bit = spit->second.it;
     370      Beach::iterator bit = spit->second->it;
    370371
    371372      int prev = bit->first.prev;
     
    400401      int nnt = nbit->first.next;
    401402
    402       if (bit->second != spikeheap.end()) spikeheap.erase(bit->second);
    403       if (pbit->second != spikeheap.end()) spikeheap.erase(pbit->second);
    404       if (nbit->second != spikeheap.end()) spikeheap.erase(nbit->second);
    405 
     403      if (bit->second != spikeheap.end())
     404        {
     405          delete bit->second->second;
     406          spikeheap.erase(bit->second);
     407        }
     408      if (pbit->second != spikeheap.end())
     409        {
     410          delete pbit->second->second;
     411          spikeheap.erase(pbit->second);
     412        }
     413      if (nbit->second != spikeheap.end())
     414        {
     415          delete nbit->second->second;
     416          spikeheap.erase(nbit->second);
     417        }
     418     
    406419      beach.erase(nbit);
    407420      beach.erase(bit);
     
    413426        double x = circle_point(points[ppv], points[prev], points[next]);
    414427        if (x < sweep) x = sweep;
    415         pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    416         pit->second.it =
     428        pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
     429        pit->second->it =
    417430          beach.insert(std::make_pair(Part(ppv, prev, next), pit));
    418431      } else {
     
    425438        double x = circle_point(points[prev], points[next], points[nnt]);
    426439        if (x < sweep) x = sweep;
    427         nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    428         nit->second.it =
     440        nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
     441        nit->second->it =
    429442          beach.insert(std::make_pair(Part(prev, next, nnt), nit));
    430443      } else {
Note: See TracChangeset for help on using the changeset viewer.