Changes in / [962:4efe7b32b134:685:a27356ceb5bd] in lemon-main
- Files:
-
- 1 added
- 6 deleted
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
AUTHORS
r951 r320 24 24 25 25 Again, please visit the history of the old LEMON repository for more 26 details: http://lemon.cs.elte.hu/ hg/lemon-0.x26 details: http://lemon.cs.elte.hu/svn/lemon/trunk -
CMakeLists.txt
r940 r680 3 3 SET(PROJECT_NAME "LEMON") 4 4 PROJECT(${PROJECT_NAME}) 5 6 INCLUDE(FindPythonInterp)7 INCLUDE(FindWget)8 5 9 6 IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) … … 12 9 SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") 13 10 ELSE() 14 EXECUTE_PROCESS(15 COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py16 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}17 OUTPUT_VARIABLE HG_REVISION_PATH18 ERROR_QUIET19 OUTPUT_STRIP_TRAILING_WHITESPACE20 )21 11 EXECUTE_PROCESS( 22 12 COMMAND hg id -i … … 27 17 ) 28 18 IF(HG_REVISION STREQUAL "") 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() 19 SET(HG_REVISION "hg-tip") 36 20 ENDIF() 37 SET(LEMON_VERSION ${HG_REVISION _ID} CACHE STRING "LEMON version string.")21 SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.") 38 22 ENDIF() 39 23 … … 48 32 FIND_PACKAGE(COIN) 49 33 50 IF(DEFINED ENV{LEMON_CXX_WARNING})51 SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})52 ELSE()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 -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 dominance63 # C4355: 'this' : used in base member initializer list64 # C4503: 'function' : decorated name length exceeded, name was truncated65 # C4800: 'type' : forcing value to bool 'true' or 'false'66 # (performance warning)67 # C4996: 'function': was declared deprecated68 ELSE()69 SET(CXX_WARNING "-Wall -W")70 ENDIF()71 ENDIF()72 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")73 74 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")75 76 SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING77 "Flags used by the C++ compiler during maintainer builds."78 FORCE )79 SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING80 "Flags used by the C compiler during maintainer builds."81 FORCE )82 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER83 "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING84 "Flags used for linking binaries during maintainer builds."85 FORCE )86 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER87 "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING88 "Flags used by the shared libraries linker during maintainer builds."89 FORCE )90 MARK_AS_ADVANCED(91 CMAKE_CXX_FLAGS_MAINTAINER92 CMAKE_C_FLAGS_MAINTAINER93 CMAKE_EXE_LINKER_FLAGS_MAINTAINER94 CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )95 96 IF(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 STRING100 "Add the configurations that we need"101 FORCE)102 endif()103 104 IF(NOT CMAKE_BUILD_TYPE)105 SET(CMAKE_BUILD_TYPE "Release")106 ENDIF()107 108 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING109 "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 113 34 INCLUDE(CheckTypeSize) 114 35 CHECK_TYPE_SIZE("long long" LONG_LONG) … … 116 37 117 38 ENABLE_TESTING() 118 119 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")120 ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})121 ELSE()122 ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})123 ENDIF()124 39 125 40 ADD_SUBDIRECTORY(lemon) … … 148 63 ENDIF() 149 64 150 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )65 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32) 151 66 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 152 67 SET(CPACK_PACKAGE_VENDOR "EGRES") -
Makefile.am
r752 r629 18 18 cmake/FindGLPK.cmake \ 19 19 cmake/FindCOIN.cmake \ 20 cmake/LEMONConfig.cmake.in \21 20 cmake/version.cmake.in \ 22 21 cmake/version.cmake \ -
cmake/FindCOIN.cmake
r947 r634 6 6 FIND_LIBRARY(COIN_CBC_LIBRARY 7 7 NAMES Cbc libCbc 8 HINTS ${COIN_ROOT_DIR}/lib/coin9 8 HINTS ${COIN_ROOT_DIR}/lib 10 9 ) 11 10 FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY 12 11 NAMES CbcSolver libCbcSolver 13 HINTS ${COIN_ROOT_DIR}/lib/coin14 12 HINTS ${COIN_ROOT_DIR}/lib 15 13 ) 16 14 FIND_LIBRARY(COIN_CGL_LIBRARY 17 15 NAMES Cgl libCgl 18 HINTS ${COIN_ROOT_DIR}/lib/coin19 16 HINTS ${COIN_ROOT_DIR}/lib 20 17 ) 21 18 FIND_LIBRARY(COIN_CLP_LIBRARY 22 19 NAMES Clp libClp 23 HINTS ${COIN_ROOT_DIR}/lib/coin24 20 HINTS ${COIN_ROOT_DIR}/lib 25 21 ) 26 22 FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY 27 23 NAMES CoinUtils libCoinUtils 28 HINTS ${COIN_ROOT_DIR}/lib/coin29 24 HINTS ${COIN_ROOT_DIR}/lib 30 25 ) 31 26 FIND_LIBRARY(COIN_OSI_LIBRARY 32 27 NAMES Osi libOsi 33 HINTS ${COIN_ROOT_DIR}/lib/coin34 28 HINTS ${COIN_ROOT_DIR}/lib 35 29 ) 36 30 FIND_LIBRARY(COIN_OSI_CBC_LIBRARY 37 31 NAMES OsiCbc libOsiCbc 38 HINTS ${COIN_ROOT_DIR}/lib/coin39 32 HINTS ${COIN_ROOT_DIR}/lib 40 33 ) 41 34 FIND_LIBRARY(COIN_OSI_CLP_LIBRARY 42 35 NAMES OsiClp libOsiClp 43 HINTS ${COIN_ROOT_DIR}/lib/coin44 36 HINTS ${COIN_ROOT_DIR}/lib 45 37 ) 46 38 FIND_LIBRARY(COIN_OSI_VOL_LIBRARY 47 39 NAMES OsiVol libOsiVol 48 HINTS ${COIN_ROOT_DIR}/lib/coin49 40 HINTS ${COIN_ROOT_DIR}/lib 50 41 ) 51 42 FIND_LIBRARY(COIN_VOL_LIBRARY 52 43 NAMES Vol libVol 53 HINTS ${COIN_ROOT_DIR}/lib/coin54 44 HINTS ${COIN_ROOT_DIR}/lib 55 45 ) … … 66 56 COIN_OSI_CBC_LIBRARY 67 57 COIN_OSI_CLP_LIBRARY 68 #COIN_OSI_VOL_LIBRARY69 #COIN_VOL_LIBRARY58 COIN_OSI_VOL_LIBRARY 59 COIN_VOL_LIBRARY 70 60 ) 71 61 72 62 IF(COIN_FOUND) 73 63 SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR}) 74 SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY} ")64 SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_OSI_VOL_LIBRARY};${COIN_VOL_LIBRARY}") 75 65 SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}") 76 66 SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES}) -
configure.ac
r929 r680 99 99 dnl Add dependencies on files generated by configure. 100 100 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], 101 ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/ doc/mainpage.dox.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])101 ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in']) 102 102 103 103 AC_CONFIG_FILES([ … … 106 106 cmake/version.cmake 107 107 doc/Doxyfile 108 doc/mainpage.dox109 108 lemon/lemon.pc 110 109 ]) -
doc/CMakeLists.txt
r929 r679 4 4 SET(abs_top_builddir ${PROJECT_BINARY_DIR}) 5 5 6 SET(LEMON_DOC_SOURCE_BROWSER "NO" CACHE STRING "Include source into the doc (YES/NO).")7 8 6 CONFIGURE_FILE( 9 7 ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 10 8 ${PROJECT_BINARY_DIR}/doc/Doxyfile 11 @ONLY12 )13 14 CONFIGURE_FILE(15 ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in16 ${PROJECT_BINARY_DIR}/doc/mainpage.dox17 9 @ONLY 18 10 ) … … 58 50 59 51 ENDIF() 60 61 IF(WGET_FOUND)62 ADD_CUSTOM_TARGET(update-external-tags63 COMMAND ${CMAKE_COMMAND} -E make_directory dl64 # COMMAND ${CMAKE_COMMAND} -E copy libstdc++.tag dl65 COMMAND ${WGET_EXECUTABLE} wget -P dl -N libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag66 COMMAND ${CMAKE_COMMAND} -E rename dl/libstdc++.tag libstdc++.tag67 COMMAND ${CMAKE_COMMAND} -E remove dl/libstdc++.tag68 COMMAND ${CMAKE_COMMAND} -E remove_directory dl69 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}70 )71 ENDIF() -
doc/Doxyfile.in
r929 r367 1 # Doxyfile 1. 7.31 # Doxyfile 1.5.7.1 2 2 3 3 #--------------------------------------------------------------------------- … … 5 5 #--------------------------------------------------------------------------- 6 6 DOXYFILE_ENCODING = UTF-8 7 PROJECT_NAME = 8 PROJECT_NUMBER = 9 PROJECT_BRIEF = 10 PROJECT_LOGO = 7 PROJECT_NAME = @PACKAGE_NAME@ 8 PROJECT_NUMBER = @PACKAGE_VERSION@ 11 9 OUTPUT_DIRECTORY = 12 10 CREATE_SUBDIRS = NO … … 24 22 QT_AUTOBRIEF = NO 25 23 MULTILINE_CPP_IS_BRIEF = NO 24 DETAILS_AT_TOP = YES 26 25 INHERIT_DOCS = NO 27 26 SEPARATE_MEMBER_PAGES = NO … … 32 31 OPTIMIZE_FOR_FORTRAN = NO 33 32 OPTIMIZE_OUTPUT_VHDL = NO 34 EXTENSION_MAPPING =35 33 BUILTIN_STL_SUPPORT = YES 36 34 CPP_CLI_SUPPORT = NO … … 58 56 HIDE_SCOPE_NAMES = YES 59 57 SHOW_INCLUDE_FILES = YES 60 FORCE_LOCAL_INCLUDES = NO61 58 INLINE_INFO = YES 62 59 SORT_MEMBER_DOCS = NO 63 60 SORT_BRIEF_DOCS = NO 64 SORT_MEMBERS_CTORS_1ST = NO65 61 SORT_GROUP_NAMES = NO 66 62 SORT_BY_SCOPE_NAME = NO 67 STRICT_PROTO_MATCHING = NO68 63 GENERATE_TODOLIST = YES 69 64 GENERATE_TESTLIST = YES … … 77 72 SHOW_NAMESPACES = YES 78 73 FILE_VERSION_FILTER = 79 LAYOUT_FILE = "@abs_top_srcdir@/doc/DoxygenLayout.xml"74 LAYOUT_FILE = DoxygenLayout.xml 80 75 #--------------------------------------------------------------------------- 81 76 # configuration options related to warning and progress messages … … 97 92 "@abs_top_srcdir@/demo" \ 98 93 "@abs_top_srcdir@/tools" \ 99 "@abs_top_srcdir@/test/test_tools.h" \ 100 "@abs_top_builddir@/doc/mainpage.dox" 94 "@abs_top_srcdir@/test/test_tools.h" 101 95 INPUT_ENCODING = UTF-8 102 96 FILE_PATTERNS = *.h \ … … 118 112 FILTER_PATTERNS = 119 113 FILTER_SOURCE_FILES = NO 120 FILTER_SOURCE_PATTERNS =121 114 #--------------------------------------------------------------------------- 122 115 # configuration options related to source browsing 123 116 #--------------------------------------------------------------------------- 124 SOURCE_BROWSER = @LEMON_DOC_SOURCE_BROWSER@117 SOURCE_BROWSER = NO 125 118 INLINE_SOURCES = NO 126 119 STRIP_CODE_COMMENTS = YES … … 145 138 HTML_FOOTER = 146 139 HTML_STYLESHEET = 147 HTML_COLORSTYLE_HUE = 220148 HTML_COLORSTYLE_SAT = 100149 HTML_COLORSTYLE_GAMMA = 80150 HTML_TIMESTAMP = YES151 140 HTML_ALIGN_MEMBERS = YES 152 HTML_DYNAMIC_SECTIONS = YES141 HTML_DYNAMIC_SECTIONS = NO 153 142 GENERATE_DOCSET = NO 154 143 DOCSET_FEEDNAME = "Doxygen generated docs" 155 144 DOCSET_BUNDLE_ID = org.doxygen.Project 156 DOCSET_PUBLISHER_ID = org.doxygen.Publisher157 DOCSET_PUBLISHER_NAME = Publisher158 145 GENERATE_HTMLHELP = NO 159 146 CHM_FILE = … … 167 154 QHP_NAMESPACE = org.doxygen.Project 168 155 QHP_VIRTUAL_FOLDER = doc 169 QHP_CUST_FILTER_NAME =170 QHP_CUST_FILTER_ATTRS =171 QHP_SECT_FILTER_ATTRS =172 156 QHG_LOCATION = 173 GENERATE_ECLIPSEHELP = NO174 ECLIPSE_DOC_ID = org.doxygen.Project175 157 DISABLE_INDEX = NO 176 158 ENUM_VALUES_PER_LINE = 4 177 159 GENERATE_TREEVIEW = NO 178 USE_INLINE_TREES = NO179 160 TREEVIEW_WIDTH = 250 180 EXT_LINKS_IN_WINDOW = NO181 161 FORMULA_FONTSIZE = 10 182 FORMULA_TRANSPARENT = YES183 USE_MATHJAX = NO184 MATHJAX_RELPATH = http://www.mathjax.org/mathjax185 SEARCHENGINE = YES186 SERVER_BASED_SEARCH = NO187 162 #--------------------------------------------------------------------------- 188 163 # configuration options related to the LaTeX output … … 201 176 LATEX_BATCHMODE = NO 202 177 LATEX_HIDE_INDICES = NO 203 LATEX_SOURCE_CODE = NO204 178 #--------------------------------------------------------------------------- 205 179 # configuration options related to the RTF output … … 250 224 SKIP_FUNCTION_MACROS = YES 251 225 #--------------------------------------------------------------------------- 252 # Configuration::additions related to external references 253 #--------------------------------------------------------------------------- 254 TAGFILES = "@abs_top_ builddir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/ "226 # Configuration::additions related to external references 227 #--------------------------------------------------------------------------- 228 TAGFILES = "@abs_top_srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/ " 255 229 GENERATE_TAGFILE = html/lemon.tag 256 230 ALLEXTERNALS = NO … … 264 238 HIDE_UNDOC_RELATIONS = YES 265 239 HAVE_DOT = YES 266 DOT_NUM_THREADS = 0267 240 DOT_FONTNAME = FreeSans 268 241 DOT_FONTSIZE = 10 … … 282 255 DOT_PATH = 283 256 DOTFILE_DIRS = 284 MSCFILE_DIRS =285 257 DOT_GRAPH_MAX_NODES = 50 286 258 MAX_DOT_GRAPH_DEPTH = 0 … … 289 261 GENERATE_LEGEND = YES 290 262 DOT_CLEANUP = YES 263 #--------------------------------------------------------------------------- 264 # Configuration::additions related to the search engine 265 #--------------------------------------------------------------------------- 266 SEARCHENGINE = NO -
doc/DoxygenLayout.xml
r928 r316 3 3 <navindex> 4 4 <tab type="mainpage" visible="yes" title=""/> 5 <tab type="modules" visible="yes" title="" intro=""/>5 <tab type="modules" visible="yes" title=""/> 6 6 <tab type="classes" 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=""/>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=""/> 11 11 </tab> 12 12 <tab type="namespaces" visible="yes" title=""> 13 <tab type="namespaces" visible="yes" title="" intro=""/>14 <tab type="namespacemembers" visible="yes" title="" intro=""/>13 <tab type="namespaces" visible="yes" title=""/> 14 <tab type="namespacemembers" visible="yes" title=""/> 15 15 </tab> 16 16 <tab type="files" visible="yes" title=""> 17 <tab type="files" visible="yes" title="" intro=""/>18 <tab type="globals" visible="yes" title="" intro=""/>17 <tab type="files" visible="yes" title=""/> 18 <tab type="globals" visible="yes" title=""/> 19 19 </tab> 20 <tab type="dirs" visible="yes" title="" intro=""/>21 <tab type="examples" visible="yes" title="" intro=""/>22 <tab type="pages" visible="yes" title="" intro=""/>20 <tab type="dirs" visible="yes" title=""/> 21 <tab type="examples" visible="yes" title=""/> 22 <tab type="pages" visible="yes" title=""/> 23 23 </navindex> 24 24 -
doc/lgf.dox
r950 r440 64 64 \endcode 65 65 66 The \c \@arcs section is very similar to the \c \@nodes section, it67 again starts with a header line describing the names of the maps, but 68 the \c "label" map is not obligatory here. The following lines69 describe the arcs. The first two tokens of each line are the source70 and the target node of the arc, respectively, then come the map66 The \c \@arcs section is very similar to the \c \@nodes section, 67 it again starts with a header line describing the names of the maps, 68 but the \c "label" map is not obligatory here. The following lines 69 describe the arcs. The first two tokens of each line are 70 the source and the target node of the arc, respectively, then come the map 71 71 values. The source and target tokens must be node labels. 72 72 … … 79 79 \endcode 80 80 81 If there is no map in the \c \@arcs section at all, then it must be82 indicated by a sole '-' sign in the first line.83 84 \code85 @arcs86 -87 1 288 1 389 2 390 \endcode91 92 81 The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can 93 82 also store the edge set of an undirected graph. In such case there is 94 83 a conventional method for store arc maps in the file, if two columns 95 ha vethe same caption with \c '+' and \c '-' prefix, then these columns84 has the same caption with \c '+' and \c '-' prefix, then these columns 96 85 can be regarded as the values of an arc map. 97 86 -
lemon/CMakeLists.txt
r908 r679 7 7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake 8 8 ${CMAKE_CURRENT_BINARY_DIR}/config.h 9 )10 11 CONFIGURE_FILE(12 ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.cmake13 ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc14 @ONLY15 9 ) 16 10 … … 73 67 COMPONENT headers 74 68 ) 75 76 INSTALL(77 FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc78 DESTINATION lib/pkgconfig79 )80 -
lemon/Makefile.am
r959 r667 1 1 EXTRA_DIST += \ 2 2 lemon/lemon.pc.in \ 3 lemon/lemon.pc.cmake \4 3 lemon/CMakeLists.txt \ 5 4 lemon/config.h.cmake … … 61 60 lemon/bfs.h \ 62 61 lemon/bin_heap.h \ 63 lemon/bucket_heap.h \64 62 lemon/cbc.h \ 65 63 lemon/circulation.h \ … … 79 77 lemon/error.h \ 80 78 lemon/euler.h \ 81 lemon/fib_heap.h \82 79 lemon/full_graph.h \ 83 80 lemon/glpk.h \ … … 103 100 lemon/path.h \ 104 101 lemon/preflow.h \ 105 lemon/radix_heap.h \106 102 lemon/radix_sort.h \ 107 103 lemon/random.h \ -
lemon/bin_heap.h
r683 r584 34 34 ///\brief A Binary Heap implementation. 35 35 /// 36 ///This class implements the \e binary \e heap data structure. 37 /// 36 ///This class implements the \e binary \e heap data structure. 37 /// 38 38 ///A \e heap is a data structure for storing items with specified values 39 39 ///called \e priorities in such a way that finding the item with minimum 40 ///priority is efficient. \c C MPspecifies the ordering of the priorities.40 ///priority is efficient. \c Comp specifies the ordering of the priorities. 41 41 ///In a heap one can change the priority of an item, add or erase an 42 42 ///item, etc. … … 45 45 ///\tparam IM A read and writable item map with int values, used internally 46 46 ///to handle the cross references. 47 ///\tparam C MPA functor class for the ordering of the priorities.47 ///\tparam Comp A functor class for the ordering of the priorities. 48 48 ///The default is \c std::less<PR>. 49 49 /// 50 50 ///\sa FibHeap 51 51 ///\sa Dijkstra 52 template <typename PR, typename IM, typename C MP= std::less<PR> >52 template <typename PR, typename IM, typename Comp = std::less<PR> > 53 53 class BinHeap { 54 54 … … 63 63 typedef std::pair<Item,Prio> Pair; 64 64 ///\e 65 typedef C MPCompare;65 typedef Comp Compare; 66 66 67 67 /// \brief Type to represent the items states. -
lemon/bits/edge_set_extender.h
r962 r685 281 281 typedef EdgeSetExtender Graph; 282 282 283 typedef True UndirectedTag;284 285 283 typedef typename Parent::Node Node; 286 284 typedef typename Parent::Arc Arc; -
lemon/bits/graph_adaptor_extender.h
r882 r617 182 182 typedef GraphAdaptorExtender Adaptor; 183 183 184 typedef True UndirectedTag;185 186 184 typedef typename Parent::Node Node; 187 185 typedef typename Parent::Arc Arc; -
lemon/bits/map_extender.h
r802 r617 50 50 typedef typename Parent::ConstReference ConstReference; 51 51 52 typedef typename Parent::ReferenceMapTag ReferenceMapTag;53 54 52 class MapIt; 55 53 class ConstMapIt; … … 85 83 typedef typename Map::Value Value; 86 84 87 MapIt() : map(NULL){}88 89 MapIt(Invalid i) : Parent(i) , map(NULL) {}90 91 explicit MapIt(Map& _map) : map( &_map) {92 map ->notifier()->first(*this);85 MapIt() {} 86 87 MapIt(Invalid i) : Parent(i) { } 88 89 explicit MapIt(Map& _map) : map(_map) { 90 map.notifier()->first(*this); 93 91 } 94 92 95 93 MapIt(const Map& _map, const Item& item) 96 : Parent(item), map( &_map) {}94 : Parent(item), map(_map) {} 97 95 98 96 MapIt& operator++() { 99 map ->notifier()->next(*this);97 map.notifier()->next(*this); 100 98 return *this; 101 99 } 102 100 103 101 typename MapTraits<Map>::ConstReturnValue operator*() const { 104 return (*map)[*this];102 return map[*this]; 105 103 } 106 104 107 105 typename MapTraits<Map>::ReturnValue operator*() { 108 return (*map)[*this];106 return map[*this]; 109 107 } 110 108 111 109 void set(const Value& value) { 112 map ->set(*this, value);113 } 114 115 protected: 116 Map *map;110 map.set(*this, value); 111 } 112 113 protected: 114 Map& map; 117 115 118 116 }; … … 125 123 typedef typename Map::Value Value; 126 124 127 ConstMapIt() : map(NULL){}128 129 ConstMapIt(Invalid i) : Parent(i) , map(NULL) {}130 131 explicit ConstMapIt(Map& _map) : map( &_map) {132 map ->notifier()->first(*this);125 ConstMapIt() {} 126 127 ConstMapIt(Invalid i) : Parent(i) { } 128 129 explicit ConstMapIt(Map& _map) : map(_map) { 130 map.notifier()->first(*this); 133 131 } 134 132 … … 137 135 138 136 ConstMapIt& operator++() { 139 map ->notifier()->next(*this);137 map.notifier()->next(*this); 140 138 return *this; 141 139 } … … 146 144 147 145 protected: 148 const Map *map;146 const Map& map; 149 147 }; 150 148 … … 153 151 154 152 public: 155 ItemIt() : map(NULL) {} 156 157 158 ItemIt(Invalid i) : Parent(i) , map(NULL) {}159 160 explicit ItemIt(Map& _map) : map( &_map) {161 map ->notifier()->first(*this);153 154 ItemIt() {} 155 156 ItemIt(Invalid i) : Parent(i) { } 157 158 explicit ItemIt(Map& _map) : map(_map) { 159 map.notifier()->first(*this); 162 160 } 163 161 164 162 ItemIt(const Map& _map, const Item& item) 165 : Parent(item), map( &_map) {}163 : Parent(item), map(_map) {} 166 164 167 165 ItemIt& operator++() { 168 map ->notifier()->next(*this);169 return *this; 170 } 171 172 protected: 173 const Map *map;166 map.notifier()->next(*this); 167 return *this; 168 } 169 170 protected: 171 const Map& map; 174 172 175 173 }; … … 194 192 typedef typename Parent::ConstReference ConstReference; 195 193 196 typedef typename Parent::ReferenceMapTag ReferenceMapTag;197 198 194 class MapIt; 199 195 class ConstMapIt; … … 232 228 typedef typename Map::Value Value; 233 229 234 MapIt() : map(NULL){}235 236 MapIt(Invalid i) : Parent(i) , map(NULL){ }237 238 explicit MapIt(Map& _map) : map( &_map) {239 map ->graph.first(*this);230 MapIt() {} 231 232 MapIt(Invalid i) : Parent(i) { } 233 234 explicit MapIt(Map& _map) : map(_map) { 235 map.graph.first(*this); 240 236 } 241 237 242 238 MapIt(const Map& _map, const Item& item) 243 : Parent(item), map( &_map) {}239 : Parent(item), map(_map) {} 244 240 245 241 MapIt& operator++() { 246 map ->graph.next(*this);242 map.graph.next(*this); 247 243 return *this; 248 244 } 249 245 250 246 typename MapTraits<Map>::ConstReturnValue operator*() const { 251 return (*map)[*this];247 return map[*this]; 252 248 } 253 249 254 250 typename MapTraits<Map>::ReturnValue operator*() { 255 return (*map)[*this];251 return map[*this]; 256 252 } 257 253 258 254 void set(const Value& value) { 259 map ->set(*this, value);260 } 261 262 protected: 263 Map *map;255 map.set(*this, value); 256 } 257 258 protected: 259 Map& map; 264 260 265 261 }; … … 272 268 typedef typename Map::Value Value; 273 269 274 ConstMapIt() : map(NULL){}275 276 ConstMapIt(Invalid i) : Parent(i) , map(NULL){ }277 278 explicit ConstMapIt(Map& _map) : map( &_map) {279 map ->graph.first(*this);270 ConstMapIt() {} 271 272 ConstMapIt(Invalid i) : Parent(i) { } 273 274 explicit ConstMapIt(Map& _map) : map(_map) { 275 map.graph.first(*this); 280 276 } 281 277 282 278 ConstMapIt(const Map& _map, const Item& item) 283 : Parent(item), map( &_map) {}279 : Parent(item), map(_map) {} 284 280 285 281 ConstMapIt& operator++() { 286 map ->graph.next(*this);282 map.graph.next(*this); 287 283 return *this; 288 284 } 289 285 290 286 typename MapTraits<Map>::ConstReturnValue operator*() const { 291 return (*map)[*this];292 } 293 294 protected: 295 const Map *map;287 return map[*this]; 288 } 289 290 protected: 291 const Map& map; 296 292 }; 297 293 … … 300 296 301 297 public: 302 ItemIt() : map(NULL) {} 303 304 305 ItemIt(Invalid i) : Parent(i) , map(NULL){ }306 307 explicit ItemIt(Map& _map) : map( &_map) {308 map ->graph.first(*this);298 299 ItemIt() {} 300 301 ItemIt(Invalid i) : Parent(i) { } 302 303 explicit ItemIt(Map& _map) : map(_map) { 304 map.graph.first(*this); 309 305 } 310 306 311 307 ItemIt(const Map& _map, const Item& item) 312 : Parent(item), map( &_map) {}308 : Parent(item), map(_map) {} 313 309 314 310 ItemIt& operator++() { 315 map ->graph.next(*this);316 return *this; 317 } 318 319 protected: 320 const Map *map;311 map.graph.next(*this); 312 return *this; 313 } 314 315 protected: 316 const Map& map; 321 317 322 318 }; -
lemon/bits/path_dump.h
r887 r529 50 50 51 51 bool empty() const { 52 return predMap[target] == INVALID;52 return predMap[target] != INVALID; 53 53 } 54 54 … … 124 124 125 125 bool empty() const { 126 return predMatrixMap(source, target) == INVALID;126 return source != target; 127 127 } 128 128 -
lemon/bits/windows.cc
r940 r493 41 41 #include <unistd.h> 42 42 #include <ctime> 43 #ifndef WIN3244 43 #include <sys/times.h> 45 #endif46 44 #include <sys/time.h> 47 45 #endif -
lemon/circulation.h
r688 r641 454 454 /// 455 455 /// Sets the tolerance used by algorithm. 456 Circulation& tolerance(const Tolerance& tolerance) {456 Circulation& tolerance(const Tolerance& tolerance) const { 457 457 _tol = tolerance; 458 458 return *this; … … 463 463 /// Returns a const reference to the tolerance. 464 464 const Tolerance& tolerance() const { 465 return _tol;465 return tolerance; 466 466 } 467 467 -
lemon/concepts/maps.h
r718 r529 183 183 template<typename _ReferenceMap> 184 184 struct Constraints { 185 typename enable_if<typename _ReferenceMap::ReferenceMapTag, void>::type 186 constraints() { 185 void constraints() { 187 186 checkConcept<ReadWriteMap<K, T>, _ReferenceMap >(); 188 187 ref = m[key]; -
lemon/core.h
r959 r671 395 395 static void copy(const From& from, Digraph &to, 396 396 NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) { 397 to.clear();398 397 for (typename From::NodeIt it(from); it != INVALID; ++it) { 399 398 nodeRefMap[it] = to.addNode(); … … 423 422 static void copy(const From& from, Graph &to, 424 423 NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) { 425 to.clear();426 424 for (typename From::NodeIt it(from); it != INVALID; ++it) { 427 425 nodeRefMap[it] = to.addNode(); -
lemon/dfs.h
r959 r584 558 558 void start(Node t) 559 559 { 560 while ( !emptyQueue() && !(*_reached)[t])560 while ( !emptyQueue() && G->target(_stack[_stack_head])!=t ) 561 561 processNextArc(); 562 562 } … … 1510 1510 /// with addSource() before using this function. 1511 1511 void start(Node t) { 1512 while ( !emptyQueue() && !(*_reached)[t])1512 while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t ) 1513 1513 processNextArc(); 1514 1514 } -
lemon/glpk.h
r832 r650 26 26 #include <lemon/lp_base.h> 27 27 28 // forward declaration 29 #if !defined _GLP_PROB && !defined GLP_PROB 30 #define _GLP_PROB 31 #define GLP_PROB 32 typedef struct { double _opaque_prob; } glp_prob; 33 /* LP/MIP problem object */ 34 #endif 35 28 36 namespace lemon { 29 37 30 namespace _solver_bits {31 class VoidPtr {32 private:33 void *_ptr;34 public:35 VoidPtr() : _ptr(0) {}36 37 template <typename T>38 VoidPtr(T* ptr) : _ptr(reinterpret_cast<void*>(ptr)) {}39 40 template <typename T>41 VoidPtr& operator=(T* ptr) {42 _ptr = reinterpret_cast<void*>(ptr);43 return *this;44 }45 46 template <typename T>47 operator T*() const { return reinterpret_cast<T*>(_ptr); }48 };49 }50 38 51 39 /// \brief Base interface for the GLPK LP and MIP solver … … 56 44 protected: 57 45 58 _solver_bits::VoidPtr lp; 46 typedef glp_prob LPX; 47 glp_prob* lp; 59 48 60 49 GlpkBase(); … … 134 123 135 124 ///Pointer to the underlying GLPK data structure. 136 _solver_bits::VoidPtrlpx() {return lp;}125 LPX *lpx() {return lp;} 137 126 ///Const pointer to the underlying GLPK data structure. 138 _solver_bits::VoidPtrlpx() const {return lp;}127 const LPX *lpx() const {return lp;} 139 128 140 129 ///Returns the constraint identifier understood by GLPK. -
lemon/graph_to_eps.h
r959 r617 685 685 #else 686 686 os << bits::getWinFormattedDate(); 687 os << std::endl;688 687 #endif 689 688 } 689 os << std::endl; 690 690 691 691 if (_autoArcWidthScale) { -
lemon/lgf_reader.h
r959 r599 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 115 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 965 965 int index = 0; 966 966 while (_reader_bits::readToken(line, map)) { 967 if(map == "-") {968 if(index!=0)969 throw FormatError("'-' is not allowed as a map name");970 else if (line >> std::ws >> c)971 throw FormatError("Extra character at the end of line");972 else break;973 }974 967 if (maps.find(map) != maps.end()) { 975 968 std::ostringstream msg; … … 1842 1835 int index = 0; 1843 1836 while (_reader_bits::readToken(line, map)) { 1844 if(map == "-") {1845 if(index!=0)1846 throw FormatError("'-' is not allowed as a map name");1847 else if (line >> std::ws >> c)1848 throw FormatError("Extra character at the end of line");1849 else break;1850 }1851 1837 if (maps.find(map) != maps.end()) { 1852 1838 std::ostringstream msg; -
lemon/lp_base.h
r957 r584 1605 1605 inline LpBase::Constr operator<=(const LpBase::Expr &e, 1606 1606 const LpBase::Expr &f) { 1607 return LpBase::Constr(0, f - e, LpBase:: NaN);1607 return LpBase::Constr(0, f - e, LpBase::INF); 1608 1608 } 1609 1609 … … 1623 1623 inline LpBase::Constr operator<=(const LpBase::Expr &e, 1624 1624 const LpBase::Value &f) { 1625 return LpBase::Constr( LpBase::NaN, e, f);1625 return LpBase::Constr(- LpBase::INF, e, f); 1626 1626 } 1627 1627 … … 1632 1632 inline LpBase::Constr operator>=(const LpBase::Expr &e, 1633 1633 const LpBase::Expr &f) { 1634 return LpBase::Constr(0, e - f, LpBase:: NaN);1634 return LpBase::Constr(0, e - f, LpBase::INF); 1635 1635 } 1636 1636 … … 1652 1652 inline LpBase::Constr operator>=(const LpBase::Expr &e, 1653 1653 const LpBase::Value &f) { 1654 return LpBase::Constr(f, e, LpBase:: NaN);1654 return LpBase::Constr(f, e, LpBase::INF); 1655 1655 } 1656 1656 -
lemon/matching.h
r867 r651 806 806 _matching = new MatchingMap(_graph); 807 807 } 808 809 808 if (!_node_potential) { 810 809 _node_potential = new NodePotential(_graph); 811 810 } 812 813 811 if (!_blossom_set) { 814 812 _blossom_index = new IntNodeMap(_graph); 815 813 _blossom_set = new BlossomSet(*_blossom_index); 816 814 _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);820 815 } 821 816 … … 824 819 _node_heap_index = new IntArcMap(_graph); 825 820 _node_data = new RangeMap<NodeData>(_node_num, 826 NodeData(*_node_heap_index)); 827 } else { 828 delete _node_data; 829 _node_data = new RangeMap<NodeData>(_node_num, 830 NodeData(*_node_heap_index)); 821 NodeData(*_node_heap_index)); 831 822 } 832 823 … … 834 825 _tree_set_index = new IntIntMap(_blossom_num); 835 826 _tree_set = new TreeSet(*_tree_set_index); 836 } else { 837 _tree_set_index->resize(_blossom_num); 838 } 839 827 } 840 828 if (!_delta1) { 841 829 _delta1_index = new IntNodeMap(_graph); 842 830 _delta1 = new BinHeap<Value, IntNodeMap>(*_delta1_index); 843 831 } 844 845 832 if (!_delta2) { 846 833 _delta2_index = new IntIntMap(_blossom_num); 847 834 _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index); 848 } else { 849 _delta2_index->resize(_blossom_num); 850 } 851 835 } 852 836 if (!_delta3) { 853 837 _delta3_index = new IntEdgeMap(_graph); 854 838 _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index); 855 839 } 856 857 840 if (!_delta4) { 858 841 _delta4_index = new IntIntMap(_blossom_num); 859 842 _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index); 860 } else {861 _delta4_index->resize(_blossom_num);862 843 } 863 844 } … … 1705 1686 createStructures(); 1706 1687 1707 _blossom_node_list.clear();1708 _blossom_potential.clear();1709 1710 1688 for (ArcIt e(_graph); e != INVALID; ++e) { 1711 1689 (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP; … … 1721 1699 (*_delta4_index)[i] = _delta4->PRE_HEAP; 1722 1700 } 1723 1724 _delta1->clear();1725 _delta2->clear();1726 _delta3->clear();1727 _delta4->clear();1728 _blossom_set->clear();1729 _tree_set->clear();1730 1701 1731 1702 int index = 0; … … 1739 1710 } 1740 1711 (*_node_index)[n] = index; 1741 (*_node_data)[index].heap_index.clear();1742 (*_node_data)[index].heap.clear();1743 1712 (*_node_data)[index].pot = max; 1744 1713 _delta1->push(n, max); … … 2230 2199 _matching = new MatchingMap(_graph); 2231 2200 } 2232 2233 2201 if (!_node_potential) { 2234 2202 _node_potential = new NodePotential(_graph); 2235 2203 } 2236 2237 2204 if (!_blossom_set) { 2238 2205 _blossom_index = new IntNodeMap(_graph); 2239 2206 _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;2243 2207 _blossom_data = new RangeMap<BlossomData>(_blossom_num); 2244 2208 } … … 2249 2213 _node_data = new RangeMap<NodeData>(_node_num, 2250 2214 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));2255 2215 } 2256 2216 … … 2258 2218 _tree_set_index = new IntIntMap(_blossom_num); 2259 2219 _tree_set = new TreeSet(*_tree_set_index); 2260 } else { 2261 _tree_set_index->resize(_blossom_num); 2262 } 2263 2220 } 2264 2221 if (!_delta2) { 2265 2222 _delta2_index = new IntIntMap(_blossom_num); 2266 2223 _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index); 2267 } else { 2268 _delta2_index->resize(_blossom_num); 2269 } 2270 2224 } 2271 2225 if (!_delta3) { 2272 2226 _delta3_index = new IntEdgeMap(_graph); 2273 2227 _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index); 2274 2228 } 2275 2276 2229 if (!_delta4) { 2277 2230 _delta4_index = new IntIntMap(_blossom_num); 2278 2231 _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index); 2279 } else {2280 _delta4_index->resize(_blossom_num);2281 2232 } 2282 2233 } … … 2976 2927 createStructures(); 2977 2928 2978 _blossom_node_list.clear();2979 _blossom_potential.clear();2980 2981 2929 for (ArcIt e(_graph); e != INVALID; ++e) { 2982 2930 (*_node_heap_index)[e] = BinHeap<Value, IntArcMap>::PRE_HEAP; … … 2989 2937 (*_delta4_index)[i] = _delta4->PRE_HEAP; 2990 2938 } 2991 2992 _delta2->clear();2993 _delta3->clear();2994 _delta4->clear();2995 _blossom_set->clear();2996 _tree_set->clear();2997 2939 2998 2940 int index = 0; … … 3006 2948 } 3007 2949 (*_node_index)[n] = index; 3008 (*_node_data)[index].heap_index.clear();3009 (*_node_data)[index].heap.clear();3010 2950 (*_node_data)[index].pot = max; 3011 2951 int blossom = -
lemon/network_simplex.h
r888 r663 1043 1043 ART_COST = std::numeric_limits<Cost>::max() / 2 + 1; 1044 1044 } else { 1045 ART_COST = 0;1045 ART_COST = std::numeric_limits<Cost>::min(); 1046 1046 for (int i = 0; i != _arc_num; ++i) { 1047 1047 if (_cost[i] > ART_COST) ART_COST = _cost[i]; … … 1458 1458 if (_sum_supply == 0) { 1459 1459 if (_stype == GEQ) { 1460 Cost max_pot = -std::numeric_limits<Cost>::max();1460 Cost max_pot = std::numeric_limits<Cost>::min(); 1461 1461 for (int i = 0; i != _node_num; ++i) { 1462 1462 if (_pi[i] > max_pot) max_pot = _pi[i]; -
lemon/path.h
r802 r559 71 71 template <typename CPath> 72 72 Path(const CPath& cpath) { 73 pathCopy(cpath, *this);73 copyPath(*this, cpath); 74 74 } 75 75 … … 79 79 template <typename CPath> 80 80 Path& operator=(const CPath& cpath) { 81 pathCopy(cpath, *this);81 copyPath(*this, cpath); 82 82 return *this; 83 83 } … … 259 259 template <typename CPath> 260 260 SimplePath(const CPath& cpath) { 261 pathCopy(cpath, *this);261 copyPath(*this, cpath); 262 262 } 263 263 … … 268 268 template <typename CPath> 269 269 SimplePath& operator=(const CPath& cpath) { 270 pathCopy(cpath, *this);270 copyPath(*this, cpath); 271 271 return *this; 272 272 } … … 438 438 template <typename CPath> 439 439 ListPath(const CPath& cpath) : first(0), last(0) { 440 pathCopy(cpath, *this);440 copyPath(*this, cpath); 441 441 } 442 442 … … 454 454 template <typename CPath> 455 455 ListPath& operator=(const CPath& cpath) { 456 pathCopy(cpath, *this);456 copyPath(*this, cpath); 457 457 return *this; 458 458 } … … 764 764 template <typename CPath> 765 765 StaticPath(const CPath& cpath) : arcs(0) { 766 pathCopy(cpath, *this);766 copyPath(*this, cpath); 767 767 } 768 768 … … 780 780 template <typename CPath> 781 781 StaticPath& operator=(const CPath& cpath) { 782 pathCopy(cpath, *this);782 copyPath(*this, cpath); 783 783 return *this; 784 784 } … … 929 929 }; 930 930 931 template <typename From, typename To,932 bool buildEnable = BuildTagIndicator<T o>::value>931 template <typename Target, typename Source, 932 bool buildEnable = BuildTagIndicator<Target>::value> 933 933 struct PathCopySelectorForward { 934 static void copy( const From& from, To& to) {935 t o.clear();936 for (typename From::ArcIt it(from); it != INVALID; ++it) {937 t o.addBack(it);934 static void copy(Target& target, const Source& source) { 935 target.clear(); 936 for (typename Source::ArcIt it(source); it != INVALID; ++it) { 937 target.addBack(it); 938 938 } 939 939 } 940 940 }; 941 941 942 template <typename From, typename To>943 struct PathCopySelectorForward< From, To, true> {944 static void copy( const From& from, To& to) {945 t o.clear();946 t o.build(from);947 } 948 }; 949 950 template <typename From, typename To,951 bool buildEnable = BuildTagIndicator<T o>::value>942 template <typename Target, typename Source> 943 struct PathCopySelectorForward<Target, Source, true> { 944 static void copy(Target& target, const Source& source) { 945 target.clear(); 946 target.build(source); 947 } 948 }; 949 950 template <typename Target, typename Source, 951 bool buildEnable = BuildTagIndicator<Target>::value> 952 952 struct PathCopySelectorBackward { 953 static void copy( const From& from, To& to) {954 t o.clear();955 for (typename From::RevArcIt it(from); it != INVALID; ++it) {956 t o.addFront(it);953 static void copy(Target& target, const Source& source) { 954 target.clear(); 955 for (typename Source::RevArcIt it(source); it != INVALID; ++it) { 956 target.addFront(it); 957 957 } 958 958 } 959 959 }; 960 960 961 template <typename From, typename To>962 struct PathCopySelectorBackward< From, To, true> {963 static void copy( const From& from, To& to) {964 t o.clear();965 t o.buildRev(from);961 template <typename Target, typename Source> 962 struct PathCopySelectorBackward<Target, Source, true> { 963 static void copy(Target& target, const Source& source) { 964 target.clear(); 965 target.buildRev(source); 966 966 } 967 967 }; 968 968 969 969 970 template <typename From, typename To,971 bool revEnable = RevPathTagIndicator< From>::value>970 template <typename Target, typename Source, 971 bool revEnable = RevPathTagIndicator<Source>::value> 972 972 struct PathCopySelector { 973 static void copy( const From& from, To& to) {974 PathCopySelectorForward< From, To>::copy(from, to);973 static void copy(Target& target, const Source& source) { 974 PathCopySelectorForward<Target, Source>::copy(target, source); 975 975 } 976 976 }; 977 977 978 template <typename From, typename To>979 struct PathCopySelector< From, To, true> {980 static void copy( const From& from, To& to) {981 PathCopySelectorBackward< From, To>::copy(from, to);978 template <typename Target, typename Source> 979 struct PathCopySelector<Target, Source, true> { 980 static void copy(Target& target, const Source& source) { 981 PathCopySelectorBackward<Target, Source>::copy(target, source); 982 982 } 983 983 }; … … 988 988 /// \brief Make a copy of a path. 989 989 /// 990 /// This function makes a copy of a path. 991 template <typename From, typename To> 992 void pathCopy(const From& from, To& to) { 993 checkConcept<concepts::PathDumper<typename From::Digraph>, From>(); 994 _path_bits::PathCopySelector<From, To>::copy(from, to); 995 } 996 997 /// \brief Deprecated version of \ref pathCopy(). 998 /// 999 /// Deprecated version of \ref pathCopy() (only for reverse compatibility). 1000 template <typename To, typename From> 1001 void copyPath(To& to, const From& from) { 1002 pathCopy(from, to); 990 /// This function makes a copy of a path. 991 template <typename Target, typename Source> 992 void copyPath(Target& target, const Source& source) { 993 checkConcept<concepts::PathDumper<typename Source::Digraph>, Source>(); 994 _path_bits::PathCopySelector<Target, Source>::copy(target, source); 1003 995 } 1004 996 … … 1024 1016 /// \brief The source of a path 1025 1017 /// 1026 /// This function returns the source node of the given path. 1027 /// If the path is empty, then it returns \c INVALID. 1018 /// This function returns the source of the given path. 1028 1019 template <typename Digraph, typename Path> 1029 1020 typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) { 1030 return path.empty() ? INVALID :digraph.source(path.front());1021 return digraph.source(path.front()); 1031 1022 } 1032 1023 1033 1024 /// \brief The target of a path 1034 1025 /// 1035 /// This function returns the target node of the given path. 1036 /// If the path is empty, then it returns \c INVALID. 1026 /// This function returns the target of the given path. 1037 1027 template <typename Digraph, typename Path> 1038 1028 typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) { 1039 return path.empty() ? INVALID :digraph.target(path.back());1029 return digraph.target(path.back()); 1040 1030 } 1041 1031 -
lemon/preflow.h
r923 r641 375 375 /// 376 376 /// Sets the tolerance used by algorithm. 377 Preflow& tolerance(const Tolerance& tolerance) {377 Preflow& tolerance(const Tolerance& tolerance) const { 378 378 _tolerance = tolerance; 379 379 return *this; … … 384 384 /// Returns a const reference to the tolerance. 385 385 const Tolerance& tolerance() const { 386 return _tolerance;386 return tolerance; 387 387 } 388 388 … … 526 526 _flow->set(e, (*_capacity)[e]); 527 527 (*_excess)[u] += rem; 528 if (u != _target && !_level->active(u)) { 529 _level->activate(u); 530 } 528 531 } 529 532 } … … 535 538 _flow->set(e, 0); 536 539 (*_excess)[v] += rem; 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 540 if (v != _target && !_level->active(v)) { 541 _level->activate(v); 542 } 543 } 544 } 543 545 return true; 544 546 } … … 557 559 _phase = true; 558 560 559 while (true) { 561 Node n = _level->highestActive(); 562 int level = _level->highestActiveLevel(); 563 while (n != INVALID) { 560 564 int num = _node_num; 561 565 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 566 while (num > 0 && n != INVALID) { 571 567 Value excess = (*_excess)[n]; 572 568 int new_level = _level->maxLevel(); … … 634 630 _level->deactivate(n); 635 631 } 632 633 n = _level->highestActive(); 634 level = _level->highestActiveLevel(); 635 --num; 636 636 } 637 637 638 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 } 650 --num; 651 639 while (num > 0 && n != INVALID) { 652 640 Value excess = (*_excess)[n]; 653 641 int new_level = _level->maxLevel(); … … 715 703 _level->deactivate(n); 716 704 } 717 } 718 } 719 first_phase_done:; 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 } 720 718 } 721 719 -
lemon/suurballe.h
r852 r623 56 56 /// The default value is <tt>GR::ArcMap<int></tt>. 57 57 /// 58 /// \warning Length values should be \e non-negative .58 /// \warning Length values should be \e non-negative \e integers. 59 59 /// 60 60 /// \note For finding node-disjoint paths this algorithm can be used … … 253 253 _graph(graph), _length(length), _flow(0), _local_flow(false), 254 254 _potential(0), _local_potential(false), _pred(graph) 255 {} 255 { 256 LEMON_ASSERT(std::numeric_limits<Length>::is_integer, 257 "The length type of Suurballe must be integer"); 258 } 256 259 257 260 /// Destructor. … … 518 521 /// \pre \ref run() or \ref findPaths() must be called before using 519 522 /// this function. 520 const Path&path(int i) const {523 Path path(int i) const { 521 524 return paths[i]; 522 525 } -
lemon/unionfind.h
r867 r559 740 740 void clear() { 741 741 items.clear(); 742 classes.clear ();742 classes.clear; 743 743 firstClass = firstFreeClass = firstFreeItem = -1; 744 744 } … … 1289 1289 first_free_class(-1), first_free_node(-1) {} 1290 1290 1291 /// \brief Clears the union-find data structure1292 ///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 1300 1291 /// \brief Insert a new node into a new component. 1301 1292 /// -
m4/lx_check_coin.m4
r749 r627 89 89 CBC_LDFLAGS="-L$with_coin/lib" 90 90 fi 91 CBC_LIBS="-lOsi -lCbc -l CbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas"91 CBC_LIBS="-lOsi -lCbc -lOsiCbc -lCbcSolver -lClp -lOsiClp -lCoinUtils -lVol -lOsiVol -lCgl -lm -llapack -lblas" 92 92 93 93 lx_save_cxxflags="$CXXFLAGS" -
test/CMakeLists.txt
r959 r679 7 7 ${PROJECT_BINARY_DIR}/lemon 8 8 ) 9 10 SET(TEST_WITH_VALGRIND "NO" CACHE STRING11 "Run the test with valgrind (YES/NO).")12 SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")13 9 14 10 SET(TESTS … … 32 28 heap_test 33 29 kruskal_test 34 lgf_test35 30 maps_test 36 31 matching_test … … 47 42 48 43 IF(LEMON_HAVE_LP) 49 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 50 ADD_EXECUTABLE(lp_test lp_test.cc) 51 ELSE() 52 ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc) 53 ENDIF() 54 44 ADD_EXECUTABLE(lp_test lp_test.cc) 55 45 SET(LP_TEST_LIBS lemon) 56 46 … … 67 57 TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) 68 58 ADD_TEST(lp_test lp_test) 69 ADD_DEPENDENCIES(check lp_test)70 59 71 60 IF(WIN32 AND LEMON_HAVE_GLPK) … … 89 78 90 79 IF(LEMON_HAVE_MIP) 91 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 92 ADD_EXECUTABLE(mip_test mip_test.cc) 93 ELSE() 94 ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc) 95 ENDIF() 96 80 ADD_EXECUTABLE(mip_test mip_test.cc) 97 81 SET(MIP_TEST_LIBS lemon) 98 82 … … 109 93 TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) 110 94 ADD_TEST(mip_test mip_test) 111 ADD_DEPENDENCIES(check mip_test)112 95 113 96 IF(WIN32 AND LEMON_HAVE_GLPK) … … 131 114 132 115 FOREACH(TEST_NAME ${TESTS}) 133 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 134 ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) 135 ELSE() 136 ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) 137 ENDIF() 116 ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) 138 117 TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) 139 IF(TEST_WITH_VALGRIND) 140 ADD_TEST(${TEST_NAME} 141 valgrind --error-exitcode=1 ${VALGRIND_FLAGS} 142 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) 143 ELSE() 144 ADD_TEST(${TEST_NAME} ${TEST_NAME}) 145 ENDIF() 146 ADD_DEPENDENCIES(check ${TEST_NAME}) 118 ADD_TEST(${TEST_NAME} ${TEST_NAME}) 147 119 ENDFOREACH() -
test/Makefile.am
r959 r649 26 26 test/heap_test \ 27 27 test/kruskal_test \ 28 test/lgf_test \29 28 test/maps_test \ 30 29 test/matching_test \ … … 72 71 test_kruskal_test_SOURCES = test/kruskal_test.cc 73 72 test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc 74 test_lgf_test_SOURCES = test/lgf_test.cc75 73 test_lp_test_SOURCES = test/lp_test.cc 76 74 test_maps_test_SOURCES = test/maps_test.cc -
test/dfs_test.cc
r959 r585 51 51 "@attributes\n" 52 52 "source 0\n" 53 "target 5\n" 54 "source1 6\n" 55 "target1 3\n"; 56 53 "target 5\n"; 57 54 58 55 void checkDfsCompile() … … 183 180 Digraph G; 184 181 Node s, t; 185 Node s1, t1;186 182 187 183 std::istringstream input(test_lgf); … … 189 185 node("source", s). 190 186 node("target", t). 191 node("source1", s1).192 node("target1", t1).193 187 run(); 194 188 … … 217 211 218 212 { 219 Dfs<Digraph> dfs(G);220 check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");221 }222 223 {224 213 NullMap<Node,Arc> myPredMap; 225 214 dfs(G).predMap(myPredMap).run(s); -
test/graph_copy_test.cc
r893 r440 30 30 const int nn = 10; 31 31 32 // Build a digraph33 32 SmartDigraph from; 34 33 SmartDigraph::NodeMap<int> fnm(from); … … 53 52 } 54 53 55 // Test digraph copy56 54 ListDigraph to; 57 55 ListDigraph::NodeMap<int> tnm(to); … … 71 69 nodeCrossRef(ncr).arcCrossRef(ecr). 72 70 node(fn, tn).arc(fa, ta).run(); 73 74 check(countNodes(from) == countNodes(to), "Wrong copy.");75 check(countArcs(from) == countArcs(to), "Wrong copy.");76 71 77 72 for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) { … … 96 91 check(tn == nr[fn], "Wrong copy."); 97 92 check(ta == er[fa], "Wrong copy."); 98 99 // Test repeated copy100 digraphCopy(from, to).run();101 102 check(countNodes(from) == countNodes(to), "Wrong copy.");103 check(countArcs(from) == countArcs(to), "Wrong copy.");104 93 } 105 94 … … 107 96 const int nn = 10; 108 97 109 // Build a graph110 98 SmartGraph from; 111 99 SmartGraph::NodeMap<int> fnm(from); … … 135 123 } 136 124 137 // Test graph copy138 125 ListGraph to; 139 126 ListGraph::NodeMap<int> tnm(to); … … 157 144 nodeCrossRef(ncr).arcCrossRef(acr).edgeCrossRef(ecr). 158 145 node(fn, tn).arc(fa, ta).edge(fe, te).run(); 159 160 check(countNodes(from) == countNodes(to), "Wrong copy.");161 check(countEdges(from) == countEdges(to), "Wrong copy.");162 check(countArcs(from) == countArcs(to), "Wrong copy.");163 146 164 147 for (SmartGraph::NodeIt it(from); it != INVALID; ++it) { … … 198 181 check(ta == ar[fa], "Wrong copy."); 199 182 check(te == er[fe], "Wrong copy."); 200 201 // Test repeated copy202 graphCopy(from, to).run();203 204 check(countNodes(from) == countNodes(to), "Wrong copy.");205 check(countEdges(from) == countEdges(to), "Wrong copy.");206 check(countArcs(from) == countArcs(to), "Wrong copy.");207 183 } 208 184 -
test/heap_test.cc
r681 r440 32 32 33 33 #include <lemon/bin_heap.h> 34 #include <lemon/fib_heap.h>35 #include <lemon/radix_heap.h>36 #include <lemon/bucket_heap.h>37 34 38 35 #include "test_tools.h" … … 187 184 } 188 185 189 {190 typedef FibHeap<Prio, ItemIntMap> IntHeap;191 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();192 heapSortTest<IntHeap>();193 heapIncreaseTest<IntHeap>();194 195 typedef FibHeap<Prio, IntNodeMap > NodeHeap;196 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();197 dijkstraHeapTest<NodeHeap>(digraph, length, source);198 }199 200 {201 typedef RadixHeap<ItemIntMap> IntHeap;202 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();203 heapSortTest<IntHeap>();204 heapIncreaseTest<IntHeap>();205 206 typedef RadixHeap<IntNodeMap > NodeHeap;207 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();208 dijkstraHeapTest<NodeHeap>(digraph, length, source);209 }210 211 {212 typedef BucketHeap<ItemIntMap> IntHeap;213 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();214 heapSortTest<IntHeap>();215 heapIncreaseTest<IntHeap>();216 217 typedef BucketHeap<IntNodeMap > NodeHeap;218 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();219 dijkstraHeapTest<NodeHeap>(digraph, length, source);220 }221 222 223 186 return 0; 224 187 } -
test/lp_test.cc
r957 r631 167 167 c = ((2 >= p1) >= 3); 168 168 169 { //Tests for #430170 LP::Col v=lp.addCol();171 LP::Constr c = v >= -3;172 c = c <= 4;173 LP::Constr c2;174 c2 = -3 <= v <= 4;175 }176 177 169 e[x[3]]=2; 178 170 e[x[3]]=4; -
test/mip_test.cc
r748 r631 51 51 if (stat == MipSolver::OPTIMAL) { 52 52 std::ostringstream sbuf; 53 sbuf << "Wrong optimal value ("<< mip.solValue() 54 <<" instead of " << exp_opt << ")"; 53 buf << "Wrong optimal value: the right optimum is " << exp_opt; 55 54 check(std::abs(mip.solValue()-exp_opt) < 1e-3, sbuf.str()); 56 55 //+ecvt(exp_opt,2) -
test/preflow_test.cc
r923 r585 152 152 } 153 153 154 void 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 178 154 int main() { 179 155 … … 266 242 "The max flow value or the three min cut values are incorrect."); 267 243 268 initFlowTest();269 270 244 return 0; 271 245 }
Note: See TracChangeset
for help on using the changeset viewer.