Changes in / [1386:ad22262328b3:1390:f0f15d07bf51] in lemon
- Files:
-
- 1 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r1264 r1344 1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 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) 2 11 3 12 SET(PROJECT_NAME "LEMON") … … 62 71 FIND_PACKAGE(Doxygen) 63 72 FIND_PACKAGE(Ghostscript) 73 74 IF(WIN32) 75 SET(LEMON_WIN32 TRUE) 76 ENDIF(WIN32) 64 77 65 78 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.") … … 122 135 SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING 123 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)") 124 140 ENDIF() 125 141 IF(NOT LEMON_DEFAULT_MIP OR … … 129 145 SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING 130 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)") 131 150 ENDIF() 132 151 … … 141 160 ELSEIF(MSVC) 142 161 # This part is unnecessary 'casue the same is set by the lemon/core.h. 143 # Still keep it as an example. 144 SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") 162 # Still kept as an example. 163 164 # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996") 165 145 166 # Suppressed warnings: 146 167 # C4250: 'class1' : inherits 'class2::member' via dominance 168 # C4267: conversion from 'size_t' to 'type', possible loss of data 147 169 # C4355: 'this' : used in base member initializer list 148 170 # C4503: 'function' : decorated name length exceeded, name was truncated … … 159 181 160 182 IF(MSVC) 183 SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}") 161 184 SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING 162 185 "Flags used by the C++ compiler during maintainer builds." … … 181 204 ) 182 205 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER 183 " -Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING206 "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING 184 207 "Flags used for linking binaries during maintainer builds." 185 208 ) 186 209 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 187 " -Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING210 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING 188 211 "Flags used by the shared libraries linker during maintainer builds." 189 212 ) -
NEWS
r962 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 1 114 2010-03-19 Version 1.2 released 2 115 -
cmake/FindILOG.cmake
r1232 r1331 63 63 ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic 64 64 ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic 65 ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic 66 ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic 65 67 ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda 66 68 NO_DEFAULT_PATH … … 73 75 ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic 74 76 ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic 77 ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic 78 ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic 75 79 ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda 76 80 NO_DEFAULT_PATH -
doc/groups.dox
r1271 r1280 295 295 296 296 /** 297 @defgroup matrices Matrices298 @ingroup auxdat299 \brief Two dimensional data storages implemented in LEMON.300 301 This group contains two dimensional data storages implemented in LEMON.302 */303 304 /**305 297 @defgroup algs Algorithms 306 298 \brief This group contains the several algorithms … … 335 327 but the digraph should not contain directed cycles with negative total 336 328 length. 337 - \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms338 for solving the \e all-pairs \e shortest \e paths \e problem when arc339 lenghts can be either positive or negative, but the digraph should340 not contain directed cycles with negative total length.341 329 - \ref Suurballe A successive shortest path algorithm for finding 342 330 arc-disjoint paths between two nodes having minimum total length. … … 372 360 \f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] 373 361 374 LEMON contains several algorithms for solving maximum flow problems: 375 - \ref EdmondsKarp Edmonds-Karp algorithm 376 \cite edmondskarp72theoretical. 377 - \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm 378 \cite goldberg88newapproach. 379 - \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees 380 \cite dinic70algorithm, \cite sleator83dynamic. 381 - \ref GoldbergTarjan !Preflow push-relabel algorithm with dynamic trees 382 \cite goldberg88newapproach, \cite sleator83dynamic. 383 384 In most cases the \ref Preflow algorithm provides the 385 fastest method for computing a maximum flow. All implementations 386 also provide functions to query the minimum cut, which is the dual 387 problem of maximum flow. 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. 388 366 389 367 \ref Circulation is a preflow push-relabel algorithm implemented directly … … 520 498 521 499 The matching algorithms implemented in LEMON: 522 - \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm523 for calculating maximum cardinality matching in bipartite graphs.524 - \ref PrBipartiteMatching Push-relabel algorithm525 for calculating maximum cardinality matching in bipartite graphs.526 - \ref MaxWeightedBipartiteMatching527 Successive shortest path algorithm for calculating maximum weighted528 matching and maximum weighted bipartite matching in bipartite graphs.529 - \ref MinCostMaxBipartiteMatching530 Successive shortest path algorithm for calculating minimum cost maximum531 matching in bipartite graphs.532 500 - \ref MaxMatching Edmond's blossom shrinking algorithm for calculating 533 501 maximum cardinality matching in general graphs. … … 654 622 655 623 /** 656 @defgroup lp_utils Tools for Lp and Mip Solvers657 @ingroup lp_group658 \brief Helper tools to the Lp and Mip solvers.659 660 This group adds some helper tools to general optimization framework661 implemented in LEMON.662 */663 664 /**665 @defgroup metah Metaheuristics666 @ingroup gen_opt_group667 \brief Metaheuristics for LEMON library.668 669 This group contains some metaheuristic optimization tools.670 */671 672 /**673 624 @defgroup utils Tools and Utilities 674 625 \brief Tools and utilities for programming in LEMON -
lemon/CMakeLists.txt
r1264 r1315 56 56 57 57 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 58 59 TARGET_LINK_LIBRARIES(lemon 60 ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES} 61 ) 62 58 63 IF(UNIX) 59 SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon )64 SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION}) 60 65 ENDIF() 61 66 -
lemon/arg_parser.h
r959 r1327 27 27 #include <sstream> 28 28 #include <algorithm> 29 #include <lemon/core.h> 29 30 #include <lemon/assert.h> 30 31 -
lemon/bits/windows.cc
r1270 r1341 22 22 #include<lemon/bits/windows.h> 23 23 24 #ifdef WIN32 24 #if defined(LEMON_WIN32) && defined(__GNUC__) 25 #pragma GCC diagnostic ignored "-Wold-style-cast" 26 #endif 27 28 #ifdef LEMON_WIN32 25 29 #ifndef WIN32_LEAN_AND_MEAN 26 30 #define WIN32_LEAN_AND_MEAN … … 41 45 #include <unistd.h> 42 46 #include <ctime> 43 #ifndef WIN3247 #ifndef LEMON_WIN32 44 48 #include <sys/times.h> 45 49 #endif … … 56 60 double &cutime, double &cstime) 57 61 { 58 #ifdef WIN3262 #ifdef LEMON_WIN32 59 63 static const double ch = 4294967296.0e-7; 60 64 static const double cl = 1.0e-7; … … 95 99 { 96 100 std::ostringstream os; 97 #ifdef WIN32101 #ifdef LEMON_WIN32 98 102 SYSTEMTIME time; 99 103 GetSystemTime(&time); 100 104 char buf1[11], buf2[9], buf3[5]; 101 105 if (GetDateFormat(MY_LOCALE, 0, &time, 102 106 ("ddd MMM dd"), buf1, 11) && 103 107 GetTimeFormat(MY_LOCALE, 0, &time, … … 121 125 int getWinRndSeed() 122 126 { 123 #ifdef WIN32127 #ifdef LEMON_WIN32 124 128 FILETIME time; 125 129 GetSystemTimeAsFileTime(&time); … … 133 137 134 138 WinLock::WinLock() { 135 #ifdef WIN32139 #ifdef LEMON_WIN32 136 140 CRITICAL_SECTION *lock = new CRITICAL_SECTION; 137 141 InitializeCriticalSection(lock); … … 143 147 144 148 WinLock::~WinLock() { 145 #ifdef WIN32149 #ifdef LEMON_WIN32 146 150 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 147 151 DeleteCriticalSection(lock); … … 151 155 152 156 void WinLock::lock() { 153 #ifdef WIN32157 #ifdef LEMON_WIN32 154 158 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 155 159 EnterCriticalSection(lock); … … 158 162 159 163 void WinLock::unlock() { 160 #ifdef WIN32164 #ifdef LEMON_WIN32 161 165 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 162 166 LeaveCriticalSection(lock); -
lemon/bits/windows.h
r1270 r1340 20 20 #define LEMON_BITS_WINDOWS_H 21 21 22 #include <lemon/config.h> 22 23 #include <string> 23 24 … … 35 36 ~WinLock(); 36 37 void lock(); 37 void unlock(); 38 void unlock();\ 38 39 private: 39 40 void *_repr; -
lemon/capacity_scaling.h
r1270 r1363 28 28 #include <limits> 29 29 #include <lemon/core.h> 30 #include <lemon/maps.h> 30 31 #include <lemon/bin_heap.h> 31 32 … … 164 165 165 166 // Parameters of the problem 166 bool _ha ve_lower;167 bool _has_lower; 167 168 Value _sum_supply; 168 169 … … 357 358 template <typename LowerMap> 358 359 CapacityScaling& lowerMap(const LowerMap& map) { 359 _ha ve_lower = true;360 _has_lower = true; 360 361 for (ArcIt a(_graph); a != INVALID; ++a) { 361 362 _lower[_arc_idf[a]] = map[a]; 362 _lower[_arc_idb[a]] = map[a];363 363 } 364 364 return *this; … … 544 544 _cost[j] = _forward[j] ? 1 : -1; 545 545 } 546 _ha ve_lower = false;546 _has_lower = false; 547 547 return *this; 548 548 } … … 755 755 const Value MAX = std::numeric_limits<Value>::max(); 756 756 int last_out; 757 if (_ha ve_lower) {757 if (_has_lower) { 758 758 for (int i = 0; i != _root; ++i) { 759 759 last_out = _first_out[i+1]; … … 840 840 } 841 841 842 // Check if the upper bound is greater or equal to the lower bound843 // on each arc.842 // Check if the upper bound is greater than or equal to the lower bound 843 // on each forward arc. 844 844 bool checkBoundMaps() { 845 845 for (int j = 0; j != _res_arc_num; ++j) { 846 if (_ upper[j] < _lower[j]) return false;846 if (_forward[j] && _upper[j] < _lower[j]) return false; 847 847 } 848 848 return true; … … 858 858 859 859 // Handle non-zero lower bounds 860 if (_ha ve_lower) {860 if (_has_lower) { 861 861 int limit = _first_out[_root]; 862 862 for (int j = 0; j != limit; ++j) { 863 if ( !_forward[j]) _res_cap[j] += _lower[j];863 if (_forward[j]) _res_cap[_reverse[j]] += _lower[j]; 864 864 } 865 865 } -
lemon/config.h.in
r1264 r1340 1 #ifndef LEMON_CONFIG_H 2 #define LEMON_CONFIG_H 3 1 4 #define LEMON_VERSION "@PROJECT_VERSION@" 2 5 #cmakedefine LEMON_HAVE_LONG_LONG 1 6 7 #cmakedefine LEMON_WIN32 1 8 3 9 #cmakedefine LEMON_HAVE_LP 1 4 10 #cmakedefine LEMON_HAVE_MIP 1 … … 8 14 #cmakedefine LEMON_HAVE_CLP 1 9 15 #cmakedefine LEMON_HAVE_CBC 1 10 #cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@ 11 #cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@ 16 17 #define LEMON_CPLEX_ 1 18 #define LEMON_CLP_ 2 19 #define LEMON_GLPK_ 3 20 #define LEMON_SOPLEX_ 4 21 #define LEMON_CBC_ 5 22 23 #cmakedefine LEMON_DEFAULT_LP LEMON_@LEMON_DEFAULT_LP@_ 24 #cmakedefine LEMON_DEFAULT_MIP LEMON_@LEMON_DEFAULT_MIP@_ 25 12 26 #cmakedefine LEMON_USE_PTHREAD 1 13 27 #cmakedefine LEMON_USE_WIN32_THREADS 1 28 29 #endif -
lemon/core.h
r1270 r1341 20 20 #define LEMON_CORE_H 21 21 22 #include <vector>23 #include <algorithm>24 25 #include <lemon/config.h>26 #include <lemon/bits/enable_if.h>27 #include <lemon/bits/traits.h>28 #include <lemon/assert.h>29 30 // Disable the following warnings when compiling with MSVC:31 // C4250: 'class1' : inherits 'class2::member' via dominance32 // C4355: 'this' : used in base member initializer list33 // C4503: 'function' : decorated name length exceeded, name was truncated34 // C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)35 // C4996: 'function': was declared deprecated36 #ifdef _MSC_VER37 #pragma warning( disable : 4250 4355 4503 4800 4996 )38 #endif39 40 #ifdef __GNUC__41 #define GCC_VERSION (__GNUC__ * 10000 \42 + __GNUC_MINOR__ * 100 \43 + __GNUC_PATCHLEVEL__)44 #endif45 46 #if GCC_VERSION >= 4080047 // Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.848 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"49 #endif50 51 22 ///\file 52 23 ///\brief LEMON core utilities. … … 55 26 ///It is automatically included by all graph types, therefore it usually 56 27 ///do not have to be included directly. 28 29 // Disable the following warnings when compiling with MSVC: 30 // C4250: 'class1' : inherits 'class2::member' via dominance 31 // C4267: conversion from 'size_t' to 'type', possible loss of data 32 // C4355: 'this' : used in base member initializer list 33 // C4503: 'function' : decorated name length exceeded, name was truncated 34 // C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) 35 // C4996: 'function': was declared deprecated 36 #ifdef _MSC_VER 37 #pragma warning( disable : 4250 4267 4355 4503 4800 4996 ) 38 #endif 39 40 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) 41 // Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8 42 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 43 #endif 44 45 #include <vector> 46 #include <algorithm> 47 48 #include <lemon/config.h> 49 #include <lemon/bits/enable_if.h> 50 #include <lemon/bits/traits.h> 51 #include <lemon/assert.h> 52 53 57 54 58 55 namespace lemon { -
lemon/cost_scaling.h
r1271 r1298 257 257 258 258 // Parameters of the problem 259 bool _ha ve_lower;259 bool _has_lower; 260 260 Value _sum_supply; 261 261 int _sup_node_num; … … 373 373 template <typename LowerMap> 374 374 CostScaling& lowerMap(const LowerMap& map) { 375 _ha ve_lower = true;375 _has_lower = true; 376 376 for (ArcIt a(_graph); a != INVALID; ++a) { 377 377 _lower[_arc_idf[a]] = map[a]; 378 _lower[_arc_idb[a]] = map[a];379 378 } 380 379 return *this; … … 569 568 _scost[_reverse[j]] = 0; 570 569 } 571 _ha ve_lower = false;570 _has_lower = false; 572 571 return *this; 573 572 } … … 781 780 const Value MAX = std::numeric_limits<Value>::max(); 782 781 int last_out; 783 if (_ha ve_lower) {782 if (_has_lower) { 784 783 for (int i = 0; i != _root; ++i) { 785 784 last_out = _first_out[i+1]; … … 838 837 sup[n] = _supply[_node_id[n]]; 839 838 } 840 if (_ha ve_lower) {839 if (_has_lower) { 841 840 for (ArcIt a(_graph); a != INVALID; ++a) { 842 841 int j = _arc_idf[a]; … … 908 907 } 909 908 910 // Check if the upper bound is greater or equal to the lower bound911 // on each arc.909 // Check if the upper bound is greater than or equal to the lower bound 910 // on each forward arc. 912 911 bool checkBoundMaps() { 913 912 for (int j = 0; j != _res_arc_num; ++j) { 914 if (_ upper[j] < _lower[j]) return false;913 if (_forward[j] && _upper[j] < _lower[j]) return false; 915 914 } 916 915 return true; … … 992 991 993 992 // Handle non-zero lower bounds 994 if (_ha ve_lower) {993 if (_has_lower) { 995 994 int limit = _first_out[_root]; 996 995 for (int j = 0; j != limit; ++j) { 997 if ( !_forward[j]) _res_cap[j] += _lower[j];996 if (_forward[j]) _res_cap[_reverse[j]] += _lower[j]; 998 997 } 999 998 } -
lemon/counter.h
r833 r1327 22 22 #include <string> 23 23 #include <iostream> 24 25 #include <lemon/core.h> 24 26 25 27 ///\ingroup timecount -
lemon/cplex.cc
r1270 r1347 38 38 } 39 39 40 void CplexEnv::incCnt() 41 { 42 _cnt_lock->lock(); 43 ++(*_cnt); 44 _cnt_lock->unlock(); 45 } 46 47 void CplexEnv::decCnt() 48 { 49 _cnt_lock->lock(); 50 --(*_cnt); 51 if (*_cnt == 0) { 52 delete _cnt; 53 _cnt_lock->unlock(); 54 delete _cnt_lock; 55 CPXcloseCPLEX(&_env); 56 } 57 else _cnt_lock->unlock(); 58 } 59 40 60 CplexEnv::CplexEnv() { 41 61 int status; 62 _env = CPXopenCPLEX(&status); 63 if (_env == 0) 64 throw LicenseError(status); 42 65 _cnt = new int; 43 66 (*_cnt) = 1; 44 _env = CPXopenCPLEX(&status); 45 if (_env == 0) { 46 delete _cnt; 47 _cnt = 0; 48 throw LicenseError(status); 49 } 67 _cnt_lock = new bits::Lock; 50 68 } 51 69 … … 53 71 _env = other._env; 54 72 _cnt = other._cnt; 55 ++(*_cnt); 73 _cnt_lock = other._cnt_lock; 74 incCnt(); 56 75 } 57 76 58 77 CplexEnv& CplexEnv::operator=(const CplexEnv& other) { 78 decCnt(); 59 79 _env = other._env; 60 80 _cnt = other._cnt; 61 ++(*_cnt); 81 _cnt_lock = other._cnt_lock; 82 incCnt(); 62 83 return *this; 63 84 } 64 85 65 86 CplexEnv::~CplexEnv() { 66 --(*_cnt); 67 if (*_cnt == 0) { 68 delete _cnt; 69 CPXcloseCPLEX(&_env); 70 } 87 decCnt(); 71 88 } 72 89 -
lemon/cplex.h
r1270 r1347 24 24 25 25 #include <lemon/lp_base.h> 26 #include <lemon/bits/lock.h> 26 27 27 28 struct cpxenv; … … 41 42 cpxenv* _env; 42 43 mutable int* _cnt; 43 44 mutable bits::Lock* _cnt_lock; 45 46 void incCnt(); 47 void decCnt(); 48 44 49 public: 45 50 -
lemon/cycle_canceling.h
r1270 r1298 196 196 197 197 // Parameters of the problem 198 bool _ha ve_lower;198 bool _has_lower; 199 199 Value _sum_supply; 200 200 … … 279 279 template <typename LowerMap> 280 280 CycleCanceling& lowerMap(const LowerMap& map) { 281 _ha ve_lower = true;281 _has_lower = true; 282 282 for (ArcIt a(_graph); a != INVALID; ++a) { 283 283 _lower[_arc_idf[a]] = map[a]; 284 _lower[_arc_idb[a]] = map[a];285 284 } 286 285 return *this; … … 472 471 _cost[_reverse[j]] = 0; 473 472 } 474 _ha ve_lower = false;473 _has_lower = false; 475 474 return *this; 476 475 } … … 685 684 const Value MAX = std::numeric_limits<Value>::max(); 686 685 int last_out; 687 if (_ha ve_lower) {686 if (_has_lower) { 688 687 for (int i = 0; i != _root; ++i) { 689 688 last_out = _first_out[i+1]; … … 728 727 sup[n] = _supply[_node_id[n]]; 729 728 } 730 if (_ha ve_lower) {729 if (_has_lower) { 731 730 for (ArcIt a(_graph); a != INVALID; ++a) { 732 731 int j = _arc_idf[a]; … … 785 784 } 786 785 787 // Check if the upper bound is greater or equal to the lower bound788 // on each arc.786 // Check if the upper bound is greater than or equal to the lower bound 787 // on each forward arc. 789 788 bool checkBoundMaps() { 790 789 for (int j = 0; j != _res_arc_num; ++j) { 791 if (_ upper[j] < _lower[j]) return false;790 if (_forward[j] && _upper[j] < _lower[j]) return false; 792 791 } 793 792 return true; … … 836 835 837 836 // Handle non-zero lower bounds 838 if (_ha ve_lower) {837 if (_has_lower) { 839 838 int limit = _first_out[_root]; 840 839 for (int j = 0; j != limit; ++j) { 841 if ( !_forward[j]) _res_cap[j] += _lower[j];840 if (_forward[j]) _res_cap[_reverse[j]] += _lower[j]; 842 841 } 843 842 } -
lemon/dim2.h
r761 r1311 21 21 22 22 #include <iostream> 23 #include <algorithm> 23 24 24 25 ///\ingroup geomdat -
lemon/dimacs.h
r1270 r1375 26 26 #include <lemon/maps.h> 27 27 #include <lemon/error.h> 28 28 29 /// \ingroup dimacs_group 29 30 /// \file … … 123 124 /// 124 125 /// If the file type was previously evaluated by dimacsType(), then 125 /// the descriptor struct should be given by the \c des tparameter.126 /// the descriptor struct should be given by the \c desc parameter. 126 127 template <typename Digraph, typename LowerMap, 127 128 typename CapacityMap, typename CostMap, … … 277 278 /// 278 279 /// If the file type was previously evaluated by dimacsType(), then 279 /// the descriptor struct should be given by the \c des tparameter.280 /// the descriptor struct should be given by the \c desc parameter. 280 281 template<typename Digraph, typename CapacityMap> 281 282 void readDimacsMax(std::istream& is, … … 304 305 /// 305 306 /// If the file type was previously evaluated by dimacsType(), then 306 /// the descriptor struct should be given by the \c des tparameter.307 /// the descriptor struct should be given by the \c desc parameter. 307 308 template<typename Digraph, typename LengthMap> 308 309 void readDimacsSp(std::istream& is, … … 335 336 /// 336 337 /// If the file type was previously evaluated by dimacsType(), then 337 /// the descriptor struct should be given by the \c des tparameter.338 /// the descriptor struct should be given by the \c desc parameter. 338 339 template<typename Digraph, typename CapacityMap> 339 340 void readDimacsCap(std::istream& is, … … 344 345 typename Digraph::Node u,v; 345 346 if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is); 346 if(desc.type!=DimacsDescriptor::MAX ||desc.type!=DimacsDescriptor::SP)347 if(desc.type!=DimacsDescriptor::MAX && desc.type!=DimacsDescriptor::SP) 347 348 throw FormatError("Problem type mismatch"); 348 349 _readDimacs(is, g, capacity, u, v, infty, desc); … … 375 376 /// 376 377 /// If the file type was previously evaluated by dimacsType(), then 377 /// the descriptor struct should be given by the \c des tparameter.378 /// the descriptor struct should be given by the \c desc parameter. 378 379 template<typename Graph> 379 380 void readDimacsMat(std::istream& is, Graph &g, -
lemon/elevator.h
r628 r1328 168 168 int onLevel(int l) const 169 169 { 170 return _first[l+1]-_first[l];170 return static_cast<int>(_first[l+1]-_first[l]); 171 171 } 172 172 ///Return true if level \c l is empty. … … 178 178 int aboveLevel(int l) const 179 179 { 180 return _first[_max_level+1]-_first[l+1];180 return static_cast<int>(_first[_max_level+1]-_first[l+1]); 181 181 } 182 182 ///Return the number of active items on level \c l. 183 183 int activesOnLevel(int l) const 184 184 { 185 return _last_active[l]-_first[l]+1;185 return static_cast<int>(_last_active[l]-_first[l]+1); 186 186 } 187 187 ///Return true if there is no active item on level \c l. -
lemon/graph_to_eps.h
r1270 r1340 26 26 #include<vector> 27 27 28 #ifndef WIN3228 #ifndef LEMON_WIN32 29 29 #include<sys/time.h> 30 30 #include<ctime> … … 223 223 using T::_copyright; 224 224 225 using T::NodeTextColorType;226 225 using T::CUST_COL; 227 226 using T::DIST_COL; … … 676 675 { 677 676 os << "%%CreationDate: "; 678 #ifndef WIN32677 #ifndef LEMON_WIN32 679 678 timeval tv; 680 679 gettimeofday(&tv, 0); -
lemon/list_graph.h
r1270 r1357 583 583 } 584 584 virtual void add(const std::vector<Node>& nodes) { 585 for (int i = nodes.size() - 1; i >= 0; ++i) {585 for (int i = nodes.size() - 1; i >= 0; --i) { 586 586 snapshot.addNode(nodes[i]); 587 587 } … … 633 633 } 634 634 virtual void add(const std::vector<Arc>& arcs) { 635 for (int i = arcs.size() - 1; i >= 0; ++i) {635 for (int i = arcs.size() - 1; i >= 0; --i) { 636 636 snapshot.addArc(arcs[i]); 637 637 } … … 1395 1395 } 1396 1396 virtual void add(const std::vector<Node>& nodes) { 1397 for (int i = nodes.size() - 1; i >= 0; ++i) {1397 for (int i = nodes.size() - 1; i >= 0; --i) { 1398 1398 snapshot.addNode(nodes[i]); 1399 1399 } … … 1445 1445 } 1446 1446 virtual void add(const std::vector<Edge>& edges) { 1447 for (int i = edges.size() - 1; i >= 0; ++i) {1447 for (int i = edges.size() - 1; i >= 0; --i) { 1448 1448 snapshot.addEdge(edges[i]); 1449 1449 } … … 2300 2300 } 2301 2301 virtual void add(const std::vector<Node>& nodes) { 2302 for (int i = nodes.size() - 1; i >= 0; ++i) {2302 for (int i = nodes.size() - 1; i >= 0; --i) { 2303 2303 snapshot.addNode(nodes[i]); 2304 2304 } … … 2350 2350 } 2351 2351 virtual void add(const std::vector<Edge>& edges) { 2352 for (int i = edges.size() - 1; i >= 0; ++i) {2352 for (int i = edges.size() - 1; i >= 0; --i) { 2353 2353 snapshot.addEdge(edges[i]); 2354 2354 } -
lemon/lp.h
r1270 r1340 23 23 24 24 25 #if def LEMON_HAVE_GLPK25 #if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_ 26 26 #include <lemon/glpk.h> 27 #elif LEMON_HAVE_CPLEX 27 #endif 28 #if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_ 28 29 #include <lemon/cplex.h> 29 #elif LEMON_HAVE_SOPLEX 30 #endif 31 #if LEMON_DEFAULT_LP == LEMON_SOPLEX_ 30 32 #include <lemon/soplex.h> 31 #elif LEMON_HAVE_CLP 33 #endif 34 #if LEMON_DEFAULT_LP == LEMON_CLP_ 32 35 #include <lemon/clp.h> 36 #endif 37 #if LEMON_DEFAULT_MIP == LEMON_CBC_ 38 #include <lemon/cbc.h> 33 39 #endif 34 40 … … 44 50 ///\ingroup lp_group 45 51 /// 46 ///Currently, the possible values are \c GLPK, \c CPLEX,47 ///\c SOPLEX or \c CLP52 ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_, 53 ///\c LEMON_SOPLEX_ or \c LEMON_CLP_ 48 54 #define LEMON_DEFAULT_LP SOLVER 49 55 ///The default LP solver … … 60 66 ///\ingroup lp_group 61 67 /// 62 ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC 68 ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_ 69 ///or \c LEMON_CBC_ 63 70 #define LEMON_DEFAULT_MIP SOLVER 64 71 ///The default MIP solver. … … 70 77 typedef GlpkMip Mip; 71 78 #else 72 #if LEMON_DEFAULT_LP == GLPK79 #if LEMON_DEFAULT_LP == LEMON_GLPK_ 73 80 typedef GlpkLp Lp; 74 #elif LEMON_DEFAULT_LP == CPLEX81 #elif LEMON_DEFAULT_LP == LEMON_CPLEX_ 75 82 typedef CplexLp Lp; 76 #elif LEMON_DEFAULT_LP == SOPLEX83 #elif LEMON_DEFAULT_LP == LEMON_SOPLEX_ 77 84 typedef SoplexLp Lp; 78 #elif LEMON_DEFAULT_LP == CLP85 #elif LEMON_DEFAULT_LP == LEMON_CLP_ 79 86 typedef ClpLp Lp; 80 87 #endif 81 #if LEMON_DEFAULT_MIP == GLPK82 typedef Glpk Lp Mip;83 #elif LEMON_DEFAULT_MIP == CPLEX88 #if LEMON_DEFAULT_MIP == LEMON_GLPK_ 89 typedef GlpkMip Mip; 90 #elif LEMON_DEFAULT_MIP == LEMON_CPLEX_ 84 91 typedef CplexMip Mip; 85 #elif LEMON_DEFAULT_MIP == CBC92 #elif LEMON_DEFAULT_MIP == LEMON_CBC_ 86 93 typedef CbcMip Mip; 87 94 #endif -
lemon/math.h
r1270 r1311 68 68 ///Round a value to its closest integer 69 69 inline double round(double r) { 70 return (r > 0.0) ? floor(r + 0.5) :ceil(r - 0.5);70 return (r > 0.0) ? std::floor(r + 0.5) : std::ceil(r - 0.5); 71 71 } 72 72 -
lemon/nearest_neighbor_tsp.h
r1270 r1294 116 116 for (IncEdgeIt e(_gr, n1); e != INVALID; ++e) { 117 117 if (!used[_gr.runningNode(e)] && 118 ( _cost[e] < _cost[min_edge1] || min_edge1 == INVALID)) {118 (min_edge1 == INVALID || _cost[e] < _cost[min_edge1])) { 119 119 min_edge1 = e; 120 120 } … … 125 125 for (IncEdgeIt e(_gr, n2); e != INVALID; ++e) { 126 126 if (!used[_gr.runningNode(e)] && 127 ( _cost[e] < _cost[min_edge2] || min_edge2 == INVALID)) {127 (min_edge2 == INVALID||_cost[e] < _cost[min_edge2])) { 128 128 min_edge2 = e; 129 129 } -
lemon/network_simplex.h
r1270 r1318 199 199 200 200 // Parameters of the problem 201 bool _ha ve_lower;201 bool _has_lower; 202 202 SupplyType _stype; 203 203 Value _sum_supply; … … 683 683 template <typename LowerMap> 684 684 NetworkSimplex& lowerMap(const LowerMap& map) { 685 _ha ve_lower = true;685 _has_lower = true; 686 686 for (ArcIt a(_graph); a != INVALID; ++a) { 687 687 _lower[_arc_id[a]] = map[a]; … … 880 880 _cost[i] = 1; 881 881 } 882 _ha ve_lower = false;882 _has_lower = false; 883 883 _stype = GEQ; 884 884 return *this; … … 937 937 _node_id[n] = i; 938 938 } 939 if (_arc_mixing ) {939 if (_arc_mixing && _node_num > 1) { 940 940 // Store the arcs in a mixed order 941 941 const int skip = std::max(_arc_num / _node_num, 3); … … 1073 1073 1074 1074 // Remove non-zero lower bounds 1075 if (_ha ve_lower) {1075 if (_has_lower) { 1076 1076 for (int i = 0; i != _arc_num; ++i) { 1077 1077 Value c = _lower[i]; … … 1236 1236 } 1237 1237 1238 // Check if the upper bound is greater or equal to the lower bound1238 // Check if the upper bound is greater than or equal to the lower bound 1239 1239 // on each arc. 1240 1240 bool checkBoundMaps() { … … 1613 1613 1614 1614 // Transform the solution and the supply map to the original form 1615 if (_ha ve_lower) {1615 if (_has_lower) { 1616 1616 for (int i = 0; i != _arc_num; ++i) { 1617 1617 Value c = _lower[i]; -
lemon/radix_sort.h
r1270 r1328 329 329 Allocator allocator; 330 330 331 int length = st d::distance(first, last);331 int length = static_cast<int>(std::distance(first, last)); 332 332 Key* buffer = allocator.allocate(2 * length); 333 333 try { -
lemon/random.h
r631 r1340 63 63 #define LEMON_RANDOM_H 64 64 65 #include <lemon/config.h> 66 65 67 #include <algorithm> 66 68 #include <iterator> … … 72 74 #include <lemon/dim2.h> 73 75 74 #ifndef WIN3276 #ifndef LEMON_WIN32 75 77 #include <sys/time.h> 76 78 #include <ctime> … … 200 202 initState(init); 201 203 202 num = length > end - begin ? length : end - begin;204 num = static_cast<int>(length > end - begin ? length : end - begin); 203 205 while (num--) { 204 206 curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1)) … … 214 216 } 215 217 216 num = length - 1; cnt = length - (curr - state) - 1;218 num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1); 217 219 while (num--) { 218 220 curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2)) … … 606 608 /// \return Currently always \c true. 607 609 bool seed() { 608 #ifndef WIN32610 #ifndef LEMON_WIN32 609 611 if (seedFromFile("/dev/urandom", 0)) return true; 610 612 #endif … … 626 628 /// \param offset The offset, from the file read. 627 629 /// \return \c true when the seeding successes. 628 #ifndef WIN32630 #ifndef LEMON_WIN32 629 631 bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0) 630 632 #else … … 648 650 /// \return Currently always \c true. 649 651 bool seedFromTime() { 650 #ifndef WIN32652 #ifndef LEMON_WIN32 651 653 timeval tv; 652 654 gettimeofday(&tv, 0); -
lemon/static_graph.h
r956 r1328 204 204 205 205 node_num = n; 206 arc_num = st d::distance(first, last);206 arc_num = static_cast<int>(std::distance(first, last)); 207 207 208 208 node_first_out = new int[node_num + 1]; -
lemon/time_measure.h
r1270 r1340 24 24 ///\brief Tools for measuring cpu usage 25 25 26 #ifdef WIN32 26 #include <lemon/config.h> 27 28 #ifdef LEMON_WIN32 27 29 #include <lemon/bits/windows.h> 28 30 #else … … 103 105 void stamp() 104 106 { 105 #ifndef WIN32107 #ifndef LEMON_WIN32 106 108 timeval tv; 107 109 gettimeofday(&tv, 0); -
test/arc_look_up_test.cc
r1270 r1312 25 25 using namespace lemon; 26 26 27 const int lgfn = 4;28 27 const std::string lgf = 29 28 "@nodes\n" -
test/bpgraph_test.cc
r1270 r1292 79 79 e2 = G.addEdge(bn1, rn1), 80 80 e3 = G.addEdge(rn1, bn2); 81 ::lemon::ignore_unused_variable_warning(e2,e3); 81 82 82 83 checkGraphNodeList(G, 3); … … 120 121 e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3), 121 122 e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3); 123 ::lemon::ignore_unused_variable_warning(e1,e3,e4); 122 124 123 125 // Check edge deletion … … 168 170 e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3), 169 171 e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3); 172 ::lemon::ignore_unused_variable_warning(e1,e3,e4); 170 173 171 174 G.changeRed(e2, n4); … … 220 223 e1 = G.addEdge(n1, n2), 221 224 e2 = G.addEdge(n1, n3); 225 ::lemon::ignore_unused_variable_warning(e1,e2); 222 226 223 227 checkGraphNodeList(G, 3); … … 305 309 e1 = g.addEdge(n1, n2), 306 310 e2 = g.addEdge(n1, n3); 311 ::lemon::ignore_unused_variable_warning(e2); 307 312 308 313 check(g.valid(n1), "Wrong validity check"); -
test/lp_test.cc
r1270 r1300 40 40 #endif 41 41 42 #ifdef LEMON_HAVE_LP 43 #include <lemon/lp.h> 44 #endif 42 45 using namespace lemon; 43 46 … … 417 420 lpTest(lp_skel); 418 421 422 #ifdef LEMON_HAVE_LP 423 { 424 Lp lp,lp2; 425 lpTest(lp); 426 aTest(lp2); 427 cloneTest<Lp>(); 428 } 429 #endif 430 419 431 #ifdef LEMON_HAVE_GLPK 420 432 { -
test/min_cost_flow_test.cc
r1270 r1318 396 396 checkMcf(mcf3, mcf3.run(param), neg2_gr, neg2_l, neg2_u, neg2_c, neg2_s, 397 397 mcf3.OPTIMAL, true, -300, test_str + "-18", GEQ); 398 399 // Tests for empty graph 400 Digraph gr0; 401 MCF mcf0(gr0); 402 mcf0.run(param); 403 check(mcf0.totalCost() == 0, "Wrong total cost"); 398 404 } 399 405 -
test/mip_test.cc
r795 r1300 31 31 #ifdef LEMON_HAVE_CBC 32 32 #include <lemon/cbc.h> 33 #endif 34 35 #ifdef LEMON_HAVE_MIP 36 #include <lemon/lp.h> 33 37 #endif 34 38 … … 129 133 { 130 134 135 #ifdef LEMON_HAVE_MIP 136 { 137 Mip mip1; 138 aTest(mip1); 139 cloneTest<Mip>(); 140 } 141 #endif 142 131 143 #ifdef LEMON_HAVE_GLPK 132 144 { -
test/radix_sort_test.cc
r1270 r1341 16 16 * 17 17 */ 18 19 #include <lemon/core.h> 18 20 19 21 #include <lemon/time_measure.h> -
test/tsp_test.cc
r1271 r1303 133 133 int esize = n <= 1 ? 0 : n; 134 134 135 TSP alg(g, constMap<Edge, int>(1)); 135 ConstMap<Edge, int> cost_map(1); 136 TSP alg(g, cost_map); 136 137 137 138 check(alg.run() == esize, alg_name + ": Wrong total cost"); -
tools/lgf-gen.cc
r701 r1308 247 247 struct BeachIt; 248 248 249 typedef std::multimap<double, BeachIt > SpikeHeap;249 typedef std::multimap<double, BeachIt*> SpikeHeap; 250 250 251 251 typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach; … … 330 330 331 331 if (bit->second != spikeheap.end()) { 332 delete bit->second->second; 332 333 spikeheap.erase(bit->second); 333 334 } … … 343 344 circle_form(points[prev], points[curr], points[site])) { 344 345 double x = circle_point(points[prev], points[curr], points[site]); 345 pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));346 pit->second .it =346 pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 347 pit->second->it = 347 348 beach.insert(std::make_pair(Part(prev, curr, site), pit)); 348 349 } else { … … 356 357 circle_form(points[site], points[curr],points[next])) { 357 358 double x = circle_point(points[site], points[curr], points[next]); 358 nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));359 nit->second .it =359 nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 360 nit->second->it = 360 361 beach.insert(std::make_pair(Part(site, curr, next), nit)); 361 362 } else { … … 367 368 sweep = spit->first; 368 369 369 Beach::iterator bit = spit->second .it;370 Beach::iterator bit = spit->second->it; 370 371 371 372 int prev = bit->first.prev; … … 400 401 int nnt = nbit->first.next; 401 402 402 if (bit->second != spikeheap.end()) spikeheap.erase(bit->second); 403 if (pbit->second != spikeheap.end()) spikeheap.erase(pbit->second); 404 if (nbit->second != spikeheap.end()) spikeheap.erase(nbit->second); 405 403 if (bit->second != spikeheap.end()) 404 { 405 delete bit->second->second; 406 spikeheap.erase(bit->second); 407 } 408 if (pbit->second != spikeheap.end()) 409 { 410 delete pbit->second->second; 411 spikeheap.erase(pbit->second); 412 } 413 if (nbit->second != spikeheap.end()) 414 { 415 delete nbit->second->second; 416 spikeheap.erase(nbit->second); 417 } 418 406 419 beach.erase(nbit); 407 420 beach.erase(bit); … … 413 426 double x = circle_point(points[ppv], points[prev], points[next]); 414 427 if (x < sweep) x = sweep; 415 pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));416 pit->second .it =428 pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 429 pit->second->it = 417 430 beach.insert(std::make_pair(Part(ppv, prev, next), pit)); 418 431 } else { … … 425 438 double x = circle_point(points[prev], points[next], points[nnt]); 426 439 if (x < sweep) x = sweep; 427 nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));428 nit->second .it =440 nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 441 nit->second->it = 429 442 beach.insert(std::make_pair(Part(prev, next, nnt), nit)); 430 443 } else {
Note: See TracChangeset
for help on using the changeset viewer.