COIN-OR::LEMON - Graph Library

Changes in / [832:5100072d83ca:944:b4af20d02ae0] in lemon-main


Ignore:
Files:
2 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r680 r927  
    33SET(PROJECT_NAME "LEMON")
    44PROJECT(${PROJECT_NAME})
     5
     6INCLUDE(FindPythonInterp)
     7INCLUDE(FindWget)
    58
    69IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
     
    1013ELSE()
    1114  EXECUTE_PROCESS(
     15    COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py
     16    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
     17    OUTPUT_VARIABLE HG_REVISION_PATH
     18    ERROR_QUIET
     19    OUTPUT_STRIP_TRAILING_WHITESPACE
     20  )
     21  EXECUTE_PROCESS(
    1222    COMMAND hg id -i
    1323    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
     
    1727  )
    1828  IF(HG_REVISION STREQUAL "")
    19     SET(HG_REVISION "hg-tip")
     29    SET(HG_REVISION_ID "hg-tip")
     30  ELSE()
     31    IF(HG_REVISION_PATH STREQUAL "")
     32      SET(HG_REVISION_ID ${HG_REVISION})
     33    ELSE()
     34      SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION})
     35    ENDIF()
    2036  ENDIF()
    21   SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
     37  SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.")
    2238ENDIF()
    2339
     
    3248FIND_PACKAGE(COIN)
    3349
     50IF(DEFINED ENV{LEMON_CXX_WARNING})
     51  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
     52ELSE()
     53  IF(CMAKE_COMPILER_IS_GNUCXX)
     54    SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
     55    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
     56    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
     57  ELSEIF(MSVC)
     58    # This part is unnecessary 'casue the same is set by the lemon/core.h.
     59    # Still keep it as an example.
     60    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
     61    # Suppressed warnings:
     62    # C4250: 'class1' : inherits 'class2::member' via dominance
     63    # C4355: 'this' : used in base member initializer list
     64    # C4503: 'function' : decorated name length exceeded, name was truncated
     65    # C4800: 'type' : forcing value to bool 'true' or 'false'
     66    #        (performance warning)
     67    # C4996: 'function': was declared deprecated
     68  ELSE()
     69    SET(CXX_WARNING "-Wall -W")
     70  ENDIF()
     71ENDIF()
     72SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
     73
     74SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
     75
     76SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING
     77    "Flags used by the C++ compiler during maintainer builds."
     78    FORCE )
     79SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING
     80    "Flags used by the C compiler during maintainer builds."
     81    FORCE )
     82SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
     83    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
     84    "Flags used for linking binaries during maintainer builds."
     85    FORCE )
     86SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
     87    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
     88    "Flags used by the shared libraries linker during maintainer builds."
     89    FORCE )
     90MARK_AS_ADVANCED(
     91    CMAKE_CXX_FLAGS_MAINTAINER
     92    CMAKE_C_FLAGS_MAINTAINER
     93    CMAKE_EXE_LINKER_FLAGS_MAINTAINER
     94    CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
     95
     96IF(CMAKE_CONFIGURATION_TYPES)
     97  LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
     98  LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
     99  SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
     100      "Add the configurations that we need"
     101      FORCE)
     102 endif()
     103
     104IF(NOT CMAKE_BUILD_TYPE)
     105  SET(CMAKE_BUILD_TYPE "Release")
     106ENDIF()
     107
     108SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
     109    "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
     110    FORCE )
     111
     112
    34113INCLUDE(CheckTypeSize)
    35114CHECK_TYPE_SIZE("long long" LONG_LONG)
     
    37116
    38117ENABLE_TESTING()
     118
     119IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     120  ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
     121ELSE()
     122  ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
     123ENDIF()
    39124
    40125ADD_SUBDIRECTORY(lemon)
     
    63148ENDIF()
    64149
    65 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32)
     150IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    66151  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    67152  SET(CPACK_PACKAGE_VENDOR "EGRES")
  • Makefile.am

    r629 r752  
    1818        cmake/FindGLPK.cmake \
    1919        cmake/FindCOIN.cmake \
     20        cmake/LEMONConfig.cmake.in \
    2021        cmake/version.cmake.in \
    2122        cmake/version.cmake \
  • configure.ac

    r680 r929  
    9999dnl Add dependencies on files generated by configure.
    100100AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
    101   ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
     101  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/doc/mainpage.dox.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
    102102
    103103AC_CONFIG_FILES([
     
    106106cmake/version.cmake
    107107doc/Doxyfile
     108doc/mainpage.dox
    108109lemon/lemon.pc
    109110])
  • doc/CMakeLists.txt

    r679 r929  
    44SET(abs_top_builddir ${PROJECT_BINARY_DIR})
    55
     6SET(LEMON_DOC_SOURCE_BROWSER "NO" CACHE STRING "Include source into the doc (YES/NO).")
     7
    68CONFIGURE_FILE(
    79  ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
    810  ${PROJECT_BINARY_DIR}/doc/Doxyfile
     11  @ONLY
     12)
     13
     14CONFIGURE_FILE(
     15  ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in
     16  ${PROJECT_BINARY_DIR}/doc/mainpage.dox
    917  @ONLY
    1018)
     
    5058
    5159ENDIF()
     60
     61IF(WGET_FOUND)
     62ADD_CUSTOM_TARGET(update-external-tags
     63  COMMAND ${CMAKE_COMMAND} -E make_directory dl
     64  # COMMAND ${CMAKE_COMMAND} -E copy libstdc++.tag dl
     65  COMMAND ${WGET_EXECUTABLE} wget -P dl -N libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag
     66  COMMAND ${CMAKE_COMMAND} -E rename dl/libstdc++.tag libstdc++.tag
     67  COMMAND ${CMAKE_COMMAND} -E remove dl/libstdc++.tag
     68  COMMAND ${CMAKE_COMMAND} -E remove_directory dl
     69  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     70  )
     71ENDIF()
  • doc/Doxyfile.in

    r367 r929  
    1 # Doxyfile 1.5.7.1
     1# Doxyfile 1.7.3
    22
    33#---------------------------------------------------------------------------
     
    55#---------------------------------------------------------------------------
    66DOXYFILE_ENCODING      = UTF-8
    7 PROJECT_NAME           = @PACKAGE_NAME@
    8 PROJECT_NUMBER         = @PACKAGE_VERSION@
     7PROJECT_NAME           =
     8PROJECT_NUMBER         =
     9PROJECT_BRIEF          =
     10PROJECT_LOGO           =
    911OUTPUT_DIRECTORY       =
    1012CREATE_SUBDIRS         = NO
     
    2224QT_AUTOBRIEF           = NO
    2325MULTILINE_CPP_IS_BRIEF = NO
    24 DETAILS_AT_TOP         = YES
    2526INHERIT_DOCS           = NO
    2627SEPARATE_MEMBER_PAGES  = NO
     
    3132OPTIMIZE_FOR_FORTRAN   = NO
    3233OPTIMIZE_OUTPUT_VHDL   = NO
     34EXTENSION_MAPPING      =
    3335BUILTIN_STL_SUPPORT    = YES
    3436CPP_CLI_SUPPORT        = NO
     
    5658HIDE_SCOPE_NAMES       = YES
    5759SHOW_INCLUDE_FILES     = YES
     60FORCE_LOCAL_INCLUDES   = NO
    5861INLINE_INFO            = YES
    5962SORT_MEMBER_DOCS       = NO
    6063SORT_BRIEF_DOCS        = NO
     64SORT_MEMBERS_CTORS_1ST = NO
    6165SORT_GROUP_NAMES       = NO
    6266SORT_BY_SCOPE_NAME     = NO
     67STRICT_PROTO_MATCHING  = NO
    6368GENERATE_TODOLIST      = YES
    6469GENERATE_TESTLIST      = YES
     
    7277SHOW_NAMESPACES        = YES
    7378FILE_VERSION_FILTER    =
    74 LAYOUT_FILE            = DoxygenLayout.xml
     79LAYOUT_FILE            = "@abs_top_srcdir@/doc/DoxygenLayout.xml"
    7580#---------------------------------------------------------------------------
    7681# configuration options related to warning and progress messages
     
    9297                         "@abs_top_srcdir@/demo" \
    9398                         "@abs_top_srcdir@/tools" \
    94                          "@abs_top_srcdir@/test/test_tools.h"
     99                         "@abs_top_srcdir@/test/test_tools.h" \
     100                         "@abs_top_builddir@/doc/mainpage.dox"
    95101INPUT_ENCODING         = UTF-8
    96102FILE_PATTERNS          = *.h \
     
    112118FILTER_PATTERNS        =
    113119FILTER_SOURCE_FILES    = NO
     120FILTER_SOURCE_PATTERNS =
    114121#---------------------------------------------------------------------------
    115122# configuration options related to source browsing
    116123#---------------------------------------------------------------------------
    117 SOURCE_BROWSER         = NO
     124SOURCE_BROWSER         = @LEMON_DOC_SOURCE_BROWSER@
    118125INLINE_SOURCES         = NO
    119126STRIP_CODE_COMMENTS    = YES
     
    138145HTML_FOOTER            =
    139146HTML_STYLESHEET        =
     147HTML_COLORSTYLE_HUE    = 220
     148HTML_COLORSTYLE_SAT    = 100
     149HTML_COLORSTYLE_GAMMA  = 80
     150HTML_TIMESTAMP         = YES
    140151HTML_ALIGN_MEMBERS     = YES
    141 HTML_DYNAMIC_SECTIONS  = NO
     152HTML_DYNAMIC_SECTIONS  = YES
    142153GENERATE_DOCSET        = NO
    143154DOCSET_FEEDNAME        = "Doxygen generated docs"
    144155DOCSET_BUNDLE_ID       = org.doxygen.Project
     156DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
     157DOCSET_PUBLISHER_NAME  = Publisher
    145158GENERATE_HTMLHELP      = NO
    146159CHM_FILE               =
     
    154167QHP_NAMESPACE          = org.doxygen.Project
    155168QHP_VIRTUAL_FOLDER     = doc
     169QHP_CUST_FILTER_NAME   =
     170QHP_CUST_FILTER_ATTRS  =
     171QHP_SECT_FILTER_ATTRS  =
    156172QHG_LOCATION           =
     173GENERATE_ECLIPSEHELP   = NO
     174ECLIPSE_DOC_ID         = org.doxygen.Project
    157175DISABLE_INDEX          = NO
    158176ENUM_VALUES_PER_LINE   = 4
    159177GENERATE_TREEVIEW      = NO
     178USE_INLINE_TREES       = NO
    160179TREEVIEW_WIDTH         = 250
     180EXT_LINKS_IN_WINDOW    = NO
    161181FORMULA_FONTSIZE       = 10
     182FORMULA_TRANSPARENT    = YES
     183USE_MATHJAX            = NO
     184MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
     185SEARCHENGINE           = YES
     186SERVER_BASED_SEARCH    = NO
    162187#---------------------------------------------------------------------------
    163188# configuration options related to the LaTeX output
     
    176201LATEX_BATCHMODE        = NO
    177202LATEX_HIDE_INDICES     = NO
     203LATEX_SOURCE_CODE      = NO
    178204#---------------------------------------------------------------------------
    179205# configuration options related to the RTF output
     
    224250SKIP_FUNCTION_MACROS   = YES
    225251#---------------------------------------------------------------------------
    226 # Configuration::additions related to external references   
    227 #---------------------------------------------------------------------------
    228 TAGFILES               = "@abs_top_srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/  "
     252# Configuration::additions related to external references
     253#---------------------------------------------------------------------------
     254TAGFILES               = "@abs_top_builddir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/  "
    229255GENERATE_TAGFILE       = html/lemon.tag
    230256ALLEXTERNALS           = NO
     
    238264HIDE_UNDOC_RELATIONS   = YES
    239265HAVE_DOT               = YES
     266DOT_NUM_THREADS        = 0
    240267DOT_FONTNAME           = FreeSans
    241268DOT_FONTSIZE           = 10
     
    255282DOT_PATH               =
    256283DOTFILE_DIRS           =
     284MSCFILE_DIRS           =
    257285DOT_GRAPH_MAX_NODES    = 50
    258286MAX_DOT_GRAPH_DEPTH    = 0
     
    261289GENERATE_LEGEND        = YES
    262290DOT_CLEANUP            = YES
    263 #---------------------------------------------------------------------------
    264 # Configuration::additions related to the search engine   
    265 #---------------------------------------------------------------------------
    266 SEARCHENGINE           = NO
  • doc/DoxygenLayout.xml

    r316 r928  
    33  <navindex>
    44    <tab type="mainpage" visible="yes" title=""/>
    5     <tab type="modules" visible="yes" title=""/>
     5    <tab type="modules" visible="yes" title="" intro=""/>
    66    <tab type="classes" visible="yes" title="">
    7       <tab type="classes" visible="yes" title=""/>
    8       <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 
    9       <tab type="hierarchy" visible="yes" title=""/>
    10       <tab type="classmembers" visible="yes" title=""/>
     7      <tab type="classes" visible="yes" title="" intro=""/>
     8      <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
     9      <tab type="hierarchy" visible="yes" title="" intro=""/>
     10      <tab type="classmembers" visible="yes" title="" intro=""/>
    1111    </tab>
    1212    <tab type="namespaces" visible="yes" title="">
    13       <tab type="namespaces" visible="yes" title=""/>
    14       <tab type="namespacemembers" visible="yes" title=""/>
     13      <tab type="namespaces" visible="yes" title="" intro=""/>
     14      <tab type="namespacemembers" visible="yes" title="" intro=""/>
    1515    </tab>
    1616    <tab type="files" visible="yes" title="">
    17       <tab type="files" visible="yes" title=""/>
    18       <tab type="globals" visible="yes" title=""/>
     17      <tab type="files" visible="yes" title="" intro=""/>
     18      <tab type="globals" visible="yes" title="" intro=""/>
    1919    </tab>
    20     <tab type="dirs" visible="yes" title=""/>
    21     <tab type="examples" visible="yes" title=""/> 
    22     <tab type="pages" visible="yes" title=""/>
     20    <tab type="dirs" visible="yes" title="" intro=""/>
     21    <tab type="examples" visible="yes" title="" intro=""/>
     22    <tab type="pages" visible="yes" title="" intro=""/>
    2323  </navindex>
    2424
  • lemon/CMakeLists.txt

    r679 r908  
    77  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
    88  ${CMAKE_CURRENT_BINARY_DIR}/config.h
     9)
     10
     11CONFIGURE_FILE(
     12  ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.cmake
     13  ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
     14  @ONLY
    915)
    1016
     
    6773  COMPONENT headers
    6874)
     75
     76INSTALL(
     77  FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
     78  DESTINATION lib/pkgconfig
     79)
     80
  • lemon/circulation.h

    r641 r688  
    454454    ///
    455455    /// Sets the tolerance used by algorithm.
    456     Circulation& tolerance(const Tolerance& tolerance) const {
     456    Circulation& tolerance(const Tolerance& tolerance) {
    457457      _tol = tolerance;
    458458      return *this;
     
    463463    /// Returns a const reference to the tolerance.
    464464    const Tolerance& tolerance() const {
    465       return tolerance;
     465      return _tol;
    466466    }
    467467
  • lemon/matching.h

    r651 r867  
    806806        _matching = new MatchingMap(_graph);
    807807      }
     808
    808809      if (!_node_potential) {
    809810        _node_potential = new NodePotential(_graph);
    810811      }
     812
    811813      if (!_blossom_set) {
    812814        _blossom_index = new IntNodeMap(_graph);
    813815        _blossom_set = new BlossomSet(*_blossom_index);
    814816        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
     817      } else if (_blossom_data->size() != _blossom_num) {
     818        delete _blossom_data;
     819        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
    815820      }
    816821
     
    819824        _node_heap_index = new IntArcMap(_graph);
    820825        _node_data = new RangeMap<NodeData>(_node_num,
    821                                               NodeData(*_node_heap_index));
     826                                            NodeData(*_node_heap_index));
     827      } else {
     828        delete _node_data;
     829        _node_data = new RangeMap<NodeData>(_node_num,
     830                                            NodeData(*_node_heap_index));
    822831      }
    823832
     
    825834        _tree_set_index = new IntIntMap(_blossom_num);
    826835        _tree_set = new TreeSet(*_tree_set_index);
    827       }
     836      } else {
     837        _tree_set_index->resize(_blossom_num);
     838      }
     839
    828840      if (!_delta1) {
    829841        _delta1_index = new IntNodeMap(_graph);
    830842        _delta1 = new BinHeap<Value, IntNodeMap>(*_delta1_index);
    831843      }
     844
    832845      if (!_delta2) {
    833846        _delta2_index = new IntIntMap(_blossom_num);
    834847        _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index);
    835       }
     848      } else {
     849        _delta2_index->resize(_blossom_num);
     850      }
     851
    836852      if (!_delta3) {
    837853        _delta3_index = new IntEdgeMap(_graph);
    838854        _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index);
    839855      }
     856
    840857      if (!_delta4) {
    841858        _delta4_index = new IntIntMap(_blossom_num);
    842859        _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index);
     860      } else {
     861        _delta4_index->resize(_blossom_num);
    843862      }
    844863    }
     
    16861705      createStructures();
    16871706
     1707      _blossom_node_list.clear();
     1708      _blossom_potential.clear();
     1709
    16881710      for (ArcIt e(_graph); e != INVALID; ++e) {
    16891711        (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP;
     
    16991721        (*_delta4_index)[i] = _delta4->PRE_HEAP;
    17001722      }
     1723     
     1724      _delta1->clear();
     1725      _delta2->clear();
     1726      _delta3->clear();
     1727      _delta4->clear();
     1728      _blossom_set->clear();
     1729      _tree_set->clear();
    17011730
    17021731      int index = 0;
     
    17101739        }
    17111740        (*_node_index)[n] = index;
     1741        (*_node_data)[index].heap_index.clear();
     1742        (*_node_data)[index].heap.clear();
    17121743        (*_node_data)[index].pot = max;
    17131744        _delta1->push(n, max);
     
    21992230        _matching = new MatchingMap(_graph);
    22002231      }
     2232
    22012233      if (!_node_potential) {
    22022234        _node_potential = new NodePotential(_graph);
    22032235      }
     2236
    22042237      if (!_blossom_set) {
    22052238        _blossom_index = new IntNodeMap(_graph);
    22062239        _blossom_set = new BlossomSet(*_blossom_index);
     2240        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
     2241      } else if (_blossom_data->size() != _blossom_num) {
     2242        delete _blossom_data;
    22072243        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
    22082244      }
     
    22132249        _node_data = new RangeMap<NodeData>(_node_num,
    22142250                                            NodeData(*_node_heap_index));
     2251      } else if (_node_data->size() != _node_num) {
     2252        delete _node_data;
     2253        _node_data = new RangeMap<NodeData>(_node_num,
     2254                                            NodeData(*_node_heap_index));
    22152255      }
    22162256
     
    22182258        _tree_set_index = new IntIntMap(_blossom_num);
    22192259        _tree_set = new TreeSet(*_tree_set_index);
    2220       }
     2260      } else {
     2261        _tree_set_index->resize(_blossom_num);
     2262      }
     2263
    22212264      if (!_delta2) {
    22222265        _delta2_index = new IntIntMap(_blossom_num);
    22232266        _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index);
    2224       }
     2267      } else {
     2268        _delta2_index->resize(_blossom_num);
     2269      }
     2270
    22252271      if (!_delta3) {
    22262272        _delta3_index = new IntEdgeMap(_graph);
    22272273        _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index);
    22282274      }
     2275
    22292276      if (!_delta4) {
    22302277        _delta4_index = new IntIntMap(_blossom_num);
    22312278        _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index);
     2279      } else {
     2280        _delta4_index->resize(_blossom_num);
    22322281      }
    22332282    }
     
    29272976      createStructures();
    29282977
     2978      _blossom_node_list.clear();
     2979      _blossom_potential.clear();
     2980
    29292981      for (ArcIt e(_graph); e != INVALID; ++e) {
    29302982        (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP;
     
    29372989        (*_delta4_index)[i] = _delta4->PRE_HEAP;
    29382990      }
     2991
     2992      _delta2->clear();
     2993      _delta3->clear();
     2994      _delta4->clear();
     2995      _blossom_set->clear();
     2996      _tree_set->clear();
    29392997
    29402998      int index = 0;
     
    29483006        }
    29493007        (*_node_index)[n] = index;
     3008        (*_node_data)[index].heap_index.clear();
     3009        (*_node_data)[index].heap.clear();
    29503010        (*_node_data)[index].pot = max;
    29513011        int blossom =
  • lemon/network_simplex.h

    r663 r888  
    10431043        ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
    10441044      } else {
    1045         ART_COST = std::numeric_limits<Cost>::min();
     1045        ART_COST = 0;
    10461046        for (int i = 0; i != _arc_num; ++i) {
    10471047          if (_cost[i] > ART_COST) ART_COST = _cost[i];
     
    14581458      if (_sum_supply == 0) {
    14591459        if (_stype == GEQ) {
    1460           Cost max_pot = std::numeric_limits<Cost>::min();
     1460          Cost max_pot = -std::numeric_limits<Cost>::max();
    14611461          for (int i = 0; i != _node_num; ++i) {
    14621462            if (_pi[i] > max_pot) max_pot = _pi[i];
  • lemon/preflow.h

    r641 r923  
    375375    ///
    376376    /// Sets the tolerance used by algorithm.
    377     Preflow& tolerance(const Tolerance& tolerance) const {
     377    Preflow& tolerance(const Tolerance& tolerance) {
    378378      _tolerance = tolerance;
    379379      return *this;
     
    384384    /// Returns a const reference to the tolerance.
    385385    const Tolerance& tolerance() const {
    386       return tolerance;
     386      return _tolerance;
    387387    }
    388388
     
    526526          _flow->set(e, (*_capacity)[e]);
    527527          (*_excess)[u] += rem;
    528           if (u != _target && !_level->active(u)) {
    529             _level->activate(u);
    530           }
    531528        }
    532529      }
     
    538535          _flow->set(e, 0);
    539536          (*_excess)[v] += rem;
    540           if (v != _target && !_level->active(v)) {
    541             _level->activate(v);
    542           }
    543         }
    544       }
     537        }
     538      }
     539      for (NodeIt n(_graph); n != INVALID; ++n)
     540        if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n]))
     541          _level->activate(n);
     542         
    545543      return true;
    546544    }
     
    559557      _phase = true;
    560558
    561       Node n = _level->highestActive();
    562       int level = _level->highestActiveLevel();
    563       while (n != INVALID) {
     559      while (true) {
    564560        int num = _node_num;
    565561
    566         while (num > 0 && n != INVALID) {
     562        Node n = INVALID;
     563        int level = -1;
     564
     565        while (num > 0) {
     566          n = _level->highestActive();
     567          if (n == INVALID) goto first_phase_done;
     568          level = _level->highestActiveLevel();
     569          --num;
     570         
    567571          Value excess = (*_excess)[n];
    568572          int new_level = _level->maxLevel();
     
    630634            _level->deactivate(n);
    631635          }
    632 
    633           n = _level->highestActive();
    634           level = _level->highestActiveLevel();
     636        }
     637
     638        num = _node_num * 20;
     639        while (num > 0) {
     640          while (level >= 0 && _level->activeFree(level)) {
     641            --level;
     642          }
     643          if (level == -1) {
     644            n = _level->highestActive();
     645            level = _level->highestActiveLevel();
     646            if (n == INVALID) goto first_phase_done;
     647          } else {
     648            n = _level->activeOn(level);
     649          }
    635650          --num;
    636         }
    637 
    638         num = _node_num * 20;
    639         while (num > 0 && n != INVALID) {
     651
    640652          Value excess = (*_excess)[n];
    641653          int new_level = _level->maxLevel();
     
    703715            _level->deactivate(n);
    704716          }
    705 
    706           while (level >= 0 && _level->activeFree(level)) {
    707             --level;
    708           }
    709           if (level == -1) {
    710             n = _level->highestActive();
    711             level = _level->highestActiveLevel();
    712           } else {
    713             n = _level->activeOn(level);
    714           }
    715           --num;
    716         }
    717       }
     717        }
     718      }
     719    first_phase_done:;
    718720    }
    719721
  • lemon/suurballe.h

    r623 r852  
    5656  /// The default value is <tt>GR::ArcMap<int></tt>.
    5757  ///
    58   /// \warning Length values should be \e non-negative \e integers.
     58  /// \warning Length values should be \e non-negative.
    5959  ///
    6060  /// \note For finding node-disjoint paths this algorithm can be used
     
    253253      _graph(graph), _length(length), _flow(0), _local_flow(false),
    254254      _potential(0), _local_potential(false), _pred(graph)
    255     {
    256       LEMON_ASSERT(std::numeric_limits<Length>::is_integer,
    257         "The length type of Suurballe must be integer");
    258     }
     255    {}
    259256
    260257    /// Destructor.
     
    521518    /// \pre \ref run() or \ref findPaths() must be called before using
    522519    /// this function.
    523     Path path(int i) const {
     520    const Path& path(int i) const {
    524521      return paths[i];
    525522    }
  • lemon/unionfind.h

    r559 r867  
    740740    void clear() {
    741741      items.clear();
    742       classes.clear;
     742      classes.clear();
    743743      firstClass = firstFreeClass = firstFreeItem = -1;
    744744    }
     
    12891289        first_free_class(-1), first_free_node(-1) {}
    12901290
     1291    /// \brief Clears the union-find data structure
     1292    ///
     1293    /// Erase each item from the data structure.
     1294    void clear() {
     1295      nodes.clear();
     1296      classes.clear();
     1297      first_free_node = first_free_class = first_class = -1;
     1298    }
     1299
    12911300    /// \brief Insert a new node into a new component.
    12921301    ///
  • m4/lx_check_coin.m4

    r627 r749  
    8989        CBC_LDFLAGS="-L$with_coin/lib"
    9090      fi
    91       CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
     91      CBC_LIBS="-lOsi -lCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"
    9292
    9393      lx_save_cxxflags="$CXXFLAGS"
  • test/CMakeLists.txt

    r679 r933  
    77  ${PROJECT_BINARY_DIR}/lemon
    88)
     9
     10SET(TEST_WITH_VALGRIND "NO" CACHE STRING
     11  "Run the test with valgrind (YES/NO).")
     12SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
    913
    1014SET(TESTS
     
    4246
    4347IF(LEMON_HAVE_LP)
    44   ADD_EXECUTABLE(lp_test lp_test.cc)
     48  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     49    ADD_EXECUTABLE(lp_test lp_test.cc)
     50  ELSE()
     51    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
     52  ENDIF()
     53
    4554  SET(LP_TEST_LIBS lemon)
    4655
     
    7887
    7988IF(LEMON_HAVE_MIP)
    80   ADD_EXECUTABLE(mip_test mip_test.cc)
     89  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     90    ADD_EXECUTABLE(mip_test mip_test.cc)
     91  ELSE()
     92    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
     93  ENDIF()
     94
    8195  SET(MIP_TEST_LIBS lemon)
    8296
     
    114128
    115129FOREACH(TEST_NAME ${TESTS})
    116   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
     130  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     131    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
     132  ELSE()
     133    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
     134  ENDIF()
    117135  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
    118   ADD_TEST(${TEST_NAME} ${TEST_NAME})
     136    IF(TEST_WITH_VALGRIND)
     137      ADD_TEST(${TEST_NAME}
     138        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
     139        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
     140    ELSE()
     141      ADD_TEST(${TEST_NAME} ${TEST_NAME})
     142    ENDIF()
     143  ADD_DEPENDENCIES(check ${TEST_NAME})
    119144ENDFOREACH()
  • test/mip_test.cc

    r631 r748  
    5151  if (stat ==  MipSolver::OPTIMAL) {
    5252    std::ostringstream sbuf;
    53     buf << "Wrong optimal value: the right optimum is " << exp_opt;
     53    sbuf << "Wrong optimal value ("<< mip.solValue()
     54         <<" instead of " << exp_opt << ")";
    5455    check(std::abs(mip.solValue()-exp_opt) < 1e-3, sbuf.str());
    5556    //+ecvt(exp_opt,2)
  • test/preflow_test.cc

    r585 r923  
    152152}
    153153
     154void initFlowTest()
     155{
     156  DIGRAPH_TYPEDEFS(SmartDigraph);
     157 
     158  SmartDigraph g;
     159  SmartDigraph::ArcMap<int> cap(g),iflow(g);
     160  Node s=g.addNode(); Node t=g.addNode();
     161  Node n1=g.addNode(); Node n2=g.addNode();
     162  Arc a;
     163  a=g.addArc(s,n1); cap[a]=20; iflow[a]=20;
     164  a=g.addArc(n1,n2); cap[a]=10; iflow[a]=0;
     165  a=g.addArc(n2,t); cap[a]=20; iflow[a]=0;
     166
     167  Preflow<SmartDigraph> pre(g,cap,s,t);
     168  pre.init(iflow);
     169  pre.startFirstPhase();
     170  check(pre.flowValue() == 10, "The incorrect max flow value.");
     171  check(pre.minCut(s), "Wrong min cut (Node s).");
     172  check(pre.minCut(n1), "Wrong min cut (Node n1).");
     173  check(!pre.minCut(n2), "Wrong min cut (Node n2).");
     174  check(!pre.minCut(t), "Wrong min cut (Node t).");
     175}
     176
     177
    154178int main() {
    155179
     
    242266        "The max flow value or the three min cut values are incorrect.");
    243267
     268  initFlowTest();
     269 
    244270  return 0;
    245271}
Note: See TracChangeset for help on using the changeset viewer.