Changes in / [1373:332627dd249e:1375:6d1255299e79] in lemon
- Files:
-
- 70 added
- 18 deleted
- 127 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r564 r944 23 23 lemon/stamp-h2 24 24 doc/Doxyfile 25 cmake/cmake.version 25 doc/references.dox 26 cmake/version.cmake 26 27 .dirstamp 27 28 .libs/* -
AUTHORS
r320 r1148 1 The authors of the 1.x seriesare1 The main developers of release series 1.x are 2 2 3 3 * Balazs Dezso <deba@inf.elte.hu> … … 6 6 * Akos Ladanyi <ladanyi@tmit.bme.hu> 7 7 8 For more details on the actual contribution, please visit the history9 of the main LEMON source repository: http://lemon.cs.elte.hu/hg/lemon8 For more complete list of contributors, please visit the history of 9 the LEMON source code repository: http://lemon.cs.elte.hu/hg/lemon 10 10 11 Moreover, this version is heavily based on the 0.x series of12 LEMON. Hereis the list of people who contributed to those versions.11 Moreover, this version is heavily based on version 0.x of LEMON. Here 12 is the list of people who contributed to those versions. 13 13 14 14 * Mihaly Barasz <klao@cs.elte.hu> … … 24 24 25 25 Again, please visit the history of the old LEMON repository for more 26 details: http://lemon.cs.elte.hu/ svn/lemon/trunk26 details: http://lemon.cs.elte.hu/hg/lemon-0.x -
CMakeLists.txt
r599 r1344 1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 3 IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) 4 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake) 5 ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) 6 SET(PROJECT_NAME "LEMON") 7 SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.") 8 ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) 9 1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 3 IF(POLICY CMP0048) 4 CMAKE_POLICY(SET CMP0048 OLD) 5 ENDIF(POLICY CMP0048) 6 7 IF(POLICY CMP0026) 8 #This is for copying the dll's needed by glpk (in lp_test and mip_test) 9 CMAKE_POLICY(SET CMP0026 OLD) 10 ENDIF(POLICY CMP0026) 11 12 SET(PROJECT_NAME "LEMON") 10 13 PROJECT(${PROJECT_NAME}) 11 14 15 INCLUDE(FindPythonInterp) 16 INCLUDE(FindWget) 17 18 IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) 19 INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) 20 ELSEIF(DEFINED ENV{LEMON_VERSION}) 21 SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") 22 ELSE() 23 EXECUTE_PROCESS( 24 COMMAND 25 hg log -r. --template "{latesttag}" 26 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 27 OUTPUT_VARIABLE HG_REVISION_TAG 28 ERROR_QUIET 29 OUTPUT_STRIP_TRAILING_WHITESPACE 30 ) 31 EXECUTE_PROCESS( 32 COMMAND 33 hg log -r. --template "{latesttagdistance}" 34 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 35 OUTPUT_VARIABLE HG_REVISION_DIST 36 ERROR_QUIET 37 OUTPUT_STRIP_TRAILING_WHITESPACE 38 ) 39 EXECUTE_PROCESS( 40 COMMAND 41 hg log -r. --template "{node|short}" 42 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 43 OUTPUT_VARIABLE HG_REVISION_ID 44 ERROR_QUIET 45 OUTPUT_STRIP_TRAILING_WHITESPACE 46 ) 47 48 IF(HG_REVISION_TAG STREQUAL "") 49 SET(HG_REVISION_ID "hg-tip") 50 ELSE() 51 IF(HG_REVISION_TAG STREQUAL "null") 52 SET(HG_REVISION_TAG "trunk") 53 ELSEIF(HG_REVISION_TAG MATCHES "^r") 54 STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG) 55 ENDIF() 56 IF(HG_REVISION_DIST STREQUAL "0") 57 SET(HG_REVISION ${HG_REVISION_TAG}) 58 ELSE() 59 SET(HG_REVISION 60 "${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}") 61 ENDIF() 62 ENDIF() 63 64 SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.") 65 ENDIF() 66 67 SET(PROJECT_VERSION ${LEMON_VERSION}) 68 12 69 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 13 70 14 INCLUDE(FindDoxygen) 15 INCLUDE(FindGhostscript) 16 FIND_PACKAGE(GLPK 4.33) 17 18 ADD_DEFINITIONS(-DHAVE_CONFIG_H) 71 FIND_PACKAGE(Doxygen) 72 FIND_PACKAGE(Ghostscript) 73 74 IF(WIN32) 75 SET(LEMON_WIN32 TRUE) 76 ENDIF(WIN32) 77 78 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.") 79 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.") 80 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.") 81 SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.") 82 83 IF(LEMON_ENABLE_GLPK) 84 FIND_PACKAGE(GLPK 4.33) 85 ENDIF(LEMON_ENABLE_GLPK) 86 IF(LEMON_ENABLE_ILOG) 87 FIND_PACKAGE(ILOG) 88 ENDIF(LEMON_ENABLE_ILOG) 89 IF(LEMON_ENABLE_COIN) 90 FIND_PACKAGE(COIN) 91 ENDIF(LEMON_ENABLE_COIN) 92 IF(LEMON_ENABLE_SOPLEX) 93 FIND_PACKAGE(SOPLEX) 94 ENDIF(LEMON_ENABLE_SOPLEX) 95 96 IF(GLPK_FOUND) 97 SET(LEMON_HAVE_LP TRUE) 98 SET(LEMON_HAVE_MIP TRUE) 99 SET(LEMON_HAVE_GLPK TRUE) 100 ENDIF(GLPK_FOUND) 101 IF(ILOG_FOUND) 102 SET(LEMON_HAVE_LP TRUE) 103 SET(LEMON_HAVE_MIP TRUE) 104 SET(LEMON_HAVE_CPLEX TRUE) 105 ENDIF(ILOG_FOUND) 106 IF(COIN_FOUND) 107 SET(LEMON_HAVE_LP TRUE) 108 SET(LEMON_HAVE_MIP TRUE) 109 SET(LEMON_HAVE_CLP TRUE) 110 SET(LEMON_HAVE_CBC TRUE) 111 ENDIF(COIN_FOUND) 112 IF(SOPLEX_FOUND) 113 SET(LEMON_HAVE_LP TRUE) 114 SET(LEMON_HAVE_SOPLEX TRUE) 115 ENDIF(SOPLEX_FOUND) 116 117 IF(ILOG_FOUND) 118 SET(DEFAULT_LP "CPLEX") 119 SET(DEFAULT_MIP "CPLEX") 120 ELSEIF(COIN_FOUND) 121 SET(DEFAULT_LP "CLP") 122 SET(DEFAULT_MIP "CBC") 123 ELSEIF(GLPK_FOUND) 124 SET(DEFAULT_LP "GLPK") 125 SET(DEFAULT_MIP "GLPK") 126 ELSEIF(SOPLEX_FOUND) 127 SET(DEFAULT_LP "SOPLEX") 128 ENDIF() 129 130 IF(NOT LEMON_DEFAULT_LP OR 131 (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR 132 (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR 133 (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR 134 (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX"))) 135 SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING 136 "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE) 137 ELSE() 138 SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING 139 "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)") 140 ENDIF() 141 IF(NOT LEMON_DEFAULT_MIP OR 142 (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR 143 (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR 144 (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK"))) 145 SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING 146 "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE) 147 ELSE() 148 SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING 149 "Default MIP solver backend (GLPK, CPLEX or CBC)") 150 ENDIF() 151 152 153 IF(DEFINED ENV{LEMON_CXX_WARNING}) 154 SET(CXX_WARNING $ENV{LEMON_CXX_WARNING}) 155 ELSE() 156 IF(CMAKE_COMPILER_IS_GNUCXX) 157 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") 158 SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") 159 SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") 160 ELSEIF(MSVC) 161 # This part is unnecessary 'casue the same is set by the lemon/core.h. 162 # Still kept as an example. 163 164 # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996") 165 166 # Suppressed warnings: 167 # C4250: 'class1' : inherits 'class2::member' via dominance 168 # C4267: conversion from 'size_t' to 'type', possible loss of data 169 # C4355: 'this' : used in base member initializer list 170 # C4503: 'function' : decorated name length exceeded, name was truncated 171 # C4800: 'type' : forcing value to bool 'true' or 'false' 172 # (performance warning) 173 # C4996: 'function': was declared deprecated 174 ELSE() 175 SET(CXX_WARNING "-Wall") 176 ENDIF() 177 ENDIF() 178 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.") 179 180 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}") 19 181 20 182 IF(MSVC) 21 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996") 22 # Suppressed warnings: 23 # C4250: 'class1' : inherits 'class2::member' via dominance 24 # C4355: 'this' : used in base member initializer list 25 # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) 26 # C4996: 'function': was declared deprecated 27 ENDIF(MSVC) 28 29 IF(GLPK_FOUND) 30 SET(HAVE_LP TRUE) 31 SET(HAVE_MIP TRUE) 32 SET(HAVE_GLPK TRUE) 33 ENDIF(GLPK_FOUND) 183 SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}") 184 SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING 185 "Flags used by the C++ compiler during maintainer builds." 186 ) 187 SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING 188 "Flags used by the C compiler during maintainer builds." 189 ) 190 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER 191 "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING 192 "Flags used for linking binaries during maintainer builds." 193 ) 194 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 195 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING 196 "Flags used by the shared libraries linker during maintainer builds." 197 ) 198 ELSE() 199 SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING 200 "Flags used by the C++ compiler during maintainer builds." 201 ) 202 SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING 203 "Flags used by the C compiler during maintainer builds." 204 ) 205 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER 206 "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING 207 "Flags used for linking binaries during maintainer builds." 208 ) 209 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 210 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING 211 "Flags used by the shared libraries linker during maintainer builds." 212 ) 213 ENDIF() 214 215 MARK_AS_ADVANCED( 216 CMAKE_CXX_FLAGS_MAINTAINER 217 CMAKE_C_FLAGS_MAINTAINER 218 CMAKE_EXE_LINKER_FLAGS_MAINTAINER 219 CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) 220 221 IF(CMAKE_CONFIGURATION_TYPES) 222 LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) 223 LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) 224 SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING 225 "Add the configurations that we need" 226 FORCE) 227 endif() 228 229 IF(NOT CMAKE_BUILD_TYPE) 230 SET(CMAKE_BUILD_TYPE "Release") 231 ENDIF() 232 233 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING 234 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." 235 FORCE ) 236 34 237 35 238 INCLUDE(CheckTypeSize) 36 239 CHECK_TYPE_SIZE("long long" LONG_LONG) 240 SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) 241 242 INCLUDE(FindThreads) 243 244 IF(NOT LEMON_THREADING) 245 IF(CMAKE_USE_PTHREADS_INIT) 246 SET(LEMON_THREADING "Pthread") 247 ELSEIF(CMAKE_USE_WIN32_THREADS_INIT) 248 SET(LEMON_THREADING "Win32") 249 ELSE() 250 SET(LEMON_THREADING "None") 251 ENDIF() 252 ENDIF() 253 254 SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING 255 "Choose the threading library, options are: Pthread Win32 None." 256 FORCE ) 257 258 IF(LEMON_THREADING STREQUAL "Pthread") 259 SET(LEMON_USE_PTHREAD TRUE) 260 ELSEIF(LEMON_THREADING STREQUAL "Win32") 261 SET(LEMON_USE_WIN32_THREADS TRUE) 262 ENDIF() 37 263 38 264 ENABLE_TESTING() 265 266 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 267 ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) 268 ELSE() 269 ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) 270 ENDIF() 39 271 40 272 ADD_SUBDIRECTORY(lemon) 41 273 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 274 ADD_SUBDIRECTORY(contrib) 42 275 ADD_SUBDIRECTORY(demo) 43 276 ADD_SUBDIRECTORY(tools) 44 277 ADD_SUBDIRECTORY(doc) 45 278 ADD_SUBDIRECTORY(test) 46 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 47 279 ENDIF() 280 281 CONFIGURE_FILE( 282 ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in 283 ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 284 @ONLY 285 ) 286 IF(UNIX) 287 INSTALL( 288 FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 289 DESTINATION share/lemon/cmake 290 ) 291 ELSEIF(WIN32) 292 INSTALL( 293 FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 294 DESTINATION cmake 295 ) 296 ENDIF() 297 298 CONFIGURE_FILE( 299 ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in 300 ${PROJECT_BINARY_DIR}/cmake/version.cmake 301 @ONLY 302 ) 303 304 SET(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME}) 305 STRING(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME) 306 SET(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION}) 307 ADD_CUSTOM_TARGET(dist 308 COMMAND cmake -E remove_directory ${ARCHIVE_NAME} 309 COMMAND hg archive ${ARCHIVE_NAME} 310 COMMAND cmake -E copy cmake/version.cmake ${ARCHIVE_NAME}/cmake/version.cmake 311 COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_NAME} 312 COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip ${ARCHIVE_NAME} 313 COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html 314 COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME} 315 COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME} 316 COMMAND cmake -E copy_directory doc/html ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION} 317 COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION} 318 COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION} 319 COMMAND cmake -E remove_directory ${ARCHIVE_NAME} 320 COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION} 321 DEPENDS html 322 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) 323 324 # CPACK config (Basically for NSIS) 48 325 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 49 IF(WIN32) 50 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 51 SET(CPACK_PACKAGE_VENDOR "EGRES") 52 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 53 "LEMON - Library of Efficient Models and Optimization in Networks") 54 SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") 55 56 SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) 57 58 SET(CPACK_PACKAGE_INSTALL_DIRECTORY 59 "${PROJECT_NAME} ${PROJECT_VERSION}") 60 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY 61 "${PROJECT_NAME} ${PROJECT_VERSION}") 62 63 SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) 64 65 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 66 SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 67 SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") 68 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 69 70 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 71 "C++ header files") 72 SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 73 "DLL and import library") 74 SET(CPACK_COMPONENT_BIN_DESCRIPTION 75 "Command line utilities") 76 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 77 "Doxygen generated documentation") 78 79 SET(CPACK_COMPONENT_HEADERS_DEPENDS library) 80 81 SET(CPACK_COMPONENT_HEADERS_GROUP "Development") 82 SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") 83 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 84 85 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 86 "Components needed to develop software using LEMON") 87 SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION 88 "Documentation of LEMON") 89 90 SET(CPACK_ALL_INSTALL_TYPES Full Developer) 91 92 SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 93 SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 94 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 95 96 SET(CPACK_GENERATOR "NSIS") 97 SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") 98 SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") 99 #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") 100 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") 101 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") 102 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") 103 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") 104 SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") 105 SET(CPACK_NSIS_CREATE_ICONS_EXTRA " 106 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" 107 ") 108 SET(CPACK_NSIS_DELETE_ICONS_EXTRA " 109 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP 110 Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" 111 ") 112 113 INCLUDE(CPack) 114 ENDIF(WIN32) 115 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 326 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 327 SET(CPACK_PACKAGE_VENDOR "EGRES") 328 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 329 "LEMON - Library for Efficient Modeling and Optimization in Networks") 330 SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") 331 332 SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) 333 334 SET(CPACK_PACKAGE_INSTALL_DIRECTORY 335 "${PROJECT_NAME} ${PROJECT_VERSION}") 336 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY 337 "${PROJECT_NAME} ${PROJECT_VERSION}") 338 339 SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) 340 341 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 342 SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 343 SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") 344 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 345 346 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 347 "C++ header files") 348 SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 349 "DLL and import library") 350 SET(CPACK_COMPONENT_BIN_DESCRIPTION 351 "Command line utilities") 352 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 353 "Doxygen generated documentation") 354 355 SET(CPACK_COMPONENT_HEADERS_DEPENDS library) 356 357 SET(CPACK_COMPONENT_HEADERS_GROUP "Development") 358 SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") 359 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 360 361 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 362 "Components needed to develop software using LEMON") 363 SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION 364 "Documentation of LEMON") 365 366 SET(CPACK_ALL_INSTALL_TYPES Full Developer) 367 368 SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 369 SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 370 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 371 372 SET(CPACK_GENERATOR "NSIS") 373 SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") 374 SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") 375 #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") 376 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") 377 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") 378 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") 379 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") 380 SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") 381 SET(CPACK_NSIS_CREATE_ICONS_EXTRA " 382 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" 383 ") 384 SET(CPACK_NSIS_DELETE_ICONS_EXTRA " 385 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP 386 Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" 387 ") 388 389 INCLUDE(CPack) 390 ENDIF() -
INSTALL
r526 r1233 2 2 ========================= 3 3 4 Since you are reading this I assume you already obtained one of the release 5 tarballs and successfully extracted it. The latest version of LEMON is 6 available at our web page (http://lemon.cs.elte.hu/). 4 This file contains instructions for building and installing LEMON from 5 source on Linux. The process on Windows is similar. 7 6 8 LEMON provides two different build environments, one is based on "autotool", 9 while the other is based on "cmake". This file contains instructions only for 10 the former one, which is the recommended build environment on Linux, Mac OSX 11 and other unices or if you use Cygwin on Windows. For cmake installation 12 instructions visit http://lemon.cs.elte.hu. 7 Note that it is not necessary to install LEMON in order to use 8 it. Instead, you can easily integrate it with your own code 9 directly. For instructions, see 10 https://lemon.cs.elte.hu/trac/lemon/wiki/HowToCompile 11 13 12 14 13 In order to install LEMON from the extracted source tarball you have to 15 14 issue the following commands: 16 15 17 1. `cd lemon-x.y.z'16 1. Step into the root of the source directory. 18 17 19 This command changes to the directory which was created when you 20 extracted the sources. The x.y.z part is a version number. 18 $ cd lemon-x.y.z 21 19 22 2. `./configure'20 2. Create a build subdirectory and step into it. 23 21 24 This command runs the configure shell script, which does some checks and25 creates the makefiles.22 $ mkdir build 23 $ cd build 26 24 27 3. `make'25 3. Perform system checks and create the makefiles. 28 26 29 This command compiles the non-template part of LEMON into libemon.a 30 file. It also compiles the programs in the tools and demo subdirectories 31 when enabled. 27 $ cmake .. 32 28 33 4. `make check'29 4. Build LEMON. 34 30 35 This step is optional, but recommended. It runs the test programs that 36 we developed for LEMON to check whether the library works properly on 37 your platform. 31 $ make 38 32 39 5. `make install' 33 This command compiles the non-template part of LEMON into 34 libemon.a file. It also compiles the programs in the 'tools' and 35 'demo' subdirectories. 36 37 5. [Optional] Compile and run the self-tests. 38 39 $ make check 40 41 5. [Optional] Generate the user documentation. 42 43 $ make html 44 45 The release tarballs already include the documentation. 46 47 Note that for this step you need to have the following tools 48 installed: Python, Doxygen, Graphviz, Ghostscript, LaTeX. 49 50 6. [Optional] Install LEMON 51 52 $ make install 40 53 41 54 This command installs LEMON under /usr/local (you will need root 42 privileges to be able to do that). If you want to install it to some 43 other location, then pass the --prefix=DIRECTORY flag to configure in 44 step 2. For example: `./configure --prefix=/home/username/lemon'. 45 46 6. `make install-html' 47 48 This command installs the documentation under share/doc/lemon/docs. The 49 generated documentation is included in the tarball. If you want to 50 generate it yourself, then run `make html'. Note that for this you need 51 to have the following programs installed: Doxygen, Graphviz, Ghostscript, 52 Latex. 53 55 privileges to be able to do that). If you want to install it to 56 some other location, then pass the 57 -DCMAKE_INSTALL_PREFIX=DIRECTORY flag to cmake in Step 3. 58 For example: 59 60 $ cmake -DCMAKE_INSTALL_PREFIX=/home/username/lemon' 54 61 55 62 Configure Options and Variables 56 63 =============================== 57 64 58 In step 2 you can customize the actions of configure by setting variables 59 and passing options to it. This can be done like this: 60 `./configure [OPTION]... [VARIABLE=VALUE]...' 65 In Step 3, you can customize the build process by passing options to CMAKE. 61 66 62 Below you will find some useful variables and options (see `./configure --help' 63 for more): 67 $ cmake [OPTIONS] .. 64 68 65 CXX='comp' 69 You find a list of the most useful options below. 66 70 67 Change the C++ compiler to 'comp'. 68 69 CXXFLAGS='flags' 70 71 Pass the 'flags' to the compiler. For example CXXFLAGS='-O3 -march=pentium-m' 72 turns on generation of aggressively optimized Pentium-M specific code. 73 74 --prefix=PREFIX 71 -DCMAKE_INSTALL_PREFIX=PREFIX 75 72 76 73 Set the installation prefix to PREFIX. By default it is /usr/local. 77 74 78 - -enable-demo75 -DCMAKE_BUILD_TYPE=[Release|Debug|Maintainer|...] 79 76 80 Build the examples in the demo subdirectory.77 This sets the compiler options. The choices are the following 81 78 82 --disable-demo 79 'Release': A strong optimization is turned on (-O3 with gcc). This 80 is the default setting and we strongly recommend using this for 81 the final compilation. 83 82 84 Do not build the examples in the demo subdirectory (default). 83 'Debug': Optimization is turned off and debug info is added (-O0 84 -ggdb with gcc). If is recommended during the development. 85 85 86 --enable-tools 86 'Maintainer': The same as 'Debug' but the compiler warnings are 87 converted to errors (-Werror with gcc). In addition, 'make' will 88 also automatically compile and execute the test codes. It is the 89 best way of ensuring that LEMON codebase is clean and safe. 87 90 88 Build the programs in the tools subdirectory (default).91 'RelWithDebInfo': Optimized build with debug info. 89 92 90 --disable-tools 93 'MinSizeRel': Size optimized build (-Os with gcc) 91 94 92 Do not build the programs in the tools subdirectory. 95 -DTEST_WITH_VALGRIND=YES 93 96 94 --with-glpk[=PREFIX] 97 Using this, the test codes will be executed using valgrind. It is a 98 very effective way of identifying indexing problems and memory leaks. 95 99 96 Enable GLPK support (default). You should specify the prefix too if 97 you installed GLPK to some non-standard location (e.g. your home 98 directory). If it is not found, GLPK support will be disabled. 100 -DCMAKE_CXX_COMPILER=path-to-compiler 99 101 100 --with-glpk-includedir=DIR 102 Change the compiler to be used. 101 103 102 The directory where the GLPK header files are located. This is only 103 useful when the GLPK headers and libraries are not under the same 104 prefix (which is unlikely). 104 -DBUILD_SHARED_LIBS=TRUE 105 105 106 --with-glpk-libdir=DIR 106 Build shared library instead of static one. Think twice if you 107 really want to use this option. 107 108 108 The directory where the GLPK libraries are located. This is only 109 useful when the GLPK headers and libraries are not under the same 110 prefix (which is unlikely). 109 -DLEMON_DOC_SOURCE_BROWSER=YES 111 110 112 --without-glpk 111 Include the browsable cross referenced LEMON source code into the 112 doc. It makes the doc quite bloated, but may be useful for 113 developing LEMON itself. 113 114 114 Disable GLPK support. 115 -DLEMON_DOC_USE_MATHJAX=YES 115 116 116 --with-cplex[=PREFIX] 117 Use MathJax (http://mathjax.org) for rendering the math formulae in 118 the doc. It of much higher quality compared to the default LaTeX 119 generated static images and it allows copy&paste of the formulae to 120 LaTeX, Open Office, MS Word etc. documents. 117 121 118 Enable CPLEX support (default). You should specify the prefix too 119 if you installed CPLEX to some non-standard location 120 (e.g. /opt/ilog/cplex75). If it is not found, CPLEX support will be 121 disabled. 122 On the other hand, it needs either Internet access or a locally 123 installed version of MathJax to properly render the doc. 122 124 123 --with-cplex-includedir=DIR 125 -DLEMON_DOC_MATHJAX_RELPATH=DIRECTORY 126 127 The location of the MathJax library. It defaults to 128 http://www.mathjax.org/mathjax, which necessitates Internet access 129 for proper rendering. The easiest way to make it usable offline is 130 to set this parameter to 'mathjax' and copy all files of the MathJax 131 library into the 'doc/html/mathjax' subdirectory of the build 132 location. 124 133 125 The directory where the CPLEX header files are located. This is 126 only useful when the CPLEX headers and libraries are not under the 127 same prefix (e.g. /usr/local/cplex/cplex75/include). 134 See http://docs.mathjax.org/en/latest/installation.html for more details. 128 135 129 --with-cplex-libdir=DIR 136 137 -DLEMON_ENABLE_GLPK=NO 138 -DLEMON_ENABLE_COIN=NO 139 -DLEMON_ENABLE_ILOG=NO 130 140 131 The directory where the CPLEX libraries are located. This is only 132 useful when the CPLEX headers and libraries are not under the same 133 prefix (e.g. 134 /usr/local/cplex/cplex75/lib/i86_linux2_glibc2.2_gcc3.0/static_pic_mt). 141 Enable optional third party libraries. They are all enabled by default. 135 142 136 - -without-cplex143 -DLEMON_DEFAULT_LP=GLPK 137 144 138 Disable CPLEX support. 145 Sets the default LP solver backend. The supported values are 146 CPLEX, CLP and GLPK. By default, it is set to the first one which 147 is enabled and succesfully discovered. 139 148 140 - -with-soplex[=PREFIX]149 -DLEMON_DEFAULT_MIP=GLPK 141 150 142 Enable SoPlex support (default). You should specify the prefix too if143 you installed SoPlex to some non-standard location (e.g. your home144 directory). If it is not found, SoPlex support will be disabled.151 Sets the default MIP solver backend. The supported values are 152 CPLEX, CBC and GLPK. By default, it is set to the first one which 153 is enabled and succesfully discovered. 145 154 146 --with-soplex-includedir=DIR 155 -DGLPK_ROOT_DIR=DIRECTORY 156 -DCOIN_ROOT_DIR=DIRECTORY 157 -DILOG_ROOT_DIR=DIRECTORY 147 158 148 The directory where the SoPlex header files are located. This is only 149 useful when the SoPlex headers and libraries are not under the same 150 prefix (which is unlikely). 159 Root directory prefixes of optional third party libraries. 151 160 152 --with-soplex-libdir=DIR 161 Makefile Variables 162 ================== 153 163 154 The directory where the SoPlex libraries are located. This is only 155 useful when the SoPlex headers and libraries are not under the same 156 prefix (which is unlikely). 164 make VERBOSE=1 157 165 158 --without-soplex 159 160 Disable SoPlex support. 166 This results in a more verbose output by showing the full 167 compiler and linker commands. -
LICENSE
r600 r1148 2 2 copyright/license. 3 3 4 Copyright (C) 2003-20 09Egervary Jeno Kombinatorikus Optimalizalasi4 Copyright (C) 2003-2012 Egervary Jeno Kombinatorikus Optimalizalasi 5 5 Kutatocsoport (Egervary Combinatorial Optimization Research Group, 6 6 EGRES). -
NEWS
r534 r1320 1 2014-07-07 Version 1.3.1 released 2 3 Bugfix release. 4 5 #484: Require CMAKE 2.8 6 #471, #472, #480: Various clang compatibility fixes 7 #481, #482: Fix shared lib build and versioning 8 #476: Fix invalid map query in NearestNeighborTsp 9 #478: Bugfix in debug checking and lower bound handling 10 in min cost flow algorithms 11 #479, #465: Bugfix in default LP/MIP backend settings 12 #476: Bugfix in tsp_test 13 #487: Add missing include header and std:: namespace spec. 14 #474: Fix division by zero error in NetworkSimplex 15 16 2013-08-10 Version 1.3 released 17 18 This is major feature release 19 20 * New data structures 21 22 #69 : Bipartite graph concepts and implementations 23 24 * New algorithms 25 26 #177: Port Edmonds-Karp algorithm 27 #380, #405: Heuristic algorithm for the max clique problem 28 #386: Heuristic algorithms for symmetric TSP 29 ----: Nagamochi-Ibaraki algorithm [5087694945e4] 30 #397, #56: Max. cardinality search 31 32 * Other new features 33 34 #223: Thread safe graph and graph map implementations 35 #442: Different TimeStamp print formats 36 #457: File export functionality to LpBase 37 #362: Bidirectional iterator support for radixSort() 38 39 * Implementation improvements 40 41 ----: Network Simplex 42 #391: Better update process, pivot rule and arc mixing 43 #435: Improved Altering List pivot rule 44 #417: Various fine tunings in CostScaling 45 #438: Optional iteration limit in HowardMmc 46 #436: Ensure strongly polynomial running time for CycleCanceling 47 while keeping the same performance 48 ----: Make the CBC interface be compatible with latest CBC releases 49 [ee581a0ecfbf] 50 51 * CMAKE has become the default build environment (#434) 52 53 ----: Autotool support has been dropped 54 ----: Improved LP/MIP configuration 55 #465: Enable/disable options for LP/MIP backends 56 #446: Better CPLEX discovery 57 #460: Add cmake config to find SoPlex 58 ----: Allow CPACK configuration on all platforms 59 #390: Add 'Maintainer' CMAKE build type 60 #388: Add 'check' target. 61 #401: Add contrib dir 62 #389: Better version string setting in CMAKE 63 #433: Support shared library build 64 #416: Support testing with valgrind 65 66 * Doc improvements 67 68 #395: SOURCE_BROWSER Doxygen switch is configurable from CMAKE 69 update-external-tags CMAKE target 70 #455: Optionally use MathJax for rendering the math formulae 71 #402, #437, #459, #456, #463: Various doc improvements 72 73 * Bugfixes (compared to release 1.2): 74 75 #432: Add missing doc/template.h and doc/references.bib to release 76 tarball 77 ----: Intel C++ compatibility fixes 78 #441: Fix buggy reinitialization in _solver_bits::VarIndex::clear() 79 #444: Bugfix in path copy constructors and assignment operators 80 #447: Bugfix in AllArcLookUp<> 81 #448: Bugfix in adaptor_test.cc 82 #449: Fix clang compilation warnings and errors 83 #440: Fix a bug + remove redundant typedefs in dimacs-solver 84 #453: Avoid GCC 4.7 compiler warnings 85 #445: Fix missing initialization in CplexEnv::CplexEnv() 86 #428: Add missing lemon/lemon.pc.cmake to the release tarball 87 #393: Create and install lemon.pc 88 #429: Fix VS warnings 89 #430: Fix LpBase::Constr two-side limit bug 90 #392: Bug fix in Dfs::start(s,t) 91 #414: Fix wrong initialization in Preflow 92 #418: Better Win CodeBlock/MinGW support 93 #419: Build environment improvements 94 - Build of mip_test and lp_test precede the running of the tests 95 - Also search for coin libs under ${COIN_ROOT_DIR}/lib/coin 96 - Do not look for COIN_VOL libraries 97 #382: Allow lgf file without Arc maps 98 #417: Bug fix in CostScaling 99 #366: Fix Pred[Matrix]MapPath::empty() 100 #371: Bug fix in (di)graphCopy() 101 The target graph is cleared before adding nodes and arcs/edges. 102 #364: Add missing UndirectedTags 103 #368: Fix the usage of std::numeric_limits<>::min() in Network Simplex 104 #372: Fix a critical bug in preflow 105 #461: Bugfix in assert.h 106 #470: Fix compilation issues related to various gcc versions 107 #446: Fix #define indicating CPLEX availability 108 #294: Add explicit namespace to 109 ignore_unused_variable_warning() usages 110 #420: Bugfix in IterableValueMap 111 #439: Bugfix in biNodeConnected() 112 113 114 2010-03-19 Version 1.2 released 115 116 This is major feature release 117 118 * New algorithms 119 * Bellman-Ford algorithm (#51) 120 * Minimum mean cycle algorithms (#179) 121 * Karp, Hartman-Orlin and Howard algorithms 122 * New minimum cost flow algorithms (#180) 123 * Cost Scaling algorithms 124 * Capacity Scaling algorithm 125 * Cycle-Canceling algorithms 126 * Planarity related algorithms (#62) 127 * Planarity checking algorithm 128 * Planar embedding algorithm 129 * Schnyder's planar drawing algorithm 130 * Coloring planar graphs with five or six colors 131 * Fractional matching algorithms (#314) 132 * New data structures 133 * StaticDigraph structure (#68) 134 * Several new priority queue structures (#50, #301) 135 * Fibonacci, Radix, Bucket, Pairing, Binomial 136 D-ary and fourary heaps (#301) 137 * Iterable map structures (#73) 138 * Other new tools and functionality 139 * Map utility functions (#320) 140 * Reserve functions are added to ListGraph and SmartGraph (#311) 141 * A resize() function is added to HypercubeGraph (#311) 142 * A count() function is added to CrossRefMap (#302) 143 * Support for multiple targets in Suurballe using fullInit() (#181) 144 * Traits class and named parameters for Suurballe (#323) 145 * Separate reset() and resetParams() functions in NetworkSimplex 146 to handle graph changes (#327) 147 * tolerance() functions are added to HaoOrlin (#306) 148 * Implementation improvements 149 * Improvements in weighted matching algorithms (#314) 150 * Jumpstart initialization 151 * ArcIt iteration is based on out-arc lists instead of in-arc lists 152 in ListDigraph (#311) 153 * Faster add row operation in CbcMip (#203) 154 * Better implementation for split() in ListDigraph (#311) 155 * ArgParser can also throw exception instead of exit(1) (#332) 156 * Miscellaneous 157 * A simple interactive bootstrap script 158 * Doc improvements (#62,#180,#299,#302,#303,#304,#307,#311,#331,#315, 159 #316,#319) 160 * BibTeX references in the doc (#184) 161 * Optionally use valgrind when running tests 162 * Also check ReferenceMapTag in concept checks (#312) 163 * dimacs-solver uses long long type by default. 164 * Several bugfixes (compared to release 1.1): 165 #295: Suppress MSVC warnings using pragmas 166 ----: Various CMAKE related improvements 167 * Remove duplications from doc/CMakeLists.txt 168 * Rename documentation install folder from 'docs' to 'html' 169 * Add tools/CMakeLists.txt to the tarball 170 * Generate and install LEMONConfig.cmake 171 * Change the label of the html project in Visual Studio 172 * Fix the check for the 'long long' type 173 * Put the version string into config.h 174 * Minor CMake improvements 175 * Set the version to 'hg-tip' if everything fails 176 #311: Add missing 'explicit' keywords 177 #302: Fix the implementation and doc of CrossRefMap 178 #308: Remove duplicate list_graph.h entry from source list 179 #307: Bugfix in Preflow and Circulation 180 #305: Bugfix and extension in the rename script 181 #312: Also check ReferenceMapTag in concept checks 182 #250: Bugfix in pathSource() and pathTarget() 183 #321: Use pathCopy(from,to) instead of copyPath(to,from) 184 #322: Distribure LEMONConfig.cmake.in 185 #330: Bug fix in map_extender.h 186 #336: Fix the date field comment of graphToEps() output 187 #323: Bug fix in Suurballe 188 #335: Fix clear() function in ExtendFindEnum 189 #337: Use void* as the LPX object pointer 190 #317: Fix (and improve) error message in mip_test.cc 191 Remove unnecessary OsiCbc dependency 192 #356: Allow multiple executions of weighted matching algorithms (#356) 193 194 2009-05-13 Version 1.1 released 195 196 This is the second stable release of the 1.x series. It 197 features a better coverage of the tools available in the 0.x 198 series, a thoroughly reworked LP/MIP interface plus various 199 improvements in the existing tools. 200 201 * Much improved M$ Windows support 202 * Various improvements in the CMAKE build system 203 * Compilation warnings are fixed/suppressed 204 * Support IBM xlC compiler 205 * New algorithms 206 * Connectivity related algorithms (#61) 207 * Euler walks (#65) 208 * Preflow push-relabel max. flow algorithm (#176) 209 * Circulation algorithm (push-relabel based) (#175) 210 * Suurballe algorithm (#47) 211 * Gomory-Hu algorithm (#66) 212 * Hao-Orlin algorithm (#58) 213 * Edmond's maximum cardinality and weighted matching algorithms 214 in general graphs (#48,#265) 215 * Minimum cost arborescence/branching (#60) 216 * Network Simplex min. cost flow algorithm (#234) 217 * New data structures 218 * Full graph structure (#57) 219 * Grid graph structure (#57) 220 * Hypercube graph structure (#57) 221 * Graph adaptors (#67) 222 * ArcSet and EdgeSet classes (#67) 223 * Elevator class (#174) 224 * Other new tools 225 * LP/MIP interface (#44) 226 * Support for GLPK, CPLEX, Soplex, COIN-OR CLP and CBC 227 * Reader for the Nauty file format (#55) 228 * DIMACS readers (#167) 229 * Radix sort algorithms (#72) 230 * RangeIdMap and CrossRefMap (#160) 231 * New command line tools 232 * DIMACS to LGF converter (#182) 233 * lgf-gen - a graph generator (#45) 234 * DIMACS solver utility (#226) 235 * Other code improvements 236 * Lognormal distribution added to Random (#102) 237 * Better (i.e. O(1) time) item counting in SmartGraph (#3) 238 * The standard maps of graphs are guaranteed to be 239 reference maps (#190) 240 * Miscellaneous 241 * Various doc improvements 242 * Improved 0.x -> 1.x converter script 243 244 * Several bugfixes (compared to release 1.0): 245 #170: Bugfix SmartDigraph::split() 246 #171: Bugfix in SmartGraph::restoreSnapshot() 247 #172: Extended test cases for graphs and digraphs 248 #173: Bugfix in Random 249 * operator()s always return a double now 250 * the faulty real<Num>(Num) and real<Num>(Num,Num) 251 have been removed 252 #187: Remove DijkstraWidestPathOperationTraits 253 #61: Bugfix in DfsVisit 254 #193: Bugfix in GraphReader::skipSection() 255 #195: Bugfix in ConEdgeIt() 256 #197: Bugfix in heap unionfind 257 * This bug affects Edmond's general matching algorithms 258 #207: Fix 'make install' without 'make html' using CMAKE 259 #208: Suppress or fix VS2008 compilation warnings 260 ----: Update the LEMON icon 261 ----: Enable the component-based installer 262 (in installers made by CPACK) 263 ----: Set the proper version for CMAKE in the tarballs 264 (made by autotools) 265 ----: Minor clarification in the LICENSE file 266 ----: Add missing unistd.h include to time_measure.h 267 #204: Compilation bug fixed in graph_to_eps.h with VS2005 268 #214,#215: windows.h should never be included by LEMON headers 269 #230: Build systems check the availability of 'long long' type 270 #229: Default implementation of Tolerance<> is used for integer types 271 #211,#212: Various fixes for compiling on AIX 272 ----: Improvements in CMAKE config 273 - docs is installed in share/doc/ 274 - detects newer versions of Ghostscript 275 #239: Fix missing 'inline' specifier in time_measure.h 276 #274,#280: Install lemon/config.h 277 #275: Prefix macro names with LEMON_ in lemon/config.h 278 ----: Small script for making the release tarballs added 279 ----: Minor improvement in unify-sources.sh (a76f55d7d397) 280 1 281 2009-03-27 LEMON joins to the COIN-OR initiative 2 282 … … 8 288 2008-10-13 Version 1.0 released 9 289 10 11 12 13 14 15 290 This is the first stable release of LEMON. Compared to the 0.x 291 release series, it features a considerably smaller but more 292 matured set of tools. The API has also completely revised and 293 changed in several places. 294 295 * The major name changes compared to the 0.x series (see the 16 296 Migration Guide in the doc for more details) 17 297 * Graph -> Digraph, UGraph -> Graph 18 298 * Edge -> Arc, UEdge -> Edge 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 299 * source(UEdge)/target(UEdge) -> u(Edge)/v(Edge) 300 * Other improvements 301 * Better documentation 302 * Reviewed and cleaned up codebase 303 * CMake based build system (along with the autotools based one) 304 * Contents of the library (ported from 0.x) 305 * Algorithms 306 * breadth-first search (bfs.h) 307 * depth-first search (dfs.h) 308 * Dijkstra's algorithm (dijkstra.h) 309 * Kruskal's algorithm (kruskal.h) 310 * Data structures 311 * graph data structures (list_graph.h, smart_graph.h) 312 * path data structures (path.h) 313 * binary heap data structure (bin_heap.h) 314 * union-find data structures (unionfind.h) 315 * miscellaneous property maps (maps.h) 316 * two dimensional vector and bounding box (dim2.h) 37 317 * Concepts 38 318 * graph structure concepts (concepts/digraph.h, concepts/graph.h, 39 319 concepts/graph_components.h) 40 41 42 43 44 45 46 47 48 320 * concepts for other structures (concepts/heap.h, concepts/maps.h, 321 concepts/path.h) 322 * Tools 323 * Mersenne twister random number generator (random.h) 324 * tools for measuring cpu and wall clock time (time_measure.h) 325 * tools for counting steps and events (counter.h) 326 * tool for parsing command line arguments (arg_parser.h) 327 * tool for visualizing graphs (graph_to_eps.h) 328 * tools for reading and writing data in LEMON Graph Format 49 329 (lgf_reader.h, lgf_writer.h) 50 330 * tools to handle the anomalies of calculations with 51 331 floating point numbers (tolerance.h) 52 332 * tools to manage RGB colors (color.h) 53 54 55 56 57 333 * Infrastructure 334 * extended assertion handling (assert.h) 335 * exception classes and error handling (error.h) 336 * concept checking (concept_check.h) 337 * commonly used mathematical constants (math.h) -
README
r318 r921 1 ================================================================== 2 LEMON - a Library of Efficient Modelsand Optimization in Networks3 ================================================================== 1 ===================================================================== 2 LEMON - a Library for Efficient Modeling and Optimization in Networks 3 ===================================================================== 4 4 5 5 LEMON is an open source library written in C++. It provides … … 17 17 18 18 Copying, distribution and modification conditions and terms. 19 20 NEWS 21 22 News and version history. 19 23 20 24 INSTALL … … 34 38 Some example programs to make you easier to get familiar with LEMON. 35 39 40 scripts/ 41 42 Scripts that make it easier to develop LEMON. 43 36 44 test/ 37 45 -
cmake/FindGLPK.cmake
r496 r1232 1 SET(GLPK_ROOT_DIR "" CACHE PATH "GLPK root directory") 2 1 3 SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]") 2 4 GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE) … … 4 6 FIND_PATH(GLPK_INCLUDE_DIR 5 7 glpk.h 6 PATHS ${GLPK_REGKEY}/include) 8 PATHS ${GLPK_REGKEY}/include 9 HINTS ${GLPK_ROOT_DIR}/include 10 ) 11 FIND_LIBRARY(GLPK_LIBRARY 12 glpk 13 PATHS ${GLPK_REGKEY}/lib 14 HINTS ${GLPK_ROOT_DIR}/lib 15 ) 7 16 8 FIND_LIBRARY(GLPK_LIBRARY 9 NAMES glpk 10 PATHS ${GLPK_REGKEY}/lib) 17 IF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) 18 FILE(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H) 19 20 STRING(REGEX MATCH "define[ ]+GLP_MAJOR_VERSION[ ]+[0-9]+" GLPK_MAJOR_VERSION_LINE "${GLPK_GLPK_H}") 21 STRING(REGEX REPLACE "define[ ]+GLP_MAJOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MAJOR "${GLPK_MAJOR_VERSION_LINE}") 22 23 STRING(REGEX MATCH "define[ ]+GLP_MINOR_VERSION[ ]+[0-9]+" GLPK_MINOR_VERSION_LINE "${GLPK_GLPK_H}") 24 STRING(REGEX REPLACE "define[ ]+GLP_MINOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MINOR "${GLPK_MINOR_VERSION_LINE}") 25 26 SET(GLPK_VERSION_STRING "${GLPK_VERSION_MAJOR}.${GLPK_VERSION_MINOR}") 27 28 IF(GLPK_FIND_VERSION) 29 IF(GLPK_FIND_VERSION_COUNT GREATER 2) 30 MESSAGE(SEND_ERROR "unexpected version string") 31 ENDIF(GLPK_FIND_VERSION_COUNT GREATER 2) 32 33 MATH(EXPR GLPK_REQUESTED_VERSION "${GLPK_FIND_VERSION_MAJOR}*100 + ${GLPK_FIND_VERSION_MINOR}") 34 MATH(EXPR GLPK_FOUND_VERSION "${GLPK_VERSION_MAJOR}*100 + ${GLPK_VERSION_MINOR}") 35 36 IF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) 37 SET(GLPK_PROPER_VERSION_FOUND FALSE) 38 ELSE(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) 39 SET(GLPK_PROPER_VERSION_FOUND TRUE) 40 ENDIF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION) 41 ELSE(GLPK_FIND_VERSION) 42 SET(GLPK_PROPER_VERSION_FOUND TRUE) 43 ENDIF(GLPK_FIND_VERSION) 44 ENDIF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) 11 45 12 46 INCLUDE(FindPackageHandleStandardArgs) 13 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR )47 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) 14 48 15 49 IF(GLPK_FOUND) 50 SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR}) 16 51 SET(GLPK_LIBRARIES ${GLPK_LIBRARY}) 17 52 SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin) -
cmake/version.cmake.in
r503 r1135 1 SET(PROJECT_NAME "@PACKAGE_NAME@") 2 SET(PROJECT_VERSION "@PACKAGE_VERSION@" CACHE STRING "LEMON version string.") 1 SET(LEMON_VERSION "@LEMON_VERSION@" CACHE STRING "LEMON version string.") -
demo/CMakeLists.txt
r596 r726 4 4 ) 5 5 6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) 6 LINK_DIRECTORIES( 7 ${PROJECT_BINARY_DIR}/lemon 8 ) 7 9 8 10 SET(DEMOS 9 11 arg_parser_demo 10 12 graph_to_eps_demo 11 lgf_demo) 13 lgf_demo 14 ) 12 15 13 16 FOREACH(DEMO_NAME ${DEMOS}) 14 17 ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc) 15 18 TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon) 16 ENDFOREACH( DEMO_NAME)19 ENDFOREACH() -
demo/arg_parser_demo.cc
r463 r956 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 66 66 .other("..."); 67 67 68 // Throw an exception when problems occurs. The default behavior is to 69 // exit(1) on these cases, but this makes Valgrind falsely warn 70 // about memory leaks. 71 ap.throwOnProblems(); 72 68 73 // Perform the parsing process 69 74 // (in case of any error it terminates the program) 70 ap.parse(); 75 // The try {} construct is necessary only if the ap.trowOnProblems() 76 // setting is in use. 77 try { 78 ap.parse(); 79 } catch (ArgParserException &) { return 1; } 71 80 72 81 // Check each option if it has been given and print its value -
demo/graph_to_eps_demo.cc
r463 r659 183 183 ListDigraph::NodeMap<Point> hcoords(h); 184 184 185 int cols=int(s qrt(double(palette.size())));185 int cols=int(std::sqrt(double(palette.size()))); 186 186 for(int i=0;i<int(paletteW.size());i++) { 187 187 Node n=h.addNode(); -
doc/CMakeLists.txt
r596 r1251 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 SET(LEMON_DOC_USE_MATHJAX "NO" CACHE STRING "Use MathJax to display math formulae (YES/NO).") 8 SET(LEMON_DOC_MATHJAX_RELPATH "http://www.mathjax.org/mathjax" CACHE STRING "MathJax library location.") 9 10 SET(LEMON_DOC_LIBSTDC++_URL 11 "http://gcc.gnu.org/onlinedocs/gcc-4.7.3/libstdc++/api" 12 CACHE STRING "GCC libstdc++ doxygen doc url.") 13 14 6 15 CONFIGURE_FILE( 7 16 ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 8 17 ${PROJECT_BINARY_DIR}/doc/Doxyfile 9 @ONLY) 18 @ONLY 19 ) 10 20 11 IF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) 21 CONFIGURE_FILE( 22 ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in 23 ${PROJECT_BINARY_DIR}/doc/mainpage.dox 24 @ONLY 25 ) 26 27 # Copy doc from source (if exists) 28 IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/html AND 29 NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html) 30 MESSAGE(STATUS "Copy doc from source tree") 31 EXECUTE_PROCESS( 32 COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/html ${CMAKE_CURRENT_BINARY_DIR}/html 33 ) 34 ENDIF() 35 36 IF(DOXYGEN_EXECUTABLE AND PYTHONINTERP_FOUND AND GHOSTSCRIPT_EXECUTABLE) 12 37 FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/) 38 SET(GHOSTSCRIPT_OPTIONS -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha) 39 ADD_CUSTOM_TARGET(html 40 COMMAND ${CMAKE_COMMAND} -E remove_directory gen-images 41 COMMAND ${CMAKE_COMMAND} -E make_directory gen-images 42 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r20 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps 43 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/adaptors2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/adaptors2.eps 44 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps 45 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps 46 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps 47 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps 48 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps 49 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/matching.eps 50 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps 51 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r40 -sOutputFile=gen-images/planar.png ${CMAKE_CURRENT_SOURCE_DIR}/images/planar.eps 52 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/tsp.png ${CMAKE_CURRENT_SOURCE_DIR}/images/tsp.eps 53 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 54 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 55 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 56 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 57 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 58 COMMAND ${CMAKE_COMMAND} -E remove_directory html 59 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 60 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 61 ) 62 63 SET_TARGET_PROPERTIES(html PROPERTIES PROJECT_LABEL BUILD_DOC) 64 13 65 IF(UNIX) 14 ADD_CUSTOM_TARGET(html 15 COMMAND rm -rf gen-images 16 COMMAND mkdir gen-images 17 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps 18 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 19 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 20 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 21 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 22 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 23 COMMAND rm -rf html 24 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 25 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 66 INSTALL( 67 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 68 DESTINATION share/doc/lemon/html 69 COMPONENT html_documentation 70 ) 26 71 ELSEIF(WIN32) 27 ADD_CUSTOM_TARGET(html 28 COMMAND if exist gen-images rmdir /s /q gen-images 29 COMMAND mkdir gen-images 30 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 31 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 32 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 33 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 34 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 35 COMMAND if exist html rmdir /s /q html 36 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 37 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 38 ENDIF(UNIX) 39 INSTALL( 40 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 41 DESTINATION share/doc 42 COMPONENT html_documentation) 43 ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) 72 INSTALL( 73 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 74 DESTINATION doc 75 COMPONENT html_documentation 76 ) 77 ENDIF() 78 79 ENDIF() 80 81 IF(WGET_FOUND) 82 ADD_CUSTOM_TARGET(update-external-tags 83 COMMAND ${WGET_EXECUTABLE} -N ${LEMON_DOC_LIBSTDC++_URL}/libstdc++.tag 84 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 85 ) 86 ENDIF() -
doc/Doxyfile.in
r379 r1251 1 # Doxyfile 1. 5.7.11 # Doxyfile 1.7.3 2 2 3 3 #--------------------------------------------------------------------------- … … 5 5 #--------------------------------------------------------------------------- 6 6 DOXYFILE_ENCODING = UTF-8 7 PROJECT_NAME = @PACKAGE_NAME@ 8 PROJECT_NUMBER = @PACKAGE_VERSION@ 7 PROJECT_NAME = 8 PROJECT_NUMBER = 9 PROJECT_BRIEF = 10 PROJECT_LOGO = 9 11 OUTPUT_DIRECTORY = 10 12 CREATE_SUBDIRS = NO … … 22 24 QT_AUTOBRIEF = NO 23 25 MULTILINE_CPP_IS_BRIEF = NO 24 DETAILS_AT_TOP = YES25 26 INHERIT_DOCS = NO 26 27 SEPARATE_MEMBER_PAGES = NO … … 31 32 OPTIMIZE_FOR_FORTRAN = NO 32 33 OPTIMIZE_OUTPUT_VHDL = NO 34 EXTENSION_MAPPING = 33 35 BUILTIN_STL_SUPPORT = YES 34 36 CPP_CLI_SUPPORT = NO … … 56 58 HIDE_SCOPE_NAMES = YES 57 59 SHOW_INCLUDE_FILES = YES 60 FORCE_LOCAL_INCLUDES = NO 58 61 INLINE_INFO = YES 59 62 SORT_MEMBER_DOCS = NO 60 63 SORT_BRIEF_DOCS = NO 64 SORT_MEMBERS_CTORS_1ST = NO 61 65 SORT_GROUP_NAMES = NO 62 66 SORT_BY_SCOPE_NAME = NO 67 STRICT_PROTO_MATCHING = NO 63 68 GENERATE_TODOLIST = YES 64 69 GENERATE_TESTLIST = YES … … 72 77 SHOW_NAMESPACES = YES 73 78 FILE_VERSION_FILTER = 74 LAYOUT_FILE = DoxygenLayout.xml 79 LAYOUT_FILE = "@abs_top_srcdir@/doc/DoxygenLayout.xml" 80 CITE_BIB_FILES = "@abs_top_srcdir@/doc/references.bib" 75 81 #--------------------------------------------------------------------------- 76 82 # configuration options related to warning and progress messages … … 91 97 "@abs_top_srcdir@/lemon/concepts" \ 92 98 "@abs_top_srcdir@/demo" \ 99 "@abs_top_srcdir@/contrib" \ 93 100 "@abs_top_srcdir@/tools" \ 94 "@abs_top_srcdir@/test/test_tools.h" 101 "@abs_top_srcdir@/test/test_tools.h" \ 102 "@abs_top_builddir@/doc/mainpage.dox" 95 103 INPUT_ENCODING = UTF-8 96 104 FILE_PATTERNS = *.h \ … … 112 120 FILTER_PATTERNS = 113 121 FILTER_SOURCE_FILES = NO 122 FILTER_SOURCE_PATTERNS = 114 123 #--------------------------------------------------------------------------- 115 124 # configuration options related to source browsing 116 125 #--------------------------------------------------------------------------- 117 SOURCE_BROWSER = NO126 SOURCE_BROWSER = @LEMON_DOC_SOURCE_BROWSER@ 118 127 INLINE_SOURCES = NO 119 128 STRIP_CODE_COMMENTS = YES … … 138 147 HTML_FOOTER = 139 148 HTML_STYLESHEET = 149 HTML_COLORSTYLE_HUE = 220 150 HTML_COLORSTYLE_SAT = 100 151 HTML_COLORSTYLE_GAMMA = 80 152 HTML_TIMESTAMP = YES 140 153 HTML_ALIGN_MEMBERS = YES 141 HTML_DYNAMIC_SECTIONS = NO154 HTML_DYNAMIC_SECTIONS = YES 142 155 GENERATE_DOCSET = NO 143 156 DOCSET_FEEDNAME = "Doxygen generated docs" 144 157 DOCSET_BUNDLE_ID = org.doxygen.Project 158 DOCSET_PUBLISHER_ID = org.doxygen.Publisher 159 DOCSET_PUBLISHER_NAME = Publisher 145 160 GENERATE_HTMLHELP = NO 146 161 CHM_FILE = … … 154 169 QHP_NAMESPACE = org.doxygen.Project 155 170 QHP_VIRTUAL_FOLDER = doc 171 QHP_CUST_FILTER_NAME = 172 QHP_CUST_FILTER_ATTRS = 173 QHP_SECT_FILTER_ATTRS = 156 174 QHG_LOCATION = 175 GENERATE_ECLIPSEHELP = NO 176 ECLIPSE_DOC_ID = org.doxygen.Project 157 177 DISABLE_INDEX = NO 158 178 ENUM_VALUES_PER_LINE = 4 159 179 GENERATE_TREEVIEW = NO 180 USE_INLINE_TREES = NO 160 181 TREEVIEW_WIDTH = 250 182 EXT_LINKS_IN_WINDOW = NO 161 183 FORMULA_FONTSIZE = 10 184 FORMULA_TRANSPARENT = YES 185 USE_MATHJAX = @LEMON_DOC_USE_MATHJAX@ 186 MATHJAX_RELPATH = @LEMON_DOC_MATHJAX_RELPATH@ 187 SEARCHENGINE = YES 188 SERVER_BASED_SEARCH = NO 162 189 #--------------------------------------------------------------------------- 163 190 # configuration options related to the LaTeX output … … 176 203 LATEX_BATCHMODE = NO 177 204 LATEX_HIDE_INDICES = NO 205 LATEX_SOURCE_CODE = NO 178 206 #--------------------------------------------------------------------------- 179 207 # configuration options related to the RTF output … … 224 252 SKIP_FUNCTION_MACROS = YES 225 253 #--------------------------------------------------------------------------- 226 # Configuration::additions related to external references 227 #--------------------------------------------------------------------------- 228 TAGFILES = "@abs_top_ srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/"254 # Configuration::additions related to external references 255 #--------------------------------------------------------------------------- 256 TAGFILES = "@abs_top_builddir@/doc/libstdc++.tag = @LEMON_DOC_LIBSTDC++_URL@" 229 257 GENERATE_TAGFILE = html/lemon.tag 230 258 ALLEXTERNALS = NO … … 238 266 HIDE_UNDOC_RELATIONS = YES 239 267 HAVE_DOT = YES 268 DOT_NUM_THREADS = 0 240 269 DOT_FONTNAME = FreeSans 241 270 DOT_FONTSIZE = 10 … … 255 284 DOT_PATH = 256 285 DOTFILE_DIRS = 286 MSCFILE_DIRS = 257 287 DOT_GRAPH_MAX_NODES = 50 258 288 MAX_DOT_GRAPH_DEPTH = 0 … … 261 291 GENERATE_LEGEND = YES 262 292 DOT_CLEANUP = YES 263 #---------------------------------------------------------------------------264 # Configuration::additions related to the search engine265 #---------------------------------------------------------------------------266 SEARCHENGINE = NO -
doc/DoxygenLayout.xml
r316 r1251 3 3 <navindex> 4 4 <tab type="mainpage" visible="yes" title=""/> 5 <tab type="modules" visible="yes" title="" />5 <tab type="modules" visible="yes" title="" intro=""/> 6 6 <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=""/> 11 11 </tab> 12 12 <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=""/> 15 15 </tab> 16 16 <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=""/> 19 19 </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="examples" visible="yes" title="" intro=""/> 21 <tab type="pages" visible="yes" title="" intro=""/> 23 22 </navindex> 24 23 -
doc/coding_style.dox
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 99 99 \subsection pri-loc-var Private member variables 100 100 101 Private member variables should start with underscore 101 Private member variables should start with underscore. 102 102 103 103 \code 104 _start_with_underscore s104 _start_with_underscore 105 105 \endcode 106 106 -
doc/dirs.dox
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 32 32 documentation. 33 33 */ 34 35 /** 36 \dir contrib 37 \brief Directory for user contributed source codes. 38 39 You can place your own C++ code using LEMON into this directory, which 40 will compile to an executable along with LEMON when you build the 41 library. This is probably the easiest way of compiling short to medium 42 codes, for this does require neither a LEMON installed system-wide nor 43 adding several paths to the compiler. 44 45 Please have a look at <tt>contrib/CMakeLists.txt</tt> for 46 instruction on how to add your own files into the build process. */ 34 47 35 48 /** -
doc/groups.dox
r606 r1280 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 113 113 detailed documentation of particular adaptors. 114 114 115 Since the adaptor classes conform to the \ref graph_concepts "graph concepts", 116 an adaptor can even be applied to another one. 117 The following image illustrates a situation when a \ref SubDigraph adaptor 118 is applied on a digraph and \ref Undirector is applied on the subgraph. 119 120 \image html adaptors2.png 121 \image latex adaptors2.eps "Using graph adaptors" width=\textwidth 122 115 123 The behavior of graph adaptors can be very different. Some of them keep 116 124 capabilities of the original graph while in other cases this would be … … 139 147 140 148 /** 141 @defgroup semi_adaptors Semi-Adaptor Classes for Graphs142 @ingroup graphs143 \brief Graph types between real graphs and graph adaptors.144 145 This group contains some graph types between real graphs and graph adaptors.146 These classes wrap graphs to give new functionality as the adaptors do it.147 On the other hand they are not light-weight structures as the adaptors.148 */149 150 /**151 149 @defgroup maps Maps 152 150 @ingroup datas … … 237 235 238 236 /** 239 @defgroup matrices Matrices240 @ingroup datas241 \brief Two dimensional data storages implemented in LEMON.242 243 This group contains two dimensional data storages implemented in LEMON.244 */245 246 /**247 237 @defgroup paths Path Structures 248 238 @ingroup datas … … 257 247 any kind of path structure. 258 248 259 \sa lemon::concepts::Path 249 \sa \ref concepts::Path "Path concept" 250 */ 251 252 /** 253 @defgroup heaps Heap Structures 254 @ingroup datas 255 \brief %Heap structures implemented in LEMON. 256 257 This group contains the heap structures implemented in LEMON. 258 259 LEMON provides several heap classes. They are efficient implementations 260 of the abstract data type \e priority \e queue. They store items with 261 specified values called \e priorities in such a way that finding and 262 removing the item with minimum priority are efficient. 263 The basic operations are adding and erasing items, changing the priority 264 of an item, etc. 265 266 Heaps are crucial in several algorithms, such as Dijkstra and Prim. 267 The heap implementations have the same interface, thus any of them can be 268 used easily in such algorithms. 269 270 \sa \ref concepts::Heap "Heap concept" 260 271 */ 261 272 … … 270 281 271 282 /** 283 @defgroup geomdat Geometric Data Structures 284 @ingroup auxdat 285 \brief Geometric data structures implemented in LEMON. 286 287 This group contains geometric data structures implemented in LEMON. 288 289 - \ref lemon::dim2::Point "dim2::Point" implements a two dimensional 290 vector with the usual operations. 291 - \ref lemon::dim2::Box "dim2::Box" can be used to determine the 292 rectangular bounding box of a set of \ref lemon::dim2::Point 293 "dim2::Point"'s. 294 */ 295 296 /** 272 297 @defgroup algs Algorithms 273 298 \brief This group contains the several algorithms … … 284 309 285 310 This group contains the common graph search algorithms, namely 286 \e breadth-first \e search (BFS) and \e depth-first \e search (DFS). 311 \e breadth-first \e search (BFS) and \e depth-first \e search (DFS) 312 \cite clrs01algorithms. 287 313 */ 288 314 … … 292 318 \brief Algorithms for finding shortest paths. 293 319 294 This group contains the algorithms for finding shortest paths in digraphs. 320 This group contains the algorithms for finding shortest paths in digraphs 321 \cite clrs01algorithms. 295 322 296 323 - \ref Dijkstra algorithm for finding shortest paths from a source node … … 300 327 but the digraph should not contain directed cycles with negative total 301 328 length. 302 - \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms303 for solving the \e all-pairs \e shortest \e paths \e problem when arc304 lenghts can be either positive or negative, but the digraph should305 not contain directed cycles with negative total length.306 329 - \ref Suurballe A successive shortest path algorithm for finding 307 330 arc-disjoint paths between two nodes having minimum total length. … … 309 332 310 333 /** 334 @defgroup spantree Minimum Spanning Tree Algorithms 335 @ingroup algs 336 \brief Algorithms for finding minimum cost spanning trees and arborescences. 337 338 This group contains the algorithms for finding minimum cost spanning 339 trees and arborescences \cite clrs01algorithms. 340 */ 341 342 /** 311 343 @defgroup max_flow Maximum Flow Algorithms 312 344 @ingroup algs … … 314 346 315 347 This group contains the algorithms for finding maximum flows and 316 feasible circulations .348 feasible circulations \cite clrs01algorithms, \cite amo93networkflows. 317 349 318 350 The \e maximum \e flow \e problem is to find a flow of maximum value between 319 351 a single source and a single target. Formally, there is a \f$G=(V,A)\f$ 320 digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and352 digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and 321 353 \f$s, t \in V\f$ source and target nodes. 322 A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the354 A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the 323 355 following optimization problem. 324 356 325 \f[ \max\sum_{a\in\delta_{out}(s)}f(a) - \sum_{a\in\delta_{in}(s)}f(a) \f] 326 \f[ \sum_{a\in\delta_{out}(v)} f(a) = \sum_{a\in\delta_{in}(v)} f(a) 327 \qquad \forall v\in V\setminus\{s,t\} \f] 328 \f[ 0 \leq f(a) \leq cap(a) \qquad \forall a\in A \f] 329 330 LEMON contains several algorithms for solving maximum flow problems: 331 - \ref EdmondsKarp Edmonds-Karp algorithm. 332 - \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm. 333 - \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees. 334 - \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees. 335 336 In most cases the \ref Preflow "Preflow" algorithm provides the 337 fastest method for computing a maximum flow. All implementations 338 provides functions to also query the minimum cut, which is the dual 339 problem of the maximum flow. 340 */ 341 342 /** 343 @defgroup min_cost_flow Minimum Cost Flow Algorithms 357 \f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f] 358 \f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu) 359 \quad \forall u\in V\setminus\{s,t\} \f] 360 \f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] 361 362 \ref Preflow is an efficient implementation of Goldberg-Tarjan's 363 preflow push-relabel algorithm \cite goldberg88newapproach for finding 364 maximum flows. It also provides functions to query the minimum cut, 365 which is the dual problem of maximum flow. 366 367 \ref Circulation is a preflow push-relabel algorithm implemented directly 368 for finding feasible circulations, which is a somewhat different problem, 369 but it is strongly related to maximum flow. 370 For more information, see \ref Circulation. 371 */ 372 373 /** 374 @defgroup min_cost_flow_algs Minimum Cost Flow Algorithms 344 375 @ingroup algs 345 376 … … 347 378 348 379 This group contains the algorithms for finding minimum cost flows and 349 circulations. 350 351 The \e minimum \e cost \e flow \e problem is to find a feasible flow of 352 minimum total cost from a set of supply nodes to a set of demand nodes 353 in a network with capacity constraints and arc costs. 354 Formally, let \f$G=(V,A)\f$ be a digraph, 355 \f$lower, upper: A\rightarrow\mathbf{Z}^+_0\f$ denote the lower and 356 upper bounds for the flow values on the arcs, 357 \f$cost: A\rightarrow\mathbf{Z}^+_0\f$ denotes the cost per unit flow 358 on the arcs, and 359 \f$supply: V\rightarrow\mathbf{Z}\f$ denotes the supply/demand values 360 of the nodes. 361 A minimum cost flow is an \f$f:A\rightarrow\mathbf{R}^+_0\f$ solution of 362 the following optimization problem. 363 364 \f[ \min\sum_{a\in A} f(a) cost(a) \f] 365 \f[ \sum_{a\in\delta_{out}(v)} f(a) - \sum_{a\in\delta_{in}(v)} f(a) = 366 supply(v) \qquad \forall v\in V \f] 367 \f[ lower(a) \leq f(a) \leq upper(a) \qquad \forall a\in A \f] 368 369 LEMON contains several algorithms for solving minimum cost flow problems: 370 - \ref CycleCanceling Cycle-canceling algorithms. 371 - \ref CapacityScaling Successive shortest path algorithm with optional 372 capacity scaling. 373 - \ref CostScaling Push-relabel and augment-relabel algorithms based on 374 cost scaling. 375 - \ref NetworkSimplex Primal network simplex algorithm with various 376 pivot strategies. 380 circulations \cite amo93networkflows. For more information about this 381 problem and its dual solution, see: \ref min_cost_flow 382 "Minimum Cost Flow Problem". 383 384 LEMON contains several algorithms for this problem. 385 - \ref NetworkSimplex Primal Network Simplex algorithm with various 386 pivot strategies \cite dantzig63linearprog, \cite kellyoneill91netsimplex. 387 - \ref CostScaling Cost Scaling algorithm based on push/augment and 388 relabel operations \cite goldberg90approximation, \cite goldberg97efficient, 389 \cite bunnagel98efficient. 390 - \ref CapacityScaling Capacity Scaling algorithm based on the successive 391 shortest path method \cite edmondskarp72theoretical. 392 - \ref CycleCanceling Cycle-Canceling algorithms, two of which are 393 strongly polynomial \cite klein67primal, \cite goldberg89cyclecanceling. 394 395 In general, \ref NetworkSimplex and \ref CostScaling are the most efficient 396 implementations. 397 \ref NetworkSimplex is usually the fastest on relatively small graphs (up to 398 several thousands of nodes) and on dense graphs, while \ref CostScaling is 399 typically more efficient on large graphs (e.g. hundreds of thousands of 400 nodes or above), especially if they are sparse. 401 However, other algorithms could be faster in special cases. 402 For example, if the total supply and/or capacities are rather small, 403 \ref CapacityScaling is usually the fastest algorithm 404 (without effective scaling). 405 406 These classes are intended to be used with integer-valued input data 407 (capacities, supply values, and costs), except for \ref CapacityScaling, 408 which is capable of handling real-valued arc costs (other numerical 409 data are required to be integer). 410 411 For more details about these implementations and for a comprehensive 412 experimental study, see the paper \cite KiralyKovacs12MCF. 413 It also compares these codes to other publicly available 414 minimum cost flow solvers. 377 415 */ 378 416 … … 392 430 393 431 \f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} 394 \sum_{uv\in A ,u\in X, v\not\in X}cap(uv) \f]432 \sum_{uv\in A: u\in X, v\not\in X}cap(uv) \f] 395 433 396 434 LEMON contains several algorithms related to minimum cut problems: … … 408 446 409 447 /** 410 @defgroup graph_prop Connectivity and Other Graph Properties 411 @ingroup algs 412 \brief Algorithms for discovering the graph properties 413 414 This group contains the algorithms for discovering the graph properties 415 like connectivity, bipartiteness, euler property, simplicity etc. 416 417 \image html edge_biconnected_components.png 418 \image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth 419 */ 420 421 /** 422 @defgroup planar Planarity Embedding and Drawing 423 @ingroup algs 424 \brief Algorithms for planarity checking, embedding and drawing 425 426 This group contains the algorithms for planarity checking, 427 embedding and drawing. 428 429 \image html planar.png 430 \image latex planar.eps "Plane graph" width=\textwidth 448 @defgroup min_mean_cycle Minimum Mean Cycle Algorithms 449 @ingroup algs 450 \brief Algorithms for finding minimum mean cycles. 451 452 This group contains the algorithms for finding minimum mean cycles 453 \cite amo93networkflows, \cite karp78characterization. 454 455 The \e minimum \e mean \e cycle \e problem is to find a directed cycle 456 of minimum mean length (cost) in a digraph. 457 The mean length of a cycle is the average length of its arcs, i.e. the 458 ratio between the total length of the cycle and the number of arcs on it. 459 460 This problem has an important connection to \e conservative \e length 461 \e functions, too. A length function on the arcs of a digraph is called 462 conservative if and only if there is no directed cycle of negative total 463 length. For an arbitrary length function, the negative of the minimum 464 cycle mean is the smallest \f$\epsilon\f$ value so that increasing the 465 arc lengths uniformly by \f$\epsilon\f$ results in a conservative length 466 function. 467 468 LEMON contains three algorithms for solving the minimum mean cycle problem: 469 - \ref KarpMmc Karp's original algorithm \cite karp78characterization. 470 - \ref HartmannOrlinMmc Hartmann-Orlin's algorithm, which is an improved 471 version of Karp's algorithm \cite hartmann93finding. 472 - \ref HowardMmc Howard's policy iteration algorithm 473 \cite dasdan98minmeancycle, \cite dasdan04experimental. 474 475 In practice, the \ref HowardMmc "Howard" algorithm turned out to be by far the 476 most efficient one, though the best known theoretical bound on its running 477 time is exponential. 478 Both \ref KarpMmc "Karp" and \ref HartmannOrlinMmc "Hartmann-Orlin" algorithms 479 run in time O(nm) and use space O(n<sup>2</sup>+m). 431 480 */ 432 481 … … 436 485 \brief Algorithms for finding matchings in graphs and bipartite graphs. 437 486 438 This group contains algorithm objects and functions to calculate487 This group contains the algorithms for calculating 439 488 matchings in graphs and bipartite graphs. The general matching problem is 440 finding a subset of the arcs which does not shares common endpoints. 489 finding a subset of the edges for which each node has at most one incident 490 edge. 441 491 442 492 There are several different algorithms for calculate matchings in … … 448 498 449 499 The matching algorithms implemented in LEMON: 450 - \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm451 for calculating maximum cardinality matching in bipartite graphs.452 - \ref PrBipartiteMatching Push-relabel algorithm453 for calculating maximum cardinality matching in bipartite graphs.454 - \ref MaxWeightedBipartiteMatching455 Successive shortest path algorithm for calculating maximum weighted456 matching and maximum weighted bipartite matching in bipartite graphs.457 - \ref MinCostMaxBipartiteMatching458 Successive shortest path algorithm for calculating minimum cost maximum459 matching in bipartite graphs.460 500 - \ref MaxMatching Edmond's blossom shrinking algorithm for calculating 461 501 maximum cardinality matching in general graphs. … … 465 505 Edmond's blossom shrinking algorithm for calculating maximum weighted 466 506 perfect matching in general graphs. 467 468 \image html bipartite_matching.png 469 \image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth 470 */ 471 472 /** 473 @defgroup spantree Minimum Spanning Tree Algorithms 474 @ingroup algs 475 \brief Algorithms for finding a minimum cost spanning tree in a graph. 476 477 This group contains the algorithms for finding a minimum cost spanning 478 tree in a graph. 507 - \ref MaxFractionalMatching Push-relabel algorithm for calculating 508 maximum cardinality fractional matching in general graphs. 509 - \ref MaxWeightedFractionalMatching Augmenting path algorithm for calculating 510 maximum weighted fractional matching in general graphs. 511 - \ref MaxWeightedPerfectFractionalMatching 512 Augmenting path algorithm for calculating maximum weighted 513 perfect fractional matching in general graphs. 514 515 \image html matching.png 516 \image latex matching.eps "Min Cost Perfect Matching" width=\textwidth 517 */ 518 519 /** 520 @defgroup graph_properties Connectivity and Other Graph Properties 521 @ingroup algs 522 \brief Algorithms for discovering the graph properties 523 524 This group contains the algorithms for discovering the graph properties 525 like connectivity, bipartiteness, euler property, simplicity etc. 526 527 \image html connected_components.png 528 \image latex connected_components.eps "Connected components" width=\textwidth 529 */ 530 531 /** 532 @defgroup planar Planar Embedding and Drawing 533 @ingroup algs 534 \brief Algorithms for planarity checking, embedding and drawing 535 536 This group contains the algorithms for planarity checking, 537 embedding and drawing. 538 539 \image html planar.png 540 \image latex planar.eps "Plane graph" width=\textwidth 541 */ 542 543 /** 544 @defgroup tsp Traveling Salesman Problem 545 @ingroup algs 546 \brief Algorithms for the symmetric traveling salesman problem 547 548 This group contains basic heuristic algorithms for the the symmetric 549 \e traveling \e salesman \e problem (TSP). 550 Given an \ref FullGraph "undirected full graph" with a cost map on its edges, 551 the problem is to find a shortest possible tour that visits each node exactly 552 once (i.e. the minimum cost Hamiltonian cycle). 553 554 These TSP algorithms are intended to be used with a \e metric \e cost 555 \e function, i.e. the edge costs should satisfy the triangle inequality. 556 Otherwise the algorithms could yield worse results. 557 558 LEMON provides five well-known heuristics for solving symmetric TSP: 559 - \ref NearestNeighborTsp Neareast neighbor algorithm 560 - \ref GreedyTsp Greedy algorithm 561 - \ref InsertionTsp Insertion heuristic (with four selection methods) 562 - \ref ChristofidesTsp Christofides algorithm 563 - \ref Opt2Tsp 2-opt algorithm 564 565 \ref NearestNeighborTsp, \ref GreedyTsp, and \ref InsertionTsp are the fastest 566 solution methods. Furthermore, \ref InsertionTsp is usually quite effective. 567 568 \ref ChristofidesTsp is somewhat slower, but it has the best guaranteed 569 approximation factor: 3/2. 570 571 \ref Opt2Tsp usually provides the best results in practice, but 572 it is the slowest method. It can also be used to improve given tours, 573 for example, the results of other algorithms. 574 575 \image html tsp.png 576 \image latex tsp.eps "Traveling salesman problem" width=\textwidth 577 */ 578 579 /** 580 @defgroup approx_algs Approximation Algorithms 581 @ingroup algs 582 \brief Approximation algorithms. 583 584 This group contains the approximation and heuristic algorithms 585 implemented in LEMON. 586 587 <b>Maximum Clique Problem</b> 588 - \ref GrossoLocatelliPullanMc An efficient heuristic algorithm of 589 Grosso, Locatelli, and Pullan. 479 590 */ 480 591 … … 486 597 This group contains some algorithms implemented in LEMON 487 598 in order to make it easier to implement complex algorithms. 488 */489 490 /**491 @defgroup approx Approximation Algorithms492 @ingroup algs493 \brief Approximation algorithms.494 495 This group contains the approximation and heuristic algorithms496 implemented in LEMON.497 599 */ 498 600 … … 507 609 508 610 /** 509 @defgroup lp_group L p and MipSolvers611 @defgroup lp_group LP and MIP Solvers 510 612 @ingroup gen_opt_group 511 \brief Lp and Mip solver interfaces for LEMON. 512 513 This group contains Lp and Mip solver interfaces for LEMON. The 514 various LP solvers could be used in the same manner with this 515 interface. 516 */ 517 518 /** 519 @defgroup lp_utils Tools for Lp and Mip Solvers 520 @ingroup lp_group 521 \brief Helper tools to the Lp and Mip solvers. 522 523 This group adds some helper tools to general optimization framework 524 implemented in LEMON. 525 */ 526 527 /** 528 @defgroup metah Metaheuristics 529 @ingroup gen_opt_group 530 \brief Metaheuristics for LEMON library. 531 532 This group contains some metaheuristic optimization tools. 613 \brief LP and MIP solver interfaces for LEMON. 614 615 This group contains LP and MIP solver interfaces for LEMON. 616 Various LP solvers could be used in the same manner with this 617 high-level interface. 618 619 The currently supported solvers are \cite glpk, \cite clp, \cite cbc, 620 \cite cplex, \cite soplex. 533 621 */ 534 622 … … 600 688 This group contains general \c EPS drawing methods and special 601 689 graph exporting tools. 602 */ 603 604 /** 605 @defgroup dimacs_group DIMACS format 690 691 \image html graph_to_eps.png 692 */ 693 694 /** 695 @defgroup dimacs_group DIMACS Format 606 696 @ingroup io_group 607 697 \brief Read and write files in DIMACS format … … 652 742 \brief Skeleton and concept checking classes for graph structures 653 743 654 This group contains the skeletons and concept checking classes of LEMON's655 graph structures and helper classes used to implement these.744 This group contains the skeletons and concept checking classes of 745 graph structures. 656 746 */ 657 747 … … 665 755 666 756 /** 757 @defgroup tools Standalone Utility Applications 758 759 Some utility applications are listed here. 760 761 The standard compilation procedure (<tt>./configure;make</tt>) will compile 762 them, as well. 763 */ 764 765 /** 667 766 \anchor demoprograms 668 767 … … 672 771 the \c demo subdirectory of the source tree. 673 772 674 It order to compile them, use <tt>--enable-demo</tt> configure option when 675 build the library. 676 */ 677 678 /** 679 @defgroup tools Standalone Utility Applications 680 681 Some utility applications are listed here. 682 683 The standard compilation procedure (<tt>./configure;make</tt>) will compile 684 them, as well. 773 In order to compile them, use the <tt>make demo</tt> or the 774 <tt>make check</tt> commands. 685 775 */ 686 776 -
doc/lgf.dox
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 64 64 \endcode 65 65 66 The \e LGF files can also contain bipartite graphs, in this case a 67 \c \@red_nodes and a \c \@blue_nodes sections describe the node set of the 68 graph. If a map is in both of these sections, then it can be used as a 69 regular node map. 70 71 \code 72 @red_nodes 73 label only_red_map name 74 1 "cherry" "John" 75 2 "Santa Claus" "Jack" 76 3 "blood" "Jason" 77 @blue_nodes 78 label name 79 4 "Elisabeth" 80 5 "Eve" 81 \endcode 82 66 83 The \c \@arcs section is very similar to the \c \@nodes section, 67 84 it again starts with a header line describing the names of the maps, … … 79 96 \endcode 80 97 98 If there is no map in the \c \@arcs section at all, then it must be 99 indicated by a sole '-' sign in the first line. 100 101 \code 102 @arcs 103 - 104 1 2 105 1 3 106 2 3 107 \endcode 108 81 109 The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can 82 110 also store the edge set of an undirected graph. In such case there is 83 111 a conventional method for store arc maps in the file, if two columns 84 ha sthe same caption with \c '+' and \c '-' prefix, then these columns112 have the same caption with \c '+' and \c '-' prefix, then these columns 85 113 can be regarded as the values of an arc map. 86 114 -
lemon/CMakeLists.txt
r596 r1315 5 5 6 6 CONFIGURE_FILE( 7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h. cmake7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in 8 8 ${CMAKE_CURRENT_BINARY_DIR}/config.h 9 ) 10 11 CONFIGURE_FILE( 12 ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in 13 ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 14 @ONLY 9 15 ) 10 16 … … 19 25 ) 20 26 21 IF( HAVE_GLPK)27 IF(LEMON_HAVE_GLPK) 22 28 SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc) 23 INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR })29 INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS}) 24 30 IF(WIN32) 25 31 INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) 26 32 INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) 27 33 INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) 28 ENDIF(WIN32) 29 ENDIF(HAVE_GLPK) 34 ENDIF() 35 ENDIF() 36 37 IF(LEMON_HAVE_CPLEX) 38 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 39 INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS}) 40 ENDIF() 41 42 IF(LEMON_HAVE_CLP) 43 SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) 44 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 45 ENDIF() 46 47 IF(LEMON_HAVE_CBC) 48 SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) 49 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 50 ENDIF() 51 52 IF(LEMON_HAVE_SOPLEX) 53 SET(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc) 54 INCLUDE_DIRECTORIES(${SOPLEX_INCLUDE_DIRS}) 55 ENDIF() 30 56 31 57 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 58 59 TARGET_LINK_LIBRARIES(lemon 60 ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES} 61 ) 62 63 IF(UNIX) 64 SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION}) 65 ENDIF() 32 66 33 67 INSTALL( 34 68 TARGETS lemon 35 69 ARCHIVE DESTINATION lib 36 COMPONENT library) 70 LIBRARY DESTINATION lib 71 COMPONENT library 72 ) 37 73 38 74 INSTALL( … … 40 76 DESTINATION include/lemon 41 77 COMPONENT headers 42 FILES_MATCHING PATTERN "*.h") 78 FILES_MATCHING PATTERN "*.h" 79 ) 80 81 INSTALL( 82 FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h 83 DESTINATION include/lemon 84 COMPONENT headers 85 ) 86 87 INSTALL( 88 FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 89 DESTINATION lib/pkgconfig 90 ) 91 -
lemon/adaptors.h
r606 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 110 110 template <typename V> 111 111 class NodeMap : public DGR::template NodeMap<V> { 112 typedef typename DGR::template NodeMap<V> Parent; 113 112 114 public: 113 114 typedef typename DGR::template NodeMap<V> Parent;115 116 115 explicit NodeMap(const Adaptor& adaptor) 117 116 : Parent(*adaptor._digraph) {} 118 119 117 NodeMap(const Adaptor& adaptor, const V& value) 120 118 : Parent(*adaptor._digraph, value) { } … … 135 133 template <typename V> 136 134 class ArcMap : public DGR::template ArcMap<V> { 135 typedef typename DGR::template ArcMap<V> Parent; 136 137 137 public: 138 139 typedef typename DGR::template ArcMap<V> Parent;140 141 138 explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor) 142 139 : Parent(*adaptor._digraph) {} 143 144 140 ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value) 145 141 : Parent(*adaptor._digraph, value) {} … … 256 252 template <typename V> 257 253 class NodeMap : public GR::template NodeMap<V> { 254 typedef typename GR::template NodeMap<V> Parent; 255 258 256 public: 259 typedef typename GR::template NodeMap<V> Parent;260 257 explicit NodeMap(const GraphAdaptorBase<GR>& adapter) 261 258 : Parent(*adapter._graph) {} … … 278 275 template <typename V> 279 276 class ArcMap : public GR::template ArcMap<V> { 277 typedef typename GR::template ArcMap<V> Parent; 278 280 279 public: 281 typedef typename GR::template ArcMap<V> Parent;282 280 explicit ArcMap(const GraphAdaptorBase<GR>& adapter) 283 281 : Parent(*adapter._graph) {} … … 299 297 template <typename V> 300 298 class EdgeMap : public GR::template EdgeMap<V> { 299 typedef typename GR::template EdgeMap<V> Parent; 300 301 301 public: 302 typedef typename GR::template EdgeMap<V> Parent;303 302 explicit EdgeMap(const GraphAdaptorBase<GR>& adapter) 304 303 : Parent(*adapter._graph) {} … … 322 321 template <typename DGR> 323 322 class ReverseDigraphBase : public DigraphAdaptorBase<DGR> { 323 typedef DigraphAdaptorBase<DGR> Parent; 324 324 public: 325 325 typedef DGR Digraph; 326 typedef DigraphAdaptorBase<DGR> Parent;327 326 protected: 328 327 ReverseDigraphBase() : Parent() { } … … 361 360 /// by adding or removing nodes or arcs, unless the \c GR template 362 361 /// parameter is set to be \c const. 362 /// 363 /// This class provides item counting in the same time as the adapted 364 /// digraph structure. 363 365 /// 364 366 /// \tparam DGR The type of the adapted digraph. … … 375 377 public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > { 376 378 #endif 379 typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent; 377 380 public: 378 381 /// The type of the adapted digraph. 379 382 typedef DGR Digraph; 380 typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;381 383 protected: 382 384 ReverseDigraph() { } … … 404 406 template <typename DGR, typename NF, typename AF, bool ch = true> 405 407 class SubDigraphBase : public DigraphAdaptorBase<DGR> { 408 typedef DigraphAdaptorBase<DGR> Parent; 406 409 public: 407 410 typedef DGR Digraph; … … 410 413 411 414 typedef SubDigraphBase Adaptor; 412 typedef DigraphAdaptorBase<DGR> Parent;413 415 protected: 414 416 NF* _node_filter; … … 420 422 Parent::initialize(digraph); 421 423 _node_filter = &node_filter; 422 _arc_filter = &arc_filter; 424 _arc_filter = &arc_filter; 423 425 } 424 426 … … 507 509 508 510 template <typename V> 509 class NodeMap 510 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 511 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 511 class NodeMap 512 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 513 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 514 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 515 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 516 512 517 public: 513 518 typedef V Value; 514 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,515 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;516 519 517 520 NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) … … 533 536 534 537 template <typename V> 535 class ArcMap 538 class ArcMap 536 539 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 537 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 540 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 541 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 542 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 543 538 544 public: 539 545 typedef V Value; 540 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,541 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;542 546 543 547 ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) … … 563 567 class SubDigraphBase<DGR, NF, AF, false> 564 568 : public DigraphAdaptorBase<DGR> { 569 typedef DigraphAdaptorBase<DGR> Parent; 565 570 public: 566 571 typedef DGR Digraph; … … 569 574 570 575 typedef SubDigraphBase Adaptor; 571 typedef DigraphAdaptorBase<Digraph> Parent;572 576 protected: 573 577 NF* _node_filter; … … 579 583 Parent::initialize(digraph); 580 584 _node_filter = &node_filter; 581 _arc_filter = &arc_filter; 585 _arc_filter = &arc_filter; 582 586 } 583 587 … … 648 652 649 653 template <typename V> 650 class NodeMap 654 class NodeMap 651 655 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 652 656 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 657 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 658 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 659 653 660 public: 654 661 typedef V Value; 655 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,656 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;657 662 658 663 NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) … … 674 679 675 680 template <typename V> 676 class ArcMap 681 class ArcMap 677 682 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 678 683 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 684 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 685 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 686 679 687 public: 680 688 typedef V Value; 681 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,682 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;683 689 684 690 ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) … … 716 722 /// by adding or removing nodes or arcs, unless the \c GR template 717 723 /// parameter is set to be \c const. 724 /// 725 /// This class provides only linear time counting for nodes and arcs. 718 726 /// 719 727 /// \tparam DGR The type of the adapted digraph. … … 864 872 template <typename GR, typename NF, typename EF, bool ch = true> 865 873 class SubGraphBase : public GraphAdaptorBase<GR> { 874 typedef GraphAdaptorBase<GR> Parent; 866 875 public: 867 876 typedef GR Graph; … … 870 879 871 880 typedef SubGraphBase Adaptor; 872 typedef GraphAdaptorBase<GR> Parent;873 881 protected: 874 882 … … 1014 1022 1015 1023 template <typename V> 1016 class NodeMap 1024 class NodeMap 1017 1025 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1018 1026 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1027 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1028 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1029 1019 1030 public: 1020 1031 typedef V Value; 1021 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1022 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;1023 1032 1024 1033 NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1040 1049 1041 1050 template <typename V> 1042 class ArcMap 1051 class ArcMap 1043 1052 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1044 1053 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1054 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1055 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1056 1045 1057 public: 1046 1058 typedef V Value; 1047 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1048 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;1049 1059 1050 1060 ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1066 1076 1067 1077 template <typename V> 1068 class EdgeMap 1078 class EdgeMap 1069 1079 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1070 1080 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1081 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1082 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1083 1071 1084 public: 1072 1085 typedef V Value; 1073 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1074 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;1075 1086 1076 1087 EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1097 1108 class SubGraphBase<GR, NF, EF, false> 1098 1109 : public GraphAdaptorBase<GR> { 1110 typedef GraphAdaptorBase<GR> Parent; 1099 1111 public: 1100 1112 typedef GR Graph; … … 1103 1115 1104 1116 typedef SubGraphBase Adaptor; 1105 typedef GraphAdaptorBase<GR> Parent;1106 1117 protected: 1107 1118 NF* _node_filter; 1108 1119 EF* _edge_filter; 1109 SubGraphBase() 1110 1120 SubGraphBase() 1121 : Parent(), _node_filter(0), _edge_filter(0) { } 1111 1122 1112 1123 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { … … 1209 1220 1210 1221 template <typename V> 1211 class NodeMap 1222 class NodeMap 1212 1223 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1213 1224 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1225 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1226 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1227 1214 1228 public: 1215 1229 typedef V Value; 1216 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1217 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;1218 1230 1219 1231 NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1235 1247 1236 1248 template <typename V> 1237 class ArcMap 1249 class ArcMap 1238 1250 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1239 1251 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1252 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1253 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1254 1240 1255 public: 1241 1256 typedef V Value; 1242 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1243 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;1244 1257 1245 1258 ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1261 1274 1262 1275 template <typename V> 1263 class EdgeMap 1276 class EdgeMap 1264 1277 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1265 1278 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1279 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1280 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1281 1266 1282 public: 1267 1283 typedef V Value; 1268 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1269 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;1270 1284 1271 1285 EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1305 1319 /// by adding or removing nodes or edges, unless the \c GR template 1306 1320 /// parameter is set to be \c const. 1321 /// 1322 /// This class provides only linear time counting for nodes, edges and arcs. 1307 1323 /// 1308 1324 /// \tparam GR The type of the adapted graph. … … 1356 1372 /// and edge filter maps. 1357 1373 SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { 1358 initialize(graph, node_filter, edge_filter);1374 this->initialize(graph, node_filter, edge_filter); 1359 1375 } 1360 1376 … … 1462 1478 /// by adding or removing nodes or arcs/edges, unless the \c GR template 1463 1479 /// parameter is set to be \c const. 1480 /// 1481 /// This class provides only linear time item counting. 1464 1482 /// 1465 1483 /// \tparam GR The type of the adapted digraph or graph. … … 1486 1504 true> > { 1487 1505 #endif 1506 typedef DigraphAdaptorExtender< 1507 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1508 true> > Parent; 1509 1488 1510 public: 1489 1511 … … 1491 1513 typedef NF NodeFilterMap; 1492 1514 1493 typedef DigraphAdaptorExtender<1494 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,1495 true> > Parent;1496 1497 1515 typedef typename Parent::Node Node; 1498 1516 … … 1508 1526 /// Creates a subgraph for the given digraph or graph with the 1509 1527 /// given node filter map. 1510 FilterNodes(GR& graph, NF& node_filter) 1528 FilterNodes(GR& graph, NF& node_filter) 1511 1529 : Parent(), const_true_map() 1512 1530 { … … 1546 1564 typename enable_if<UndirectedTagIndicator<GR> >::type> : 1547 1565 public GraphAdaptorExtender< 1548 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1566 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1549 1567 true> > { 1550 1568 1551 public: 1569 typedef GraphAdaptorExtender< 1570 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1571 true> > Parent; 1572 1573 public: 1574 1552 1575 typedef GR Graph; 1553 1576 typedef NF NodeFilterMap; 1554 typedef GraphAdaptorExtender<1555 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,1556 true> > Parent;1557 1577 1558 1578 typedef typename Parent::Node Node; 1579 1559 1580 protected: 1560 1581 ConstMap<typename GR::Edge, Const<bool, true> > const_true_map; … … 1607 1628 /// by adding or removing nodes or arcs, unless the \c GR template 1608 1629 /// parameter is set to be \c const. 1630 /// 1631 /// This class provides only linear time counting for nodes and arcs. 1609 1632 /// 1610 1633 /// \tparam DGR The type of the adapted digraph. … … 1630 1653 AF, false> > { 1631 1654 #endif 1632 public: 1655 typedef DigraphAdaptorExtender< 1656 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1657 AF, false> > Parent; 1658 1659 public: 1660 1633 1661 /// The type of the adapted digraph. 1634 1662 typedef DGR Digraph; 1635 1663 /// The type of the arc filter map. 1636 1664 typedef AF ArcFilterMap; 1637 1638 typedef DigraphAdaptorExtender<1639 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,1640 AF, false> > Parent;1641 1665 1642 1666 typedef typename Parent::Arc Arc; … … 1716 1740 /// by adding or removing nodes or edges, unless the \c GR template 1717 1741 /// parameter is set to be \c const. 1742 /// 1743 /// This class provides only linear time counting for nodes, edges and arcs. 1718 1744 /// 1719 1745 /// \tparam GR The type of the adapted graph. … … 1736 1762 class FilterEdges : 1737 1763 public GraphAdaptorExtender< 1738 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1764 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1739 1765 EF, false> > { 1740 1766 #endif 1741 public: 1767 typedef GraphAdaptorExtender< 1768 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1769 EF, false> > Parent; 1770 1771 public: 1772 1742 1773 /// The type of the adapted graph. 1743 1774 typedef GR Graph; … … 1745 1776 typedef EF EdgeFilterMap; 1746 1777 1747 typedef GraphAdaptorExtender<1748 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,1749 EF, false> > Parent;1750 1751 1778 typedef typename Parent::Edge Edge; 1752 1779 … … 1764 1791 /// Creates a subgraph for the given graph with the given edge 1765 1792 /// filter map. 1766 FilterEdges(GR& graph, EF& edge_filter) 1793 FilterEdges(GR& graph, EF& edge_filter) 1767 1794 : Parent(), const_true_map() { 1768 1795 Parent::initialize(graph, const_true_map, edge_filter); … … 1826 1853 typedef typename Digraph::Node Node; 1827 1854 1828 class Arc : public Edge{1855 class Arc { 1829 1856 friend class UndirectorBase; 1830 1857 protected: 1858 Edge _edge; 1831 1859 bool _forward; 1832 1860 1833 Arc(const Edge& edge, bool forward) :1834 Edge(edge), _forward(forward) {}1861 Arc(const Edge& edge, bool forward) 1862 : _edge(edge), _forward(forward) {} 1835 1863 1836 1864 public: 1837 1865 Arc() {} 1838 1866 1839 Arc(Invalid) : Edge(INVALID), _forward(true) {} 1867 Arc(Invalid) : _edge(INVALID), _forward(true) {} 1868 1869 operator const Edge&() const { return _edge; } 1840 1870 1841 1871 bool operator==(const Arc &other) const { 1842 return _forward == other._forward && 1843 static_cast<const Edge&>(*this) == static_cast<const Edge&>(other); 1872 return _forward == other._forward && _edge == other._edge; 1844 1873 } 1845 1874 bool operator!=(const Arc &other) const { 1846 return _forward != other._forward || 1847 static_cast<const Edge&>(*this) != static_cast<const Edge&>(other); 1875 return _forward != other._forward || _edge != other._edge; 1848 1876 } 1849 1877 bool operator<(const Arc &other) const { 1850 1878 return _forward < other._forward || 1851 (_forward == other._forward && 1852 static_cast<const Edge&>(*this) < static_cast<const Edge&>(other)); 1879 (_forward == other._forward && _edge < other._edge); 1853 1880 } 1854 1881 }; … … 1863 1890 1864 1891 void first(Arc& a) const { 1865 _digraph->first(a );1892 _digraph->first(a._edge); 1866 1893 a._forward = true; 1867 1894 } … … 1871 1898 a._forward = false; 1872 1899 } else { 1873 _digraph->next(a );1900 _digraph->next(a._edge); 1874 1901 a._forward = true; 1875 1902 } … … 1885 1912 1886 1913 void firstOut(Arc& a, const Node& n) const { 1887 _digraph->firstIn(a , n);1888 if ( static_cast<const Edge&>(a)!= INVALID ) {1914 _digraph->firstIn(a._edge, n); 1915 if (a._edge != INVALID ) { 1889 1916 a._forward = false; 1890 1917 } else { 1891 _digraph->firstOut(a , n);1918 _digraph->firstOut(a._edge, n); 1892 1919 a._forward = true; 1893 1920 } … … 1895 1922 void nextOut(Arc &a) const { 1896 1923 if (!a._forward) { 1897 Node n = _digraph->target(a );1898 _digraph->nextIn(a );1899 if ( static_cast<const Edge&>(a) == INVALID) {1900 _digraph->firstOut(a , n);1924 Node n = _digraph->target(a._edge); 1925 _digraph->nextIn(a._edge); 1926 if (a._edge == INVALID) { 1927 _digraph->firstOut(a._edge, n); 1901 1928 a._forward = true; 1902 1929 } 1903 1930 } 1904 1931 else { 1905 _digraph->nextOut(a );1932 _digraph->nextOut(a._edge); 1906 1933 } 1907 1934 } 1908 1935 1909 1936 void firstIn(Arc &a, const Node &n) const { 1910 _digraph->firstOut(a , n);1911 if ( static_cast<const Edge&>(a)!= INVALID ) {1937 _digraph->firstOut(a._edge, n); 1938 if (a._edge != INVALID ) { 1912 1939 a._forward = false; 1913 1940 } else { 1914 _digraph->firstIn(a , n);1941 _digraph->firstIn(a._edge, n); 1915 1942 a._forward = true; 1916 1943 } … … 1918 1945 void nextIn(Arc &a) const { 1919 1946 if (!a._forward) { 1920 Node n = _digraph->source(a );1921 _digraph->nextOut(a );1922 if ( static_cast<const Edge&>(a)== INVALID ) {1923 _digraph->firstIn(a , n);1947 Node n = _digraph->source(a._edge); 1948 _digraph->nextOut(a._edge); 1949 if (a._edge == INVALID ) { 1950 _digraph->firstIn(a._edge, n); 1924 1951 a._forward = true; 1925 1952 } 1926 1953 } 1927 1954 else { 1928 _digraph->nextIn(a );1955 _digraph->nextIn(a._edge); 1929 1956 } 1930 1957 } … … 1959 1986 1960 1987 Node source(const Arc &a) const { 1961 return a._forward ? _digraph->source(a ) : _digraph->target(a);1988 return a._forward ? _digraph->source(a._edge) : _digraph->target(a._edge); 1962 1989 } 1963 1990 1964 1991 Node target(const Arc &a) const { 1965 return a._forward ? _digraph->target(a ) : _digraph->source(a);1992 return a._forward ? _digraph->target(a._edge) : _digraph->source(a._edge); 1966 1993 } 1967 1994 1968 1995 static Arc direct(const Edge &e, bool d) { 1969 1996 return Arc(e, d); 1970 }1971 Arc direct(const Edge &e, const Node& n) const {1972 return Arc(e, _digraph->source(e) == n);1973 1997 } 1974 1998 … … 2075 2099 2076 2100 ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) 2077 : _forward(*adaptor._digraph, value), 2101 : _forward(*adaptor._digraph, value), 2078 2102 _backward(*adaptor._digraph, value) {} 2079 2103 … … 2112 2136 template <typename V> 2113 2137 class NodeMap : public DGR::template NodeMap<V> { 2138 typedef typename DGR::template NodeMap<V> Parent; 2139 2114 2140 public: 2115 2116 2141 typedef V Value; 2117 typedef typename DGR::template NodeMap<Value> Parent;2118 2142 2119 2143 explicit NodeMap(const UndirectorBase<DGR>& adaptor) … … 2138 2162 template <typename V> 2139 2163 class ArcMap 2140 : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > 2141 { 2164 : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > { 2165 typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent; 2166 2142 2167 public: 2143 2168 typedef V Value; 2144 typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent;2145 2169 2146 2170 explicit ArcMap(const UndirectorBase<DGR>& adaptor) … … 2164 2188 template <typename V> 2165 2189 class EdgeMap : public Digraph::template ArcMap<V> { 2190 typedef typename Digraph::template ArcMap<V> Parent; 2191 2166 2192 public: 2167 2168 2193 typedef V Value; 2169 typedef typename Digraph::template ArcMap<V> Parent;2170 2194 2171 2195 explicit EdgeMap(const UndirectorBase<DGR>& adaptor) … … 2194 2218 EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } 2195 2219 2220 typedef EdgeNotifier ArcNotifier; 2221 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); } 2222 2196 2223 protected: 2197 2224 … … 2218 2245 /// by adding or removing nodes or edges, unless the \c GR template 2219 2246 /// parameter is set to be \c const. 2247 /// 2248 /// This class provides item counting in the same time as the adapted 2249 /// digraph structure. 2220 2250 /// 2221 2251 /// \tparam DGR The type of the adapted digraph. … … 2236 2266 public GraphAdaptorExtender<UndirectorBase<DGR> > { 2237 2267 #endif 2268 typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; 2238 2269 public: 2239 2270 /// The type of the adapted digraph. 2240 2271 typedef DGR Digraph; 2241 typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;2242 2272 protected: 2243 2273 Undirector() { } … … 2248 2278 /// Creates an undirected graph from the given digraph. 2249 2279 Undirector(DGR& digraph) { 2250 initialize(digraph);2280 this->initialize(digraph); 2251 2281 } 2252 2282 … … 2447 2477 template <typename V> 2448 2478 class NodeMap : public GR::template NodeMap<V> { 2479 typedef typename GR::template NodeMap<V> Parent; 2480 2449 2481 public: 2450 2451 typedef typename GR::template NodeMap<V> Parent;2452 2482 2453 2483 explicit NodeMap(const OrienterBase<GR, DM>& adapter) … … 2472 2502 template <typename V> 2473 2503 class ArcMap : public GR::template EdgeMap<V> { 2504 typedef typename Graph::template EdgeMap<V> Parent; 2505 2474 2506 public: 2475 2476 typedef typename Graph::template EdgeMap<V> Parent;2477 2507 2478 2508 explicit ArcMap(const OrienterBase<GR, DM>& adapter) … … 2521 2551 /// by adding or removing nodes or arcs, unless the \c GR template 2522 2552 /// parameter is set to be \c const. 2553 /// 2554 /// This class provides item counting in the same time as the adapted 2555 /// graph structure. 2523 2556 /// 2524 2557 /// \tparam GR The type of the adapted graph. … … 2544 2577 public DigraphAdaptorExtender<OrienterBase<GR, DM> > { 2545 2578 #endif 2579 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; 2546 2580 public: 2547 2581 … … 2551 2585 typedef DM DirectionMap; 2552 2586 2553 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;2554 2587 typedef typename Parent::Arc Arc; 2588 2555 2589 protected: 2556 2590 Orienter() { } 2591 2557 2592 public: 2558 2593 … … 2663 2698 /// This class conforms to the \ref concepts::Digraph "Digraph" concept. 2664 2699 /// 2700 /// This class provides only linear time counting for nodes and arcs. 2701 /// 2665 2702 /// \tparam DGR The type of the adapted digraph. 2666 2703 /// It must conform to the \ref concepts::Digraph "Digraph" concept. … … 2692 2729 typename FM = CM, 2693 2730 typename TL = Tolerance<typename CM::Value> > 2694 class ResidualDigraph 2731 class ResidualDigraph 2695 2732 : public SubDigraph< 2696 2733 Undirector<const DGR>, … … 2749 2786 ResidualDigraph(const DGR& digraph, const CM& capacity, 2750 2787 FM& flow, const TL& tolerance = Tolerance()) 2751 : Parent(), _capacity(&capacity), _flow(&flow), 2788 : Parent(), _capacity(&capacity), _flow(&flow), 2752 2789 _graph(digraph), _node_filter(), 2753 2790 _forward_filter(capacity, flow, tolerance), … … 2831 2868 2832 2869 /// Constructor 2833 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2870 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2834 2871 : _adaptor(&adaptor) {} 2835 2872 … … 2864 2901 template <typename DGR> 2865 2902 class SplitNodesBase { 2903 typedef DigraphAdaptorBase<const DGR> Parent; 2904 2866 2905 public: 2867 2906 2868 2907 typedef DGR Digraph; 2869 typedef DigraphAdaptorBase<const DGR> Parent;2870 2908 typedef SplitNodesBase Adaptor; 2871 2909 … … 3226 3264 template <typename V> 3227 3265 class NodeMap 3228 : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > 3229 { 3266 : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > { 3267 typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent; 3268 3230 3269 public: 3231 3270 typedef V Value; 3232 typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent;3233 3271 3234 3272 NodeMap(const SplitNodesBase<DGR>& adaptor) … … 3252 3290 template <typename V> 3253 3291 class ArcMap 3254 : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > 3255 { 3292 : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > { 3293 typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent; 3294 3256 3295 public: 3257 3296 typedef V Value; 3258 typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent;3259 3297 3260 3298 ArcMap(const SplitNodesBase<DGR>& adaptor) … … 3309 3347 /// in the adaptor. 3310 3348 /// 3349 /// This class provides item counting in the same time as the adapted 3350 /// digraph structure. 3351 /// 3311 3352 /// \tparam DGR The type of the adapted digraph. 3312 3353 /// It must conform to the \ref concepts::Digraph "Digraph" concept. … … 3322 3363 : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > { 3323 3364 #endif 3365 typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent; 3366 3324 3367 public: 3325 3368 typedef DGR Digraph; 3326 typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;3327 3369 3328 3370 typedef typename DGR::Node DigraphNode; … … 3406 3448 /// to get a node map of the split digraph. 3407 3449 /// Its value type is inherited from the first node map type (\c IN). 3408 /// \tparam IN The type of the node map for the in-nodes. 3450 /// \tparam IN The type of the node map for the in-nodes. 3409 3451 /// \tparam OUT The type of the node map for the out-nodes. 3410 3452 template <typename IN, typename OUT> -
lemon/arg_parser.cc
r463 r956 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 21 21 namespace lemon { 22 22 23 void ArgParser::_terminate(ArgParserException::Reason reason) const 24 { 25 if(_exit_on_problems) 26 exit(1); 27 else throw(ArgParserException(reason)); 28 } 29 30 23 31 void ArgParser::_showHelp(void *p) 24 32 { 25 33 (static_cast<ArgParser*>(p))->showHelp(); 26 exit(1);34 (static_cast<ArgParser*>(p))->_terminate(ArgParserException::HELP); 27 35 } 28 36 29 37 ArgParser::ArgParser(int argc, const char * const *argv) 30 :_argc(argc), _argv(argv), _command_name(argv[0]) { 38 :_argc(argc), _argv(argv), _command_name(argv[0]), 39 _exit_on_problems(true) { 31 40 funcOption("-help","Print a short help message",_showHelp,this); 32 41 synonym("help","-help"); … … 343 352 i!=_others_help.end();++i) showHelp(i); 344 353 for(Opts::const_iterator i=_opts.begin();i!=_opts.end();++i) showHelp(i); 345 exit(1);354 _terminate(ArgParserException::HELP); 346 355 } 347 356 … … 352 361 std::cerr << "\nType '" << _command_name << 353 362 " --help' to obtain a short summary on the usage.\n\n"; 354 exit(1);363 _terminate(ArgParserException::UNKNOWN_OPT); 355 364 } 356 365 … … 415 424 std::cerr << "\nType '" << _command_name << 416 425 " --help' to obtain a short summary on the usage.\n\n"; 417 exit(1);426 _terminate(ArgParserException::INVALID_OPT); 418 427 } 419 428 } -
lemon/arg_parser.h
r463 r1327 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 27 27 #include <sstream> 28 28 #include <algorithm> 29 #include <lemon/core.h> 29 30 #include <lemon/assert.h> 30 31 … … 34 35 35 36 namespace lemon { 37 38 ///Exception used by ArgParser 39 40 ///Exception used by ArgParser. 41 /// 42 class ArgParserException : public Exception { 43 public: 44 /// Reasons for failure 45 46 /// Reasons for failure. 47 /// 48 enum Reason { 49 HELP, ///< <tt>--help</tt> option was given. 50 UNKNOWN_OPT, ///< Unknown option was given. 51 INVALID_OPT ///< Invalid combination of options. 52 }; 53 54 private: 55 Reason _reason; 56 57 public: 58 ///Constructor 59 ArgParserException(Reason r) throw() : _reason(r) {} 60 ///Virtual destructor 61 virtual ~ArgParserException() throw() {} 62 ///A short description of the exception 63 virtual const char* what() const throw() { 64 switch(_reason) 65 { 66 case HELP: 67 return "lemon::ArgParseException: ask for help"; 68 break; 69 case UNKNOWN_OPT: 70 return "lemon::ArgParseException: unknown option"; 71 break; 72 case INVALID_OPT: 73 return "lemon::ArgParseException: invalid combination of options"; 74 break; 75 } 76 return ""; 77 } 78 ///Return the reason for the failure 79 Reason reason() const {return _reason; } 80 }; 81 36 82 37 83 ///Command line arguments parser … … 116 162 const std::string &help, 117 163 void (*func)(void *),void *data); 164 165 bool _exit_on_problems; 166 167 void _terminate(ArgParserException::Reason reason) const; 118 168 119 169 public: … … 381 431 const std::vector<std::string> &files() const { return _file_args; } 382 432 433 ///Throw instead of exit in case of problems 434 void throwOnProblems() 435 { 436 _exit_on_problems=false; 437 } 383 438 }; 384 439 } -
lemon/assert.h
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 200 200 ::lemon::_assert_bits::cstringify(msg), \ 201 201 #exp), 0))) 202 # if LEMON_ENABLE_DEBUG202 # if defined LEMON_ENABLE_DEBUG 203 203 # define LEMON_DEBUG(exp, msg) \ 204 204 (static_cast<void> (!!(exp) ? 0 : ( \ -
lemon/base.cc
r554 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 22 22 #include<lemon/tolerance.h> 23 23 #include<lemon/core.h> 24 #include<lemon/time_measure.h> 24 25 namespace lemon { 25 26 … … 32 33 #endif 33 34 35 TimeStamp::Format TimeStamp::_format = TimeStamp::NORMAL; 36 34 37 } //namespace lemon -
lemon/bfs.h
r525 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 48 48 ///The type of the map that stores the predecessor 49 49 ///arcs of the shortest paths. 50 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.50 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 51 51 typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; 52 52 ///Instantiates a \c PredMap. … … 63 63 64 64 ///The type of the map that indicates which nodes are processed. 65 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 65 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 66 ///By default, it is a NullMap. 66 67 typedef NullMap<typename Digraph::Node,bool> ProcessedMap; 67 68 ///Instantiates a \c ProcessedMap. … … 82 83 83 84 ///The type of the map that indicates which nodes are reached. 84 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 85 ///It must conform to 86 ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 85 87 typedef typename Digraph::template NodeMap<bool> ReachedMap; 86 88 ///Instantiates a \c ReachedMap. … … 97 99 98 100 ///The type of the map that stores the distances of the nodes. 99 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.101 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 100 102 typedef typename Digraph::template NodeMap<int> DistMap; 101 103 ///Instantiates a \c DistMap. … … 121 123 ///\tparam GR The type of the digraph the algorithm runs on. 122 124 ///The default type is \ref ListDigraph. 125 ///\tparam TR The traits class that defines various types used by the 126 ///algorithm. By default, it is \ref BfsDefaultTraits 127 ///"BfsDefaultTraits<GR>". 128 ///In most cases, this parameter should not be set directly, 129 ///consider to use the named template parameters instead. 123 130 #ifdef DOXYGEN 124 131 template <typename GR, … … 146 153 typedef PredMapPath<Digraph, PredMap> Path; 147 154 148 ///The \ref BfsDefaultTraits "traits class" of the algorithm.155 ///The \ref lemon::BfsDefaultTraits "traits class" of the algorithm. 149 156 typedef TR Traits; 150 157 … … 226 233 ///\ref named-templ-param "Named parameter" for setting 227 234 ///\c PredMap type. 228 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.235 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 229 236 template <class T> 230 237 struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > { … … 246 253 ///\ref named-templ-param "Named parameter" for setting 247 254 ///\c DistMap type. 248 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.255 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 249 256 template <class T> 250 257 struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > { … … 266 273 ///\ref named-templ-param "Named parameter" for setting 267 274 ///\c ReachedMap type. 268 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 275 ///It must conform to 276 ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 269 277 template <class T> 270 278 struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > { … … 286 294 ///\ref named-templ-param "Named parameter" for setting 287 295 ///\c ProcessedMap type. 288 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.296 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 289 297 template <class T> 290 298 struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > { … … 414 422 ///The simplest way to execute the BFS algorithm is to use one of the 415 423 ///member functions called \ref run(Node) "run()".\n 416 ///If you need more control on the execution, firstyou have to call417 ///\ref init() , then you can add several source nodes with424 ///If you need better control on the execution, you have to call 425 ///\ref init() first, then you can add several source nodes with 418 426 ///\ref addSource(). Finally the actual path computation can be 419 427 ///performed with one of the \ref start() functions. … … 701 709 ///Runs the algorithm to visit all nodes in the digraph. 702 710 703 ///This method runs the %BFS algorithm in order to 704 ///compute the shortest path to each node. 705 /// 706 ///The algorithm computes 707 ///- the shortest path tree (forest), 708 ///- the distance of each node from the root(s). 711 ///This method runs the %BFS algorithm in order to visit all nodes 712 ///in the digraph. 709 713 /// 710 714 ///\note <tt>b.run(s)</tt> is just a shortcut of the following code. … … 738 742 ///@{ 739 743 740 ///The shortest path to anode.741 742 ///Returns the shortest path to a node.744 ///The shortest path to the given node. 745 746 ///Returns the shortest path to the given node from the root(s). 743 747 /// 744 748 ///\warning \c t should be reached from the root(s). … … 748 752 Path path(Node t) const { return Path(*G, *_pred, t); } 749 753 750 ///The distance of anode from the root(s).751 752 ///Returns the distance of anode from the root(s).754 ///The distance of the given node from the root(s). 755 756 ///Returns the distance of the given node from the root(s). 753 757 /// 754 758 ///\warning If node \c v is not reached from the root(s), then … … 759 763 int dist(Node v) const { return (*_dist)[v]; } 760 764 761 ///Returns the 'previous arc' of the shortest path tree for a node. 762 765 ///\brief Returns the 'previous arc' of the shortest path tree for 766 ///the given node. 767 /// 763 768 ///This function returns the 'previous arc' of the shortest path 764 769 ///tree for the node \c v, i.e. it returns the last arc of a … … 767 772 /// 768 773 ///The shortest path tree used here is equal to the shortest path 769 ///tree used in \ref predNode() .774 ///tree used in \ref predNode() and \ref predMap(). 770 775 /// 771 776 ///\pre Either \ref run(Node) "run()" or \ref init() … … 773 778 Arc predArc(Node v) const { return (*_pred)[v];} 774 779 775 ///Returns the 'previous node' of the shortest path tree for a node. 776 780 ///\brief Returns the 'previous node' of the shortest path tree for 781 ///the given node. 782 /// 777 783 ///This function returns the 'previous node' of the shortest path 778 784 ///tree for the node \c v, i.e. it returns the last but one node 779 /// froma shortest path from a root to \c v. It is \c INVALID785 ///of a shortest path from a root to \c v. It is \c INVALID 780 786 ///if \c v is not reached from the root(s) or if \c v is a root. 781 787 /// 782 788 ///The shortest path tree used here is equal to the shortest path 783 ///tree used in \ref predArc() .789 ///tree used in \ref predArc() and \ref predMap(). 784 790 /// 785 791 ///\pre Either \ref run(Node) "run()" or \ref init() … … 802 808 /// 803 809 ///Returns a const reference to the node map that stores the predecessor 804 ///arcs, which form the shortest path tree .810 ///arcs, which form the shortest path tree (forest). 805 811 /// 806 812 ///\pre Either \ref run(Node) "run()" or \ref init() … … 808 814 const PredMap &predMap() const { return *_pred;} 809 815 810 ///Checks if anode is reached from the root(s).816 ///Checks if the given node is reached from the root(s). 811 817 812 818 ///Returns \c true if \c v is reached from the root(s). … … 834 840 ///The type of the map that stores the predecessor 835 841 ///arcs of the shortest paths. 836 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.842 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 837 843 typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; 838 844 ///Instantiates a PredMap. … … 849 855 850 856 ///The type of the map that indicates which nodes are processed. 851 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.852 ///By default it is a NullMap.857 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 858 ///By default, it is a NullMap. 853 859 typedef NullMap<typename Digraph::Node,bool> ProcessedMap; 854 860 ///Instantiates a ProcessedMap. … … 869 875 870 876 ///The type of the map that indicates which nodes are reached. 871 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 877 ///It must conform to 878 ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 872 879 typedef typename Digraph::template NodeMap<bool> ReachedMap; 873 880 ///Instantiates a ReachedMap. … … 884 891 885 892 ///The type of the map that stores the distances of the nodes. 886 ///It must meetthe \ref concepts::WriteMap "WriteMap" concept.893 ///It must conform to the \ref concepts::WriteMap "WriteMap" concept. 887 894 typedef typename Digraph::template NodeMap<int> DistMap; 888 895 ///Instantiates a DistMap. … … 899 906 900 907 ///The type of the shortest paths. 901 ///It must meetthe \ref concepts::Path "Path" concept.908 ///It must conform to the \ref concepts::Path "Path" concept. 902 909 typedef lemon::Path<Digraph> Path; 903 910 }; … … 905 912 /// Default traits class used by BfsWizard 906 913 907 /// To make it easier to use Bfs algorithm 908 /// we have created a wizard class. 909 /// This \ref BfsWizard class needs default traits, 910 /// as well as the \ref Bfs class. 911 /// The \ref BfsWizardBase is a class to be the default traits of the 912 /// \ref BfsWizard class. 914 /// Default traits class used by BfsWizard. 915 /// \tparam GR The type of the digraph. 913 916 template<class GR> 914 917 class BfsWizardBase : public BfsWizardDefaultTraits<GR> … … 938 941 /// Constructor. 939 942 940 /// This constructor does not require parameters, thereforeit initiates943 /// This constructor does not require parameters, it initiates 941 944 /// all of the attributes to \c 0. 942 945 BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0), … … 963 966 /// This class should only be used through the \ref bfs() function, 964 967 /// which makes it easier to use the algorithm. 968 /// 969 /// \tparam TR The traits class that defines various types used by the 970 /// algorithm. 965 971 template<class TR> 966 972 class BfsWizard : public TR … … 968 974 typedef TR Base; 969 975 970 ///The type of the digraph the algorithm runs on.971 976 typedef typename TR::Digraph Digraph; 972 977 … … 976 981 typedef typename Digraph::OutArcIt OutArcIt; 977 982 978 ///\brief The type of the map that stores the predecessor979 ///arcs of the shortest paths.980 983 typedef typename TR::PredMap PredMap; 981 ///\brief The type of the map that stores the distances of the nodes.982 984 typedef typename TR::DistMap DistMap; 983 ///\brief The type of the map that indicates which nodes are reached.984 985 typedef typename TR::ReachedMap ReachedMap; 985 ///\brief The type of the map that indicates which nodes are processed.986 986 typedef typename TR::ProcessedMap ProcessedMap; 987 ///The type of the shortest paths988 987 typedef typename TR::Path Path; 989 988 … … 1055 1054 ///Runs BFS algorithm to visit all nodes in the digraph. 1056 1055 1057 ///This method runs BFS algorithm in order to compute1058 /// the shortest path to each node.1056 ///This method runs BFS algorithm in order to visit all nodes 1057 ///in the digraph. 1059 1058 void run() 1060 1059 { … … 1068 1067 SetPredMapBase(const TR &b) : TR(b) {} 1069 1068 }; 1070 ///\brief \ref named-func-param "Named parameter" 1071 ///for setting PredMap object. 1072 /// 1073 ///\ref named-func-param "Named parameter" 1074 ///for setting PredMap object. 1069 1070 ///\brief \ref named-templ-param "Named parameter" for setting 1071 ///the predecessor map. 1072 /// 1073 ///\ref named-templ-param "Named parameter" function for setting 1074 ///the map that stores the predecessor arcs of the nodes. 1075 1075 template<class T> 1076 1076 BfsWizard<SetPredMapBase<T> > predMap(const T &t) … … 1086 1086 SetReachedMapBase(const TR &b) : TR(b) {} 1087 1087 }; 1088 ///\brief \ref named-func-param "Named parameter" 1089 ///for setting ReachedMap object. 1090 /// 1091 /// \ref named-func-param "Named parameter" 1092 ///for setting ReachedMap object. 1088 1089 ///\brief \ref named-templ-param "Named parameter" for setting 1090 ///the reached map. 1091 /// 1092 ///\ref named-templ-param "Named parameter" function for setting 1093 ///the map that indicates which nodes are reached. 1093 1094 template<class T> 1094 1095 BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) … … 1104 1105 SetDistMapBase(const TR &b) : TR(b) {} 1105 1106 }; 1106 ///\brief \ref named-func-param "Named parameter" 1107 ///for setting DistMap object. 1108 /// 1109 /// \ref named-func-param "Named parameter" 1110 ///for setting DistMap object. 1107 1108 ///\brief \ref named-templ-param "Named parameter" for setting 1109 ///the distance map. 1110 /// 1111 ///\ref named-templ-param "Named parameter" function for setting 1112 ///the map that stores the distances of the nodes calculated 1113 ///by the algorithm. 1111 1114 template<class T> 1112 1115 BfsWizard<SetDistMapBase<T> > distMap(const T &t) … … 1122 1125 SetProcessedMapBase(const TR &b) : TR(b) {} 1123 1126 }; 1124 ///\brief \ref named-func-param "Named parameter" 1125 ///for setting ProcessedMap object. 1126 /// 1127 /// \ref named-func-param "Named parameter" 1128 ///for setting ProcessedMap object. 1127 1128 ///\brief \ref named-func-param "Named parameter" for setting 1129 ///the processed map. 1130 /// 1131 ///\ref named-templ-param "Named parameter" function for setting 1132 ///the map that indicates which nodes are processed. 1129 1133 template<class T> 1130 1134 BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) … … 1248 1252 } 1249 1253 _Visitor& visitor; 1254 Constraints() {} 1250 1255 }; 1251 1256 }; … … 1265 1270 /// 1266 1271 /// The type of the map that indicates which nodes are reached. 1267 /// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 1272 /// It must conform to 1273 ///the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 1268 1274 typedef typename Digraph::template NodeMap<bool> ReachedMap; 1269 1275 … … 1303 1309 /// does not observe the BFS events. If you want to observe the BFS 1304 1310 /// events, you should implement your own visitor class. 1305 /// \tparam TR T raits class to set various datatypes used by the1306 /// algorithm. The default traits class is1307 /// \ref BfsVisitDefaultTraits"BfsVisitDefaultTraits<GR>".1308 /// See \ref BfsVisitDefaultTraits for the documentation of1309 /// a BFS visit traits class.1311 /// \tparam TR The traits class that defines various types used by the 1312 /// algorithm. By default, it is \ref BfsVisitDefaultTraits 1313 /// "BfsVisitDefaultTraits<GR>". 1314 /// In most cases, this parameter should not be set directly, 1315 /// consider to use the named template parameters instead. 1310 1316 #ifdef DOXYGEN 1311 1317 template <typename GR, typename VS, typename TR> … … 1426 1432 /// The simplest way to execute the BFS algorithm is to use one of the 1427 1433 /// member functions called \ref run(Node) "run()".\n 1428 /// If you need more control on the execution, firstyou have to call1429 /// \ref init() , then you can add several source nodes with1434 /// If you need better control on the execution, you have to call 1435 /// \ref init() first, then you can add several source nodes with 1430 1436 /// \ref addSource(). Finally the actual path computation can be 1431 1437 /// performed with one of the \ref start() functions. … … 1699 1705 /// \brief Runs the algorithm to visit all nodes in the digraph. 1700 1706 /// 1701 /// This method runs the %BFS algorithm in order to 1702 /// compute the shortest path to each node. 1703 /// 1704 /// The algorithm computes 1705 /// - the shortest path tree (forest), 1706 /// - the distance of each node from the root(s). 1707 /// This method runs the %BFS algorithm in order to visit all nodes 1708 /// in the digraph. 1707 1709 /// 1708 1710 /// \note <tt>b.run(s)</tt> is just a shortcut of the following code. … … 1736 1738 ///@{ 1737 1739 1738 /// \brief Checks if anode is reached from the root(s).1740 /// \brief Checks if the given node is reached from the root(s). 1739 1741 /// 1740 1742 /// Returns \c true if \c v is reached from the root(s). -
lemon/bin_heap.h
r606 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 20 20 #define LEMON_BIN_HEAP_H 21 21 22 ///\ingroup auxdat22 ///\ingroup heaps 23 23 ///\file 24 ///\brief Binary Heap implementation.24 ///\brief Binary heap implementation. 25 25 26 26 #include <vector> … … 30 30 namespace lemon { 31 31 32 /// \ingroup auxdat32 /// \ingroup heaps 33 33 /// 34 /// \brief A Binary Heap implementation.34 /// \brief Binary heap data structure. 35 35 /// 36 ///This class implements the \e binary \e heap data structure. 37 /// 38 ///A \e heap is a data structure for storing items with specified values 39 ///called \e priorities in such a way that finding the item with minimum 40 ///priority is efficient. \c Comp specifies the ordering of the priorities. 41 ///In a heap one can change the priority of an item, add or erase an 42 ///item, etc. 36 /// This class implements the \e binary \e heap data structure. 37 /// It fully conforms to the \ref concepts::Heap "heap concept". 43 38 /// 44 ///\tparam PR Type of the priority of the items. 45 ///\tparam IM A read and writable item map with int values, used internally 46 ///to handle the cross references. 47 ///\tparam Comp A functor class for the ordering of the priorities. 48 ///The default is \c std::less<PR>. 49 /// 50 ///\sa FibHeap 51 ///\sa Dijkstra 52 template <typename PR, typename IM, typename Comp = std::less<PR> > 39 /// \tparam PR Type of the priorities of the items. 40 /// \tparam IM A read-writable item map with \c int values, used 41 /// internally to handle the cross references. 42 /// \tparam CMP A functor class for comparing the priorities. 43 /// The default is \c std::less<PR>. 44 #ifdef DOXYGEN 45 template <typename PR, typename IM, typename CMP> 46 #else 47 template <typename PR, typename IM, typename CMP = std::less<PR> > 48 #endif 53 49 class BinHeap { 54 55 50 public: 56 ///\e 51 52 /// Type of the item-int map. 57 53 typedef IM ItemIntMap; 58 /// \e54 /// Type of the priorities. 59 55 typedef PR Prio; 60 /// \e56 /// Type of the items stored in the heap. 61 57 typedef typename ItemIntMap::Key Item; 62 /// \e58 /// Type of the item-priority pairs. 63 59 typedef std::pair<Item,Prio> Pair; 64 /// \e65 typedef C ompCompare;66 67 /// \brief Type to represent the items states.68 /// 69 /// Each Item element have a state associated to it. It maybe "in heap",70 /// "pre heap" or "postheap". The latter two are indifferent from the60 /// Functor type for comparing the priorities. 61 typedef CMP Compare; 62 63 /// \brief Type to represent the states of the items. 64 /// 65 /// Each item has a state associated to it. It can be "in heap", 66 /// "pre-heap" or "post-heap". The latter two are indifferent from the 71 67 /// heap's point of view, but may be useful to the user. 72 68 /// … … 74 70 /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap. 75 71 enum State { 76 IN_HEAP = 0, ///< \e77 PRE_HEAP = -1, ///< \e78 POST_HEAP = -2 ///< \e72 IN_HEAP = 0, ///< = 0. 73 PRE_HEAP = -1, ///< = -1. 74 POST_HEAP = -2 ///< = -2. 79 75 }; 80 76 … … 85 81 86 82 public: 87 /// \brief The constructor. 88 /// 89 /// The constructor. 90 /// \param map should be given to the constructor, since it is used 91 /// internally to handle the cross references. The value of the map 92 /// must be \c PRE_HEAP (<tt>-1</tt>) for every item. 83 84 /// \brief Constructor. 85 /// 86 /// Constructor. 87 /// \param map A map that assigns \c int values to the items. 88 /// It is used internally to handle the cross references. 89 /// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item. 93 90 explicit BinHeap(ItemIntMap &map) : _iim(map) {} 94 91 95 /// \brief The constructor. 96 /// 97 /// The constructor. 98 /// \param map should be given to the constructor, since it is used 99 /// internally to handle the cross references. The value of the map 100 /// should be PRE_HEAP (-1) for each element. 101 /// 102 /// \param comp The comparator function object. 92 /// \brief Constructor. 93 /// 94 /// Constructor. 95 /// \param map A map that assigns \c int values to the items. 96 /// It is used internally to handle the cross references. 97 /// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item. 98 /// \param comp The function object used for comparing the priorities. 103 99 BinHeap(ItemIntMap &map, const Compare &comp) 104 100 : _iim(map), _comp(comp) {} 105 101 106 102 107 /// The number of items stored in the heap.108 /// 109 /// \brief Returns the number of items stored in the heap.103 /// \brief The number of items stored in the heap. 104 /// 105 /// This function returns the number of items stored in the heap. 110 106 int size() const { return _data.size(); } 111 107 112 /// \brief Check s if the heap stores no items.113 /// 114 /// Returns \c true if and only if the heap stores no items.108 /// \brief Check if the heap is empty. 109 /// 110 /// This function returns \c true if the heap is empty. 115 111 bool empty() const { return _data.empty(); } 116 112 117 /// \brief Make empty this heap. 118 /// 119 /// Make empty this heap. It does not change the cross reference map. 120 /// If you want to reuse what is not surely empty you should first clear 121 /// the heap and after that you should set the cross reference map for 122 /// each item to \c PRE_HEAP. 113 /// \brief Make the heap empty. 114 /// 115 /// This functon makes the heap empty. 116 /// It does not change the cross reference map. If you want to reuse 117 /// a heap that is not surely empty, you should first clear it and 118 /// then you should set the cross reference map to \c PRE_HEAP 119 /// for each item. 123 120 void clear() { 124 121 _data.clear(); … … 128 125 static int parent(int i) { return (i-1)/2; } 129 126 130 static int second _child(int i) { return 2*i+2; }127 static int secondChild(int i) { return 2*i+2; } 131 128 bool less(const Pair &p1, const Pair &p2) const { 132 129 return _comp(p1.second, p2.second); 133 130 } 134 131 135 int bubble _up(int hole, Pair p) {132 int bubbleUp(int hole, Pair p) { 136 133 int par = parent(hole); 137 134 while( hole>0 && less(p,_data[par]) ) { … … 144 141 } 145 142 146 int bubble _down(int hole, Pair p, int length) {147 int child = second _child(hole);143 int bubbleDown(int hole, Pair p, int length) { 144 int child = secondChild(hole); 148 145 while(child < length) { 149 146 if( less(_data[child-1], _data[child]) ) { … … 154 151 move(_data[child], hole); 155 152 hole = child; 156 child = second _child(hole);153 child = secondChild(hole); 157 154 } 158 155 child--; … … 172 169 173 170 public: 171 174 172 /// \brief Insert a pair of item and priority into the heap. 175 173 /// 176 /// Adds \c p.first to the heap with priority \c p.second. 174 /// This function inserts \c p.first to the heap with priority 175 /// \c p.second. 177 176 /// \param p The pair to insert. 177 /// \pre \c p.first must not be stored in the heap. 178 178 void push(const Pair &p) { 179 179 int n = _data.size(); 180 180 _data.resize(n+1); 181 bubble_up(n, p); 182 } 183 184 /// \brief Insert an item into the heap with the given heap. 185 /// 186 /// Adds \c i to the heap with priority \c p. 181 bubbleUp(n, p); 182 } 183 184 /// \brief Insert an item into the heap with the given priority. 185 /// 186 /// This function inserts the given item into the heap with the 187 /// given priority. 187 188 /// \param i The item to insert. 188 189 /// \param p The priority of the item. 190 /// \pre \e i must not be stored in the heap. 189 191 void push(const Item &i, const Prio &p) { push(Pair(i,p)); } 190 192 191 /// \brief Returns the item with minimum priority relative to \c Compare. 192 /// 193 /// This method returns the item with minimum priority relative to \c 194 /// Compare. 195 /// \pre The heap must be nonempty. 193 /// \brief Return the item having minimum priority. 194 /// 195 /// This function returns the item having minimum priority. 196 /// \pre The heap must be non-empty. 196 197 Item top() const { 197 198 return _data[0].first; 198 199 } 199 200 200 /// \brief Returns the minimum priority relative to \c Compare.201 /// 202 /// It returns the minimum priority relative to \c Compare.203 /// \pre The heap must be non empty.201 /// \brief The minimum priority. 202 /// 203 /// This function returns the minimum priority. 204 /// \pre The heap must be non-empty. 204 205 Prio prio() const { 205 206 return _data[0].second; 206 207 } 207 208 208 /// \brief Deletes the item with minimum priority relative to \c Compare. 209 /// 210 /// This method deletes the item with minimum priority relative to \c 211 /// Compare from the heap. 209 /// \brief Remove the item having minimum priority. 210 /// 211 /// This function removes the item having minimum priority. 212 212 /// \pre The heap must be non-empty. 213 213 void pop() { … … 215 215 _iim.set(_data[0].first, POST_HEAP); 216 216 if (n > 0) { 217 bubble _down(0, _data[n], n);217 bubbleDown(0, _data[n], n); 218 218 } 219 219 _data.pop_back(); 220 220 } 221 221 222 /// \brief Deletes \c i from the heap. 223 /// 224 /// This method deletes item \c i from the heap. 225 /// \param i The item to erase. 226 /// \pre The item should be in the heap. 222 /// \brief Remove the given item from the heap. 223 /// 224 /// This function removes the given item from the heap if it is 225 /// already stored. 226 /// \param i The item to delete. 227 /// \pre \e i must be in the heap. 227 228 void erase(const Item &i) { 228 229 int h = _iim[i]; … … 230 231 _iim.set(_data[h].first, POST_HEAP); 231 232 if( h < n ) { 232 if ( bubble _up(h, _data[n]) == h) {233 bubble _down(h, _data[n], n);233 if ( bubbleUp(h, _data[n]) == h) { 234 bubbleDown(h, _data[n], n); 234 235 } 235 236 } … … 237 238 } 238 239 239 240 /// \brief Returns the priority of \c i. 241 /// 242 /// This function returns the priority of item \c i. 243 /// \param i The item. 244 /// \pre \c i must be in the heap. 240 /// \brief The priority of the given item. 241 /// 242 /// This function returns the priority of the given item. 243 /// \param i The item. 244 /// \pre \e i must be in the heap. 245 245 Prio operator[](const Item &i) const { 246 246 int idx = _iim[i]; … … 248 248 } 249 249 250 /// \brief \c i gets to the heap with priority \c p independently 251 /// if \c i was already there. 252 /// 253 /// This method calls \ref push(\c i, \c p) if \c i is not stored 254 /// in the heap and sets the priority of \c i to \c p otherwise. 250 /// \brief Set the priority of an item or insert it, if it is 251 /// not stored in the heap. 252 /// 253 /// This method sets the priority of the given item if it is 254 /// already stored in the heap. Otherwise it inserts the given 255 /// item into the heap with the given priority. 255 256 /// \param i The item. 256 257 /// \param p The priority. … … 261 262 } 262 263 else if( _comp(p, _data[idx].second) ) { 263 bubble _up(idx, Pair(i,p));264 bubbleUp(idx, Pair(i,p)); 264 265 } 265 266 else { 266 bubble _down(idx, Pair(i,p), _data.size());267 } 268 } 269 270 /// \brief Decrease s the priority of \c i to \c p.271 /// 272 /// This method decreases the priority of item \c i to \c p.267 bubbleDown(idx, Pair(i,p), _data.size()); 268 } 269 } 270 271 /// \brief Decrease the priority of an item to the given value. 272 /// 273 /// This function decreases the priority of an item to the given value. 273 274 /// \param i The item. 274 275 /// \param p The priority. 275 /// \pre \c i must be stored in the heap with priority at least \c 276 /// p relative to \c Compare. 276 /// \pre \e i must be stored in the heap with priority at least \e p. 277 277 void decrease(const Item &i, const Prio &p) { 278 278 int idx = _iim[i]; 279 bubble _up(idx, Pair(i,p));280 } 281 282 /// \brief Increase s the priority of \c i to \c p.283 /// 284 /// This method sets the priority of item \c i to \c p.279 bubbleUp(idx, Pair(i,p)); 280 } 281 282 /// \brief Increase the priority of an item to the given value. 283 /// 284 /// This function increases the priority of an item to the given value. 285 285 /// \param i The item. 286 286 /// \param p The priority. 287 /// \pre \c i must be stored in the heap with priority at most \c 288 /// p relative to \c Compare. 287 /// \pre \e i must be stored in the heap with priority at most \e p. 289 288 void increase(const Item &i, const Prio &p) { 290 289 int idx = _iim[i]; 291 bubble _down(idx, Pair(i,p), _data.size());292 } 293 294 /// \brief Return s if \c item is in, has already been in, or has295 /// never been in the heap.296 /// 297 /// This method returns PRE_HEAP if \c item has never been in the298 /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP299 /// otherwise. In the latter case it is possible that \c item will300 /// get backto the heap again.290 bubbleDown(idx, Pair(i,p), _data.size()); 291 } 292 293 /// \brief Return the state of an item. 294 /// 295 /// This method returns \c PRE_HEAP if the given item has never 296 /// been in the heap, \c IN_HEAP if it is in the heap at the moment, 297 /// and \c POST_HEAP otherwise. 298 /// In the latter case it is possible that the item will get back 299 /// to the heap again. 301 300 /// \param i The item. 302 301 State state(const Item &i) const { … … 307 306 } 308 307 309 /// \brief Set s the state of the \citem in the heap.310 /// 311 /// Sets the state of the \c item in the heap. It can be used to312 /// manually clear the heap when it is important to achive the313 /// better time complexity.308 /// \brief Set the state of an item in the heap. 309 /// 310 /// This function sets the state of the given item in the heap. 311 /// It can be used to manually clear the heap when it is important 312 /// to achive better time complexity. 314 313 /// \param i The item. 315 314 /// \param st The state. It should not be \c IN_HEAP. … … 328 327 } 329 328 330 /// \brief Replaces an item in the heap. 331 /// 332 /// The \c i item is replaced with \c j item. The \c i item should 333 /// be in the heap, while the \c j should be out of the heap. The 334 /// \c i item will out of the heap and \c j will be in the heap 335 /// with the same prioriority as prevoiusly the \c i item. 329 /// \brief Replace an item in the heap. 330 /// 331 /// This function replaces item \c i with item \c j. 332 /// Item \c i must be in the heap, while \c j must be out of the heap. 333 /// After calling this method, item \c i will be out of the 334 /// heap and \c j will be in the heap with the same prioriority 335 /// as item \c i had before. 336 336 void replace(const Item& i, const Item& j) { 337 337 int idx = _iim[i]; -
lemon/bits/alteration_notifier.h
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 24 24 25 25 #include <lemon/core.h> 26 #include <lemon/bits/lock.h> 26 27 27 28 //\ingroup graphbits … … 252 253 typedef std::list<ObserverBase*> Observers; 253 254 Observers _observers; 254 255 lemon::bits::Lock _lock; 255 256 256 257 public: … … 333 334 334 335 void attach(ObserverBase& observer) { 336 _lock.lock(); 335 337 observer._index = _observers.insert(_observers.begin(), &observer); 336 338 observer._notifier = this; 339 _lock.unlock(); 337 340 } 338 341 339 342 void detach(ObserverBase& observer) { 343 _lock.lock(); 340 344 _observers.erase(observer._index); 341 345 observer._index = _observers.end(); 342 346 observer._notifier = 0; 347 _lock.unlock(); 343 348 } 344 349 -
lemon/bits/array_map.h
r525 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 48 48 public: 49 49 // The graph type. 50 typedef _Graph Graph ;50 typedef _Graph GraphType; 51 51 // The item type. 52 52 typedef _Item Item; … … 64 64 typedef _Value& Reference; 65 65 66 // The map type. 67 typedef ArrayMap Map; 68 66 69 // The notifier type. 67 70 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; 68 71 72 private: 73 69 74 // The MapBase of the Map which imlements the core regisitry function. 70 75 typedef typename Notifier::ObserverBase Parent; 71 76 72 private:73 77 typedef std::allocator<Value> Allocator; 74 78 … … 78 82 // 79 83 // Graph initialized map constructor. 80 explicit ArrayMap(const Graph & graph) {84 explicit ArrayMap(const GraphType& graph) { 81 85 Parent::attach(graph.notifier(Item())); 82 86 allocate_memory(); … … 92 96 // 93 97 // It constructs a map and initialize all of the the map. 94 ArrayMap(const Graph & graph, const Value& value) {98 ArrayMap(const GraphType& graph, const Value& value) { 95 99 Parent::attach(graph.notifier(Item())); 96 100 allocate_memory(); -
lemon/bits/bezier.h
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 160 160 const Point d=(a+b)/2; 161 161 const Point e=(b+c)/2; 162 const Point f=(d+e)/2;162 // const Point f=(d+e)/2; 163 163 R f1=_f(Bezier3(p1,a,d,e),_d); 164 164 R f2=_f(Bezier3(e,d,c,p4),_d); -
lemon/bits/default_map.h
r582 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 98 98 99 99 100 #if defined HAVE_LONG_LONG100 #if defined LEMON_HAVE_LONG_LONG 101 101 102 102 // long long … … 154 154 class DefaultMap 155 155 : public DefaultMapSelector<_Graph, _Item, _Value>::Map { 156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; 157 156 158 public: 157 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;158 159 typedef DefaultMap<_Graph, _Item, _Value> Map; 159 160 160 typedef typename Parent::Graph Graph;161 typedef typename Parent::GraphType GraphType; 161 162 typedef typename Parent::Value Value; 162 163 163 explicit DefaultMap(const Graph & graph) : Parent(graph) {}164 DefaultMap(const Graph & graph, const Value& value)164 explicit DefaultMap(const GraphType& graph) : Parent(graph) {} 165 DefaultMap(const GraphType& graph, const Value& value) 165 166 : Parent(graph, value) {} 166 167 -
lemon/bits/edge_set_extender.h
r606 r1270 1 /* -*- C++-*-1 /* -*- mode: C++; indent-tabs-mode: nil; -*- 2 2 * 3 * This file is a part of LEMON, a generic C++ optimization library 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 085 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 35 35 template <typename Base> 36 36 class ArcSetExtender : public Base { 37 typedef Base Parent; 38 37 39 public: 38 40 39 typedef Base Parent;40 41 typedef ArcSetExtender Digraph; 41 42 … … 63 64 Node oppositeNode(const Node &n, const Arc &e) const { 64 65 if (n == Parent::source(e)) 65 66 return Parent::target(e); 66 67 else if(n==Parent::target(e)) 67 68 return Parent::source(e); 68 69 else 69 70 return INVALID; 70 71 } 71 72 … … 91 92 // Iterable extensions 92 93 93 class NodeIt : public Node { 94 class NodeIt : public Node { 94 95 const Digraph* digraph; 95 96 public: … … 100 101 101 102 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) { 102 103 } 104 105 NodeIt(const Digraph& _graph, const Node& node) 106 107 108 NodeIt& operator++() { 109 110 return *this; 111 } 112 113 }; 114 115 116 class ArcIt : public Arc { 103 _graph.first(static_cast<Node&>(*this)); 104 } 105 106 NodeIt(const Digraph& _graph, const Node& node) 107 : Node(node), digraph(&_graph) {} 108 109 NodeIt& operator++() { 110 digraph->next(*this); 111 return *this; 112 } 113 114 }; 115 116 117 class ArcIt : public Arc { 117 118 const Digraph* digraph; 118 119 public: … … 123 124 124 125 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) { 125 126 } 127 128 ArcIt(const Digraph& _graph, const Arc& e) : 129 130 131 ArcIt& operator++() { 132 133 return *this; 134 } 135 136 }; 137 138 139 class OutArcIt : public Arc { 126 _graph.first(static_cast<Arc&>(*this)); 127 } 128 129 ArcIt(const Digraph& _graph, const Arc& e) : 130 Arc(e), digraph(&_graph) { } 131 132 ArcIt& operator++() { 133 digraph->next(*this); 134 return *this; 135 } 136 137 }; 138 139 140 class OutArcIt : public Arc { 140 141 const Digraph* digraph; 141 142 public: … … 145 146 OutArcIt(Invalid i) : Arc(i) { } 146 147 147 OutArcIt(const Digraph& _graph, const Node& node) 148 149 150 } 151 152 OutArcIt(const Digraph& _graph, const Arc& arc) 153 154 155 OutArcIt& operator++() { 156 157 return *this; 158 } 159 160 }; 161 162 163 class InArcIt : public Arc { 148 OutArcIt(const Digraph& _graph, const Node& node) 149 : digraph(&_graph) { 150 _graph.firstOut(*this, node); 151 } 152 153 OutArcIt(const Digraph& _graph, const Arc& arc) 154 : Arc(arc), digraph(&_graph) {} 155 156 OutArcIt& operator++() { 157 digraph->nextOut(*this); 158 return *this; 159 } 160 161 }; 162 163 164 class InArcIt : public Arc { 164 165 const Digraph* digraph; 165 166 public: … … 169 170 InArcIt(Invalid i) : Arc(i) { } 170 171 171 InArcIt(const Digraph& _graph, const Node& node) 172 173 174 } 175 176 InArcIt(const Digraph& _graph, const Arc& arc) : 177 178 179 InArcIt& operator++() { 180 181 return *this; 172 InArcIt(const Digraph& _graph, const Node& node) 173 : digraph(&_graph) { 174 _graph.firstIn(*this, node); 175 } 176 177 InArcIt(const Digraph& _graph, const Arc& arc) : 178 Arc(arc), digraph(&_graph) {} 179 180 InArcIt& operator++() { 181 digraph->nextIn(*this); 182 return *this; 182 183 } 183 184 … … 215 216 216 217 // Mappable extension 217 218 218 219 template <typename _Value> 219 class ArcMap 220 class ArcMap 220 221 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 221 public:222 typedef ArcSetExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 224 223 225 explicit ArcMap(const Digraph& _g) 226 : Parent(_g) {} 227 ArcMap(const Digraph& _g, const _Value& _v) 228 : Parent(_g, _v) {} 224 public: 225 explicit ArcMap(const Digraph& _g) 226 : Parent(_g) {} 227 ArcMap(const Digraph& _g, const _Value& _v) 228 : Parent(_g, _v) {} 229 229 230 230 ArcMap& operator=(const ArcMap& cmap) { 231 231 return operator=<ArcMap>(cmap); 232 232 } 233 233 … … 235 235 ArcMap& operator=(const CMap& cmap) { 236 236 Parent::operator=(cmap); 237 237 return *this; 238 238 } 239 239 … … 248 248 return arc; 249 249 } 250 250 251 251 void clear() { 252 252 notifier(Arc()).clear(); … … 275 275 template <typename Base> 276 276 class EdgeSetExtender : public Base { 277 typedef Base Parent; 277 278 278 279 public: 279 280 280 typedef Base Parent; 281 typedef EdgeSetExtender Digraph; 281 typedef EdgeSetExtender Graph; 282 283 typedef True UndirectedTag; 282 284 283 285 typedef typename Parent::Node Node; … … 285 287 typedef typename Parent::Edge Edge; 286 288 287 288 289 int maxId(Node) const { 289 290 return Parent::maxNodeId(); … … 312 313 Node oppositeNode(const Node &n, const Edge &e) const { 313 314 if( n == Parent::u(e)) 314 315 return Parent::v(e); 315 316 else if( n == Parent::v(e)) 316 317 return Parent::u(e); 317 318 else 318 319 return INVALID; 319 320 } 320 321 … … 340 341 341 342 using Parent::notifier; 342 343 343 344 ArcNotifier& notifier(Arc) const { 344 345 return arc_notifier; … … 350 351 351 352 352 class NodeIt : public Node { 353 const Digraph* digraph;353 class NodeIt : public Node { 354 const Graph* graph; 354 355 public: 355 356 … … 358 359 NodeIt(Invalid i) : Node(i) { } 359 360 360 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {361 362 } 363 364 NodeIt(const Digraph& _graph, const Node& node)365 : Node(node), digraph(&_graph) {}366 367 NodeIt& operator++() { 368 digraph->next(*this);369 return *this; 370 } 371 372 }; 373 374 375 class ArcIt : public Arc { 376 const Digraph* digraph;361 explicit NodeIt(const Graph& _graph) : graph(&_graph) { 362 _graph.first(static_cast<Node&>(*this)); 363 } 364 365 NodeIt(const Graph& _graph, const Node& node) 366 : Node(node), graph(&_graph) {} 367 368 NodeIt& operator++() { 369 graph->next(*this); 370 return *this; 371 } 372 373 }; 374 375 376 class ArcIt : public Arc { 377 const Graph* graph; 377 378 public: 378 379 … … 381 382 ArcIt(Invalid i) : Arc(i) { } 382 383 383 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {384 385 } 386 387 ArcIt(const Digraph& _graph, const Arc& e) :388 Arc(e), digraph(&_graph) { }389 390 ArcIt& operator++() { 391 digraph->next(*this);392 return *this; 393 } 394 395 }; 396 397 398 class OutArcIt : public Arc { 399 const Digraph* digraph;384 explicit ArcIt(const Graph& _graph) : graph(&_graph) { 385 _graph.first(static_cast<Arc&>(*this)); 386 } 387 388 ArcIt(const Graph& _graph, const Arc& e) : 389 Arc(e), graph(&_graph) { } 390 391 ArcIt& operator++() { 392 graph->next(*this); 393 return *this; 394 } 395 396 }; 397 398 399 class OutArcIt : public Arc { 400 const Graph* graph; 400 401 public: 401 402 … … 404 405 OutArcIt(Invalid i) : Arc(i) { } 405 406 406 OutArcIt(const Digraph& _graph, const Node& node)407 : digraph(&_graph) {408 409 } 410 411 OutArcIt(const Digraph& _graph, const Arc& arc)412 : Arc(arc), digraph(&_graph) {}413 414 OutArcIt& operator++() { 415 digraph->nextOut(*this);416 return *this; 417 } 418 419 }; 420 421 422 class InArcIt : public Arc { 423 const Digraph* digraph;407 OutArcIt(const Graph& _graph, const Node& node) 408 : graph(&_graph) { 409 _graph.firstOut(*this, node); 410 } 411 412 OutArcIt(const Graph& _graph, const Arc& arc) 413 : Arc(arc), graph(&_graph) {} 414 415 OutArcIt& operator++() { 416 graph->nextOut(*this); 417 return *this; 418 } 419 420 }; 421 422 423 class InArcIt : public Arc { 424 const Graph* graph; 424 425 public: 425 426 … … 428 429 InArcIt(Invalid i) : Arc(i) { } 429 430 430 InArcIt(const Digraph& _graph, const Node& node)431 : digraph(&_graph) {432 433 } 434 435 InArcIt(const Digraph& _graph, const Arc& arc) :436 Arc(arc), digraph(&_graph) {}437 438 InArcIt& operator++() { 439 digraph->nextIn(*this);440 return *this; 441 } 442 443 }; 444 445 446 class EdgeIt : public Parent::Edge { 447 const Digraph* digraph;431 InArcIt(const Graph& _graph, const Node& node) 432 : graph(&_graph) { 433 _graph.firstIn(*this, node); 434 } 435 436 InArcIt(const Graph& _graph, const Arc& arc) : 437 Arc(arc), graph(&_graph) {} 438 439 InArcIt& operator++() { 440 graph->nextIn(*this); 441 return *this; 442 } 443 444 }; 445 446 447 class EdgeIt : public Parent::Edge { 448 const Graph* graph; 448 449 public: 449 450 … … 452 453 EdgeIt(Invalid i) : Edge(i) { } 453 454 454 explicit EdgeIt(const Digraph& _graph) : digraph(&_graph) {455 456 } 457 458 EdgeIt(const Digraph& _graph, const Edge& e) :459 Edge(e), digraph(&_graph) { }460 461 EdgeIt& operator++() { 462 digraph->next(*this);463 return *this; 455 explicit EdgeIt(const Graph& _graph) : graph(&_graph) { 456 _graph.first(static_cast<Edge&>(*this)); 457 } 458 459 EdgeIt(const Graph& _graph, const Edge& e) : 460 Edge(e), graph(&_graph) { } 461 462 EdgeIt& operator++() { 463 graph->next(*this); 464 return *this; 464 465 } 465 466 … … 468 469 class IncEdgeIt : public Parent::Edge { 469 470 friend class EdgeSetExtender; 470 const Digraph* digraph;471 const Graph* graph; 471 472 bool direction; 472 473 public: … … 476 477 IncEdgeIt(Invalid i) : Edge(i), direction(false) { } 477 478 478 IncEdgeIt(const Digraph& _graph, const Node &n) : digraph(&_graph) {479 480 } 481 482 IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n)483 : digraph(&_graph), Edge(ue) {484 479 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { 480 _graph.firstInc(*this, direction, n); 481 } 482 483 IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) 484 : graph(&_graph), Edge(ue) { 485 direction = (_graph.source(ue) == n); 485 486 } 486 487 487 488 IncEdgeIt& operator++() { 488 digraph->nextInc(*this, direction);489 return *this; 489 graph->nextInc(*this, direction); 490 return *this; 490 491 } 491 492 }; … … 523 524 // Returns the base node of the iterator 524 525 Node baseNode(const IncEdgeIt &e) const { 525 return e.direction ? u(e) :v(e);526 return e.direction ? this->u(e) : this->v(e); 526 527 } 527 528 // Running node of the iterator … … 529 530 // Returns the running node of the iterator 530 531 Node runningNode(const IncEdgeIt &e) const { 531 return e.direction ? v(e) :u(e);532 return e.direction ? this->v(e) : this->u(e); 532 533 } 533 534 534 535 535 536 template <typename _Value> 536 class ArcMap 537 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 538 public: 539 typedef EdgeSetExtender Digraph; 540 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 541 542 ArcMap(const Digraph& _g) 543 : Parent(_g) {} 544 ArcMap(const Digraph& _g, const _Value& _v) 545 : Parent(_g, _v) {} 537 class ArcMap 538 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 539 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 540 541 public: 542 explicit ArcMap(const Graph& _g) 543 : Parent(_g) {} 544 ArcMap(const Graph& _g, const _Value& _v) 545 : Parent(_g, _v) {} 546 546 547 547 ArcMap& operator=(const ArcMap& cmap) { 548 548 return operator=<ArcMap>(cmap); 549 549 } 550 550 … … 552 552 ArcMap& operator=(const CMap& cmap) { 553 553 Parent::operator=(cmap); 554 554 return *this; 555 555 } 556 556 … … 559 559 560 560 template <typename _Value> 561 class EdgeMap 562 : public MapExtender<DefaultMap<Digraph, Edge, _Value> > { 563 public: 564 typedef EdgeSetExtender Digraph; 565 typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent; 566 567 EdgeMap(const Digraph& _g) 568 : Parent(_g) {} 569 570 EdgeMap(const Digraph& _g, const _Value& _v) 571 : Parent(_g, _v) {} 561 class EdgeMap 562 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 563 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 564 565 public: 566 explicit EdgeMap(const Graph& _g) 567 : Parent(_g) {} 568 569 EdgeMap(const Graph& _g, const _Value& _v) 570 : Parent(_g, _v) {} 572 571 573 572 EdgeMap& operator=(const EdgeMap& cmap) { 574 573 return operator=<EdgeMap>(cmap); 575 574 } 576 575 … … 578 577 EdgeMap& operator=(const CMap& cmap) { 579 578 Parent::operator=(cmap); 580 579 return *this; 581 580 } 582 581 … … 595 594 return edge; 596 595 } 597 596 598 597 void clear() { 599 598 notifier(Arc()).clear(); … … 621 620 arc_notifier.clear(); 622 621 } 623 622 624 623 }; 625 624 -
lemon/bits/graph_adaptor_extender.h
r478 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 23 23 #include <lemon/error.h> 24 24 25 #include <lemon/bits/default_map.h>26 27 25 namespace lemon { 28 26 29 27 template <typename _Digraph> 30 28 class DigraphAdaptorExtender : public _Digraph { 29 typedef _Digraph Parent; 30 31 31 public: 32 32 33 typedef _Digraph Parent;34 33 typedef _Digraph Digraph; 35 34 typedef DigraphAdaptorExtender Adaptor; … … 176 175 template <typename _Graph> 177 176 class GraphAdaptorExtender : public _Graph { 177 typedef _Graph Parent; 178 178 179 public: 179 180 180 typedef _Graph Parent;181 181 typedef _Graph Graph; 182 182 typedef GraphAdaptorExtender Adaptor; 183 184 typedef True UndirectedTag; 183 185 184 186 typedef typename Parent::Node Node; -
lemon/bits/graph_extender.h
r463 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 38 38 template <typename Base> 39 39 class DigraphExtender : public Base { 40 typedef Base Parent; 41 40 42 public: 41 43 42 typedef Base Parent;43 44 typedef DigraphExtender Digraph; 44 45 … … 56 57 } 57 58 58 Node fromId(int id, Node) const{59 static Node fromId(int id, Node) { 59 60 return Parent::nodeFromId(id); 60 61 } 61 62 62 Arc fromId(int id, Arc) const{63 static Arc fromId(int id, Arc) { 63 64 return Parent::arcFromId(id); 64 65 } … … 219 220 class NodeMap 220 221 : public MapExtender<DefaultMap<Digraph, Node, _Value> > { 221 public:222 typedef DigraphExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent; 224 223 224 public: 225 225 explicit NodeMap(const Digraph& digraph) 226 226 : Parent(digraph) {} … … 244 244 class ArcMap 245 245 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 246 public:247 typedef DigraphExtender Digraph;248 246 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 249 247 248 public: 250 249 explicit ArcMap(const Digraph& digraph) 251 250 : Parent(digraph) {} … … 331 330 template <typename Base> 332 331 class GraphExtender : public Base { 332 typedef Base Parent; 333 333 334 public: 334 335 335 typedef Base Parent;336 336 typedef GraphExtender Graph; 337 337 … … 356 356 } 357 357 358 Node fromId(int id, Node) const{358 static Node fromId(int id, Node) { 359 359 return Parent::nodeFromId(id); 360 360 } 361 361 362 Arc fromId(int id, Arc) const{362 static Arc fromId(int id, Arc) { 363 363 return Parent::arcFromId(id); 364 364 } 365 365 366 Edge fromId(int id, Edge) const{366 static Edge fromId(int id, Edge) { 367 367 return Parent::edgeFromId(id); 368 368 } … … 588 588 // Returns the base node of the iterator 589 589 Node baseNode(const IncEdgeIt &edge) const { 590 return edge._direction ? u(edge) :v(edge);590 return edge._direction ? this->u(edge) : this->v(edge); 591 591 } 592 592 // Running node of the iterator … … 594 594 // Returns the running node of the iterator 595 595 Node runningNode(const IncEdgeIt &edge) const { 596 return edge._direction ? v(edge) :u(edge);596 return edge._direction ? this->v(edge) : this->u(edge); 597 597 } 598 598 … … 602 602 class NodeMap 603 603 : public MapExtender<DefaultMap<Graph, Node, _Value> > { 604 public:605 typedef GraphExtender Graph;606 604 typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent; 607 605 608 NodeMap(const Graph& graph) 606 public: 607 explicit NodeMap(const Graph& graph) 609 608 : Parent(graph) {} 610 609 NodeMap(const Graph& graph, const _Value& value) … … 627 626 class ArcMap 628 627 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 629 public:630 typedef GraphExtender Graph;631 628 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 632 629 633 ArcMap(const Graph& graph) 630 public: 631 explicit ArcMap(const Graph& graph) 634 632 : Parent(graph) {} 635 633 ArcMap(const Graph& graph, const _Value& value) … … 652 650 class EdgeMap 653 651 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 654 public:655 typedef GraphExtender Graph;656 652 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 657 653 658 EdgeMap(const Graph& graph) 654 public: 655 explicit EdgeMap(const Graph& graph) 659 656 : Parent(graph) {} 660 657 … … 750 747 }; 751 748 749 // \ingroup _graphbits 750 // 751 // \brief Extender for the BpGraphs 752 template <typename Base> 753 class BpGraphExtender : public Base { 754 typedef Base Parent; 755 756 public: 757 758 typedef BpGraphExtender BpGraph; 759 760 typedef True UndirectedTag; 761 762 typedef typename Parent::Node Node; 763 typedef typename Parent::RedNode RedNode; 764 typedef typename Parent::BlueNode BlueNode; 765 typedef typename Parent::Arc Arc; 766 typedef typename Parent::Edge Edge; 767 768 // BpGraph extension 769 770 using Parent::first; 771 using Parent::next; 772 using Parent::id;