COIN-OR::LEMON - Graph Library

Changes in / [1176:2e0c2c25d63e:1169:8db773f19586] in lemon-main


Ignore:
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r1137 r1088  
    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)
     1CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
    112
    123SET(PROJECT_NAME "LEMON")
     
    7162FIND_PACKAGE(Doxygen)
    7263FIND_PACKAGE(Ghostscript)
    73 
    74 IF(WIN32)
    75   SET(LEMON_WIN32 TRUE)
    76 ENDIF(WIN32)
    7764
    7865SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
     
    135122  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    136123    "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)")
    140124ENDIF()
    141125IF(NOT LEMON_DEFAULT_MIP OR
     
    145129  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
    146130    "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)")
    150131ENDIF()
    151132
     
    160141  ELSEIF(MSVC)
    161142    # 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 
     143    # Still keep it as an example.
     144    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    166145    # Suppressed warnings:
    167146    # C4250: 'class1' : inherits 'class2::member' via dominance
    168     # C4267: conversion from 'size_t' to 'type', possible loss of data
    169147    # C4355: 'this' : used in base member initializer list
    170148    # C4503: 'function' : decorated name length exceeded, name was truncated
     
    181159
    182160IF(MSVC)
    183   SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    184161  SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    185162    "Flags used by the C++ compiler during maintainer builds."
     
    204181    )
    205182  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    206     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
     183    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
    207184    "Flags used for linking binaries during maintainer builds."
    208185    )
    209186  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    210     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
     187    "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
    211188    "Flags used by the shared libraries linker during maintainer builds."
    212189    )
  • NEWS

    r1094 r881  
    1 2013-08-10 Version 1.3 released
    2 
    3         This is major feature release
    4 
    5         * New data structures
    6 
    7           #69 : Bipartite graph concepts and implementations
    8 
    9         * New algorithms
    10 
    11           #177: Port Edmonds-Karp algorithm
    12           #380, #405: Heuristic algorithm for the max clique problem
    13           #386: Heuristic algorithms for symmetric TSP
    14           ----: Nagamochi-Ibaraki algorithm [5087694945e4]
    15           #397, #56: Max. cardinality search
    16 
    17         * Other new features
    18 
    19           #223: Thread safe graph and graph map implementations
    20           #442: Different TimeStamp print formats
    21           #457: File export functionality to LpBase
    22           #362: Bidirectional iterator support for radixSort()
    23 
    24         * Implementation improvements
    25 
    26           ----: Network Simplex
    27                 #391: Better update process, pivot rule and arc mixing
    28                 #435: Improved Altering List pivot rule
    29           #417: Various fine tunings in CostScaling
    30           #438: Optional iteration limit in HowardMmc
    31           #436: Ensure strongly polynomial running time for CycleCanceling
    32                 while keeping the same performance
    33           ----: Make the CBC interface be compatible with latest CBC releases
    34                 [ee581a0ecfbf]
    35 
    36         * CMAKE has become the default build environment (#434)
    37 
    38           ----: Autotool support has been dropped
    39           ----: Improved LP/MIP configuration
    40                 #465: Enable/disable options for LP/MIP backends
    41                 #446: Better CPLEX discovery
    42                 #460: Add cmake config to find SoPlex
    43           ----: Allow CPACK configuration on all platforms
    44           #390: Add 'Maintainer' CMAKE build type
    45           #388: Add 'check' target.
    46           #401: Add contrib dir
    47           #389: Better version string setting in CMAKE
    48           #433: Support shared library build   
    49           #416: Support testing with valgrind
    50  
    51         * Doc improvements
    52 
    53           #395: SOURCE_BROWSER Doxygen switch is configurable from CMAKE
    54                 update-external-tags CMAKE target
    55           #455: Optionally use MathJax for rendering the math formulae
    56           #402, #437, #459, #456, #463: Various doc improvements
    57 
    58         * Bugfixes (compared to release 1.2):
    59 
    60           #432: Add missing doc/template.h and doc/references.bib to release
    61                 tarball
    62           ----: Intel C++ compatibility fixes
    63           #441: Fix buggy reinitialization in _solver_bits::VarIndex::clear()
    64           #444: Bugfix in path copy constructors and assignment operators
    65           #447: Bugfix in AllArcLookUp<>
    66           #448: Bugfix in adaptor_test.cc
    67           #449: Fix clang compilation warnings and errors
    68           #440: Fix a bug + remove redundant typedefs in dimacs-solver
    69           #453: Avoid GCC 4.7 compiler warnings
    70           #445: Fix missing initialization in CplexEnv::CplexEnv()
    71           #428: Add missing lemon/lemon.pc.cmake to the release tarball
    72           #393: Create and install lemon.pc
    73           #429: Fix VS warnings
    74           #430: Fix LpBase::Constr two-side limit bug
    75           #392: Bug fix in Dfs::start(s,t)
    76           #414: Fix wrong initialization in Preflow
    77           #418: Better Win CodeBlock/MinGW support
    78           #419: Build environment improvements
    79                 - Build of mip_test and lp_test precede the running of the tests
    80                 - Also search for coin libs under ${COIN_ROOT_DIR}/lib/coin
    81                 - Do not look for COIN_VOL libraries
    82           #382: Allow lgf file without Arc maps
    83           #417: Bug fix in CostScaling
    84           #366: Fix Pred[Matrix]MapPath::empty()
    85           #371: Bug fix in (di)graphCopy()
    86                 The target graph is cleared before adding nodes and arcs/edges.
    87           #364: Add missing UndirectedTags
    88           #368: Fix the usage of std::numeric_limits<>::min() in Network Simplex
    89           #372: Fix a critical bug in preflow
    90           #461: Bugfix in assert.h
    91           #470: Fix compilation issues related to various gcc versions
    92           #446: Fix #define indicating CPLEX availability
    93           #294: Add explicit namespace to
    94                 ignore_unused_variable_warning() usages
    95           #420: Bugfix in IterableValueMap
    96           #439: Bugfix in biNodeConnected()
    97 
    98 
    9912010-03-19 Version 1.2 released
    1002
  • cmake/FindILOG.cmake

    r1126 r1064  
    6363  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    6464  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
    65   ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
    66   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
    6765  ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    6866  NO_DEFAULT_PATH
     
    7573  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    7674  ${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
    7975  ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    8076  NO_DEFAULT_PATH
  • doc/groups.dox

    r1093 r1092  
    423423However, other algorithms could be faster in special cases.
    424424For example, if the total supply and/or capacities are rather small,
    425 \ref CapacityScaling is usually the fastest algorithm
    426 (without effective scaling).
     425\ref CapacityScaling is usually the fastest algorithm (without effective scaling).
    427426
    428427These classes are intended to be used with integer-valued input data
  • lemon/CMakeLists.txt

    r1116 r1088  
    5656
    5757ADD_LIBRARY(lemon ${LEMON_SOURCES})
    58 
    59 TARGET_LINK_LIBRARIES(lemon
    60   ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
    61   )
    62 
    6358IF(UNIX)
    64   SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION})
     59  SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
    6560ENDIF()
    6661
  • lemon/arg_parser.h

    r1123 r879  
    2727#include <sstream>
    2828#include <algorithm>
    29 #include <lemon/core.h>
    3029#include <lemon/assert.h>
    3130
  • lemon/bits/windows.cc

    r1135 r1092  
    2222#include<lemon/bits/windows.h>
    2323
    24 #if defined(LEMON_WIN32) && defined(__GNUC__)
    25 #pragma GCC diagnostic ignored "-Wold-style-cast"
    26 #endif
    27 
    28 #ifdef LEMON_WIN32
     24#ifdef WIN32
    2925#ifndef WIN32_LEAN_AND_MEAN
    3026#define WIN32_LEAN_AND_MEAN
     
    4541#include <unistd.h>
    4642#include <ctime>
    47 #ifndef LEMON_WIN32
     43#ifndef WIN32
    4844#include <sys/times.h>
    4945#endif
     
    6056                         double &cutime, double &cstime)
    6157    {
    62 #ifdef LEMON_WIN32
     58#ifdef WIN32
    6359      static const double ch = 4294967296.0e-7;
    6460      static const double cl = 1.0e-7;
     
    9995    {
    10096      std::ostringstream os;
    101 #ifdef LEMON_WIN32
     97#ifdef WIN32
    10298      SYSTEMTIME time;
    10399      GetSystemTime(&time);
    104100      char buf1[11], buf2[9], buf3[5];
    105       if (GetDateFormat(MY_LOCALE, 0, &time,
     101          if (GetDateFormat(MY_LOCALE, 0, &time,
    106102                        ("ddd MMM dd"), buf1, 11) &&
    107103          GetTimeFormat(MY_LOCALE, 0, &time,
     
    125121    int getWinRndSeed()
    126122    {
    127 #ifdef LEMON_WIN32
     123#ifdef WIN32
    128124      FILETIME time;
    129125      GetSystemTimeAsFileTime(&time);
     
    137133
    138134    WinLock::WinLock() {
    139 #ifdef LEMON_WIN32
     135#ifdef WIN32
    140136      CRITICAL_SECTION *lock = new CRITICAL_SECTION;
    141137      InitializeCriticalSection(lock);
     
    147143
    148144    WinLock::~WinLock() {
    149 #ifdef LEMON_WIN32
     145#ifdef WIN32
    150146      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    151147      DeleteCriticalSection(lock);
     
    155151
    156152    void WinLock::lock() {
    157 #ifdef LEMON_WIN32
     153#ifdef WIN32
    158154      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    159155      EnterCriticalSection(lock);
     
    162158
    163159    void WinLock::unlock() {
    164 #ifdef LEMON_WIN32
     160#ifdef WIN32
    165161      CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    166162      LeaveCriticalSection(lock);
  • lemon/bits/windows.h

    r1134 r1092  
    2020#define LEMON_BITS_WINDOWS_H
    2121
    22 #include <lemon/config.h>
    2322#include <string>
    2423
     
    3635      ~WinLock();
    3736      void lock();
    38       void unlock();\
     37      void unlock();
    3938    private:
    4039      void *_repr;
  • lemon/capacity_scaling.h

    r1155 r1092  
    2828#include <limits>
    2929#include <lemon/core.h>
    30 #include <lemon/maps.h>
    3130#include <lemon/bin_heap.h>
    3231
     
    165164
    166165    // Parameters of the problem
    167     bool _has_lower;
     166    bool _have_lower;
    168167    Value _sum_supply;
    169168
     
    358357    template <typename LowerMap>
    359358    CapacityScaling& lowerMap(const LowerMap& map) {
    360       _has_lower = true;
     359      _have_lower = true;
    361360      for (ArcIt a(_graph); a != INVALID; ++a) {
    362361        _lower[_arc_idf[a]] = map[a];
     362        _lower[_arc_idb[a]] = map[a];
    363363      }
    364364      return *this;
     
    544544        _cost[j] = _forward[j] ? 1 : -1;
    545545      }
    546       _has_lower = false;
     546      _have_lower = false;
    547547      return *this;
    548548    }
     
    755755      const Value MAX = std::numeric_limits<Value>::max();
    756756      int last_out;
    757       if (_has_lower) {
     757      if (_have_lower) {
    758758        for (int i = 0; i != _root; ++i) {
    759759          last_out = _first_out[i+1];
     
    840840    }
    841841
    842     // Check if the upper bound is greater than or equal to the lower bound
    843     // on each forward arc.
     842    // Check if the upper bound is greater or equal to the lower bound
     843    // on each arc.
    844844    bool checkBoundMaps() {
    845845      for (int j = 0; j != _res_arc_num; ++j) {
    846         if (_forward[j] && _upper[j] < _lower[j]) return false;
     846        if (_upper[j] < _lower[j]) return false;
    847847      }
    848848      return true;
     
    858858
    859859      // Handle non-zero lower bounds
    860       if (_has_lower) {
     860      if (_have_lower) {
    861861        int limit = _first_out[_root];
    862862        for (int j = 0; j != limit; ++j) {
    863           if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
     863          if (!_forward[j]) _res_cap[j] += _lower[j];
    864864        }
    865865      }
  • lemon/concepts/digraph.h

    r1093 r1092  
    313313        /// Sets the iterator to the first arc of the given digraph.
    314314        ///
    315         explicit ArcIt(const Digraph& g) {
    316           ::lemon::ignore_unused_variable_warning(g);
    317         }
     315        explicit ArcIt(const Digraph& g) { ::lemon::ignore_unused_variable_warning(g); }
    318316        /// Sets the iterator to the given arc.
    319317
  • lemon/concepts/graph.h

    r1093 r1092  
    397397        /// Sets the iterator to the first arc of the given graph.
    398398        ///
    399         explicit ArcIt(const Graph &g) {
    400           ::lemon::ignore_unused_variable_warning(g);
    401         }
     399        explicit ArcIt(const Graph &g) { ::lemon::ignore_unused_variable_warning(g); }
    402400        /// Sets the iterator to the given arc.
    403401
  • lemon/config.h.in

    r1134 r1088  
    1 #ifndef LEMON_CONFIG_H
    2 #define LEMON_CONFIG_H
    3 
    41#define LEMON_VERSION "@PROJECT_VERSION@"
    52#cmakedefine LEMON_HAVE_LONG_LONG 1
    6 
    7 #cmakedefine LEMON_WIN32 1
    8 
    93#cmakedefine LEMON_HAVE_LP 1
    104#cmakedefine LEMON_HAVE_MIP 1
     
    148#cmakedefine LEMON_HAVE_CLP 1
    159#cmakedefine LEMON_HAVE_CBC 1
    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 
     10#cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@
     11#cmakedefine LEMON_DEFAULT_MIP @LEMON_DEFAULT_MIP@
    2612#cmakedefine LEMON_USE_PTHREAD 1
    2713#cmakedefine LEMON_USE_WIN32_THREADS 1
    28 
    29 #endif
  • lemon/core.h

    r1135 r1092  
    2020#define LEMON_CORE_H
    2121
     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 dominance
     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 4355 4503 4800 4996 )
     38#endif
     39
     40#ifdef __GNUC__
     41#define GCC_VERSION (__GNUC__ * 10000                   \
     42                     + __GNUC_MINOR__ * 100             \
     43                     + __GNUC_PATCHLEVEL__)
     44#endif
     45
     46#if GCC_VERSION >= 40800
     47// Needed by the [DI]GRAPH_TYPEDEFS marcos for gcc 4.8
     48#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
     49#endif
     50
    2251///\file
    2352///\brief LEMON core utilities.
     
    2655///It is automatically included by all graph types, therefore it usually
    2756///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 
    5457
    5558namespace lemon {
  • lemon/cost_scaling.h

    r1104 r1092  
    9292  /// \ref CostScaling implements a cost scaling algorithm that performs
    9393  /// push/augment and relabel operations for finding a \ref min_cost_flow
    94   /// "minimum cost flow" \cite amo93networkflows,
    95   /// \cite goldberg90approximation,
     94  /// "minimum cost flow" \cite amo93networkflows, \cite goldberg90approximation,
    9695  /// \cite goldberg97efficient, \cite bunnagel98efficient.
    9796  /// It is a highly efficient primal-dual solution method, which
     
    215214    typedef std::vector<LargeCost> LargeCostVector;
    216215    typedef std::vector<char> BoolVector;
    217     // Note: vector<char> is used instead of vector<bool>
    218     // for efficiency reasons
     216    // Note: vector<char> is used instead of vector<bool> for efficiency reasons
    219217
    220218  private:
     
    257255
    258256    // Parameters of the problem
    259     bool _has_lower;
     257    bool _have_lower;
    260258    Value _sum_supply;
    261259    int _sup_node_num;
     
    373371    template <typename LowerMap>
    374372    CostScaling& lowerMap(const LowerMap& map) {
    375       _has_lower = true;
     373      _have_lower = true;
    376374      for (ArcIt a(_graph); a != INVALID; ++a) {
    377375        _lower[_arc_idf[a]] = map[a];
     376        _lower[_arc_idb[a]] = map[a];
    378377      }
    379378      return *this;
     
    568567        _scost[_reverse[j]] = 0;
    569568      }
    570       _has_lower = false;
     569      _have_lower = false;
    571570      return *this;
    572571    }
     
    780779      const Value MAX = std::numeric_limits<Value>::max();
    781780      int last_out;
    782       if (_has_lower) {
     781      if (_have_lower) {
    783782        for (int i = 0; i != _root; ++i) {
    784783          last_out = _first_out[i+1];
     
    837836        sup[n] = _supply[_node_id[n]];
    838837      }
    839       if (_has_lower) {
     838      if (_have_lower) {
    840839        for (ArcIt a(_graph); a != INVALID; ++a) {
    841840          int j = _arc_idf[a];
     
    907906    }
    908907
    909     // Check if the upper bound is greater than or equal to the lower bound
    910     // on each forward arc.
     908    // Check if the upper bound is greater or equal to the lower bound
     909    // on each arc.
    911910    bool checkBoundMaps() {
    912911      for (int j = 0; j != _res_arc_num; ++j) {
    913         if (_forward[j] && _upper[j] < _lower[j]) return false;
     912        if (_upper[j] < _lower[j]) return false;
    914913      }
    915914      return true;
     
    991990
    992991      // Handle non-zero lower bounds
    993       if (_has_lower) {
     992      if (_have_lower) {
    994993        int limit = _first_out[_root];
    995994        for (int j = 0; j != limit; ++j) {
    996           if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
     995          if (!_forward[j]) _res_cap[j] += _lower[j];
    997996        }
    998997      }
  • lemon/counter.h

    r1123 r786  
    2222#include <string>
    2323#include <iostream>
    24 
    25 #include <lemon/core.h>
    2624
    2725///\ingroup timecount
  • lemon/cplex.cc

    r1139 r1092  
    3838  }
    3939
    40   void CplexEnv::incCnt()
    41   {
    42     _cnt_lock->lock();
     40  CplexEnv::CplexEnv() {
     41    int status;
     42    _cnt = new int;
     43    (*_cnt) = 1;
     44    _env = CPXopenCPLEX(&status);
     45    if (_env == 0) {
     46      delete _cnt;
     47      _cnt = 0;
     48      throw LicenseError(status);
     49    }
     50  }
     51
     52  CplexEnv::CplexEnv(const CplexEnv& other) {
     53    _env = other._env;
     54    _cnt = other._cnt;
    4355    ++(*_cnt);
    44     _cnt_lock->unlock();
    45   }
    46 
    47   void CplexEnv::decCnt()
    48   {
    49     _cnt_lock->lock();
     56  }
     57
     58  CplexEnv& CplexEnv::operator=(const CplexEnv& other) {
     59    _env = other._env;
     60    _cnt = other._cnt;
     61    ++(*_cnt);
     62    return *this;
     63  }
     64
     65  CplexEnv::~CplexEnv() {
    5066    --(*_cnt);
    5167    if (*_cnt == 0) {
    5268      delete _cnt;
    53       _cnt_lock->unlock();
    54       delete _cnt_lock;
    5569      CPXcloseCPLEX(&_env);
    5670    }
    57     else _cnt_lock->unlock();
    58   }
    59  
    60   CplexEnv::CplexEnv() {
    61     int status;
    62     _env = CPXopenCPLEX(&status);
    63     if (_env == 0)
    64       throw LicenseError(status);
    65     _cnt = new int;
    66     (*_cnt) = 1;
    67     _cnt_lock = new bits::Lock;
    68   }
    69 
    70   CplexEnv::CplexEnv(const CplexEnv& other) {
    71     _env = other._env;
    72     _cnt = other._cnt;
    73     _cnt_lock = other._cnt_lock;
    74     incCnt();
    75   }
    76 
    77   CplexEnv& CplexEnv::operator=(const CplexEnv& other) {
    78     decCnt();
    79     _env = other._env;
    80     _cnt = other._cnt;
    81     _cnt_lock = other._cnt_lock;
    82     incCnt();
    83     return *this;
    84   }
    85 
    86   CplexEnv::~CplexEnv() {
    87     decCnt();
    8871  }
    8972
  • lemon/cplex.h

    r1139 r1092  
    2424
    2525#include <lemon/lp_base.h>
    26 #include <lemon/bits/lock.h>
    2726
    2827struct cpxenv;
     
    4241    cpxenv* _env;
    4342    mutable int* _cnt;
    44     mutable bits::Lock* _cnt_lock;
    45 
    46     void incCnt();
    47     void decCnt();
    48    
     43
    4944  public:
    5045
  • lemon/cycle_canceling.h

    r1104 r1092  
    196196
    197197    // Parameters of the problem
    198     bool _has_lower;
     198    bool _have_lower;
    199199    Value _sum_supply;
    200200
     
    279279    template <typename LowerMap>
    280280    CycleCanceling& lowerMap(const LowerMap& map) {
    281       _has_lower = true;
     281      _have_lower = true;
    282282      for (ArcIt a(_graph); a != INVALID; ++a) {
    283283        _lower[_arc_idf[a]] = map[a];
     284        _lower[_arc_idb[a]] = map[a];
    284285      }
    285286      return *this;
     
    471472        _cost[_reverse[j]] = 0;
    472473      }
    473       _has_lower = false;
     474      _have_lower = false;
    474475      return *this;
    475476    }
     
    684685      const Value MAX = std::numeric_limits<Value>::max();
    685686      int last_out;
    686       if (_has_lower) {
     687      if (_have_lower) {
    687688        for (int i = 0; i != _root; ++i) {
    688689          last_out = _first_out[i+1];
     
    727728        sup[n] = _supply[_node_id[n]];
    728729      }
    729       if (_has_lower) {
     730      if (_have_lower) {
    730731        for (ArcIt a(_graph); a != INVALID; ++a) {
    731732          int j = _arc_idf[a];
     
    784785    }
    785786
    786     // Check if the upper bound is greater than or equal to the lower bound
    787     // on each forward arc.
     787    // Check if the upper bound is greater or equal to the lower bound
     788    // on each arc.
    788789    bool checkBoundMaps() {
    789790      for (int j = 0; j != _res_arc_num; ++j) {
    790         if (_forward[j] && _upper[j] < _lower[j]) return false;
     791        if (_upper[j] < _lower[j]) return false;
    791792      }
    792793      return true;
     
    835836
    836837      // Handle non-zero lower bounds
    837       if (_has_lower) {
     838      if (_have_lower) {
    838839        int limit = _first_out[_root];
    839840        for (int j = 0; j != limit; ++j) {
    840           if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
     841          if (!_forward[j]) _res_cap[j] += _lower[j];
    841842        }
    842843      }
  • lemon/dim2.h

    r1112 r714  
    2121
    2222#include <iostream>
    23 #include <algorithm>
    2423
    2524///\ingroup geomdat
  • lemon/dimacs.h

    r1160 r1092  
    2626#include <lemon/maps.h>
    2727#include <lemon/error.h>
    28 
    2928/// \ingroup dimacs_group
    3029/// \file
     
    124123  ///
    125124  /// If the file type was previously evaluated by dimacsType(), then
    126   /// the descriptor struct should be given by the \c desc parameter.
     125  /// the descriptor struct should be given by the \c dest parameter.
    127126  template <typename Digraph, typename LowerMap,
    128127            typename CapacityMap, typename CostMap,
     
    278277  ///
    279278  /// If the file type was previously evaluated by dimacsType(), then
    280   /// the descriptor struct should be given by the \c desc parameter.
     279  /// the descriptor struct should be given by the \c dest parameter.
    281280  template<typename Digraph, typename CapacityMap>
    282281  void readDimacsMax(std::istream& is,
     
    305304  ///
    306305  /// If the file type was previously evaluated by dimacsType(), then
    307   /// the descriptor struct should be given by the \c desc parameter.
     306  /// the descriptor struct should be given by the \c dest parameter.
    308307  template<typename Digraph, typename LengthMap>
    309308  void readDimacsSp(std::istream& is,
     
    336335  ///
    337336  /// If the file type was previously evaluated by dimacsType(), then
    338   /// the descriptor struct should be given by the \c desc parameter.
     337  /// the descriptor struct should be given by the \c dest parameter.
    339338  template<typename Digraph, typename CapacityMap>
    340339  void readDimacsCap(std::istream& is,
     
    345344    typename Digraph::Node u,v;
    346345    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
    347     if(desc.type!=DimacsDescriptor::MAX && desc.type!=DimacsDescriptor::SP)
     346    if(desc.type!=DimacsDescriptor::MAX || desc.type!=DimacsDescriptor::SP)
    348347      throw FormatError("Problem type mismatch");
    349348    _readDimacs(is, g, capacity, u, v, infty, desc);
     
    376375  ///
    377376  /// If the file type was previously evaluated by dimacsType(), then
    378   /// the descriptor struct should be given by the \c desc parameter.
     377  /// the descriptor struct should be given by the \c dest parameter.
    379378  template<typename Graph>
    380379  void readDimacsMat(std::istream& is, Graph &g,
  • lemon/elevator.h

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

    r1134 r1092  
    2626#include<vector>
    2727
    28 #ifndef LEMON_WIN32
     28#ifndef WIN32
    2929#include<sys/time.h>
    3030#include<ctime>
     
    223223  using T::_copyright;
    224224
     225  using T::NodeTextColorType;
    225226  using T::CUST_COL;
    226227  using T::DIST_COL;
     
    675676    {
    676677      os << "%%CreationDate: ";
    677 #ifndef LEMON_WIN32
     678#ifndef WIN32
    678679      timeval tv;
    679680      gettimeofday(&tv, 0);
  • lemon/howard_mmc.h

    r1093 r1092  
    362362    /// \return The termination cause of the search process.
    363363    /// For more information, see \ref TerminationCause.
    364     TerminationCause findCycleMean(int limit =
    365                                    std::numeric_limits<int>::max()) {
     364    TerminationCause findCycleMean(int limit = std::numeric_limits<int>::max()) {
    366365      // Initialize and find strongly connected components
    367366      init();
  • lemon/list_graph.h

    r1148 r1092  
    583583        }
    584584        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) {
    586586            snapshot.addNode(nodes[i]);
    587587          }
     
    633633        }
    634634        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) {
    636636            snapshot.addArc(arcs[i]);
    637637          }
     
    13951395        }
    13961396        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) {
    13981398            snapshot.addNode(nodes[i]);
    13991399          }
     
    14451445        }
    14461446        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) {
    14481448            snapshot.addEdge(edges[i]);
    14491449          }
     
    23002300        }
    23012301        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) {
    23032303            snapshot.addNode(nodes[i]);
    23042304          }
     
    23502350        }
    23512351        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) {
    23532353            snapshot.addEdge(edges[i]);
    23542354          }
  • lemon/lp.h

    r1134 r1092  
    2323
    2424
    25 #if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_
     25#ifdef LEMON_HAVE_GLPK
    2626#include <lemon/glpk.h>
    27 #endif
    28 #if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_
     27#elif LEMON_HAVE_CPLEX
    2928#include <lemon/cplex.h>
    30 #endif
    31 #if LEMON_DEFAULT_LP == LEMON_SOPLEX_
     29#elif LEMON_HAVE_SOPLEX
    3230#include <lemon/soplex.h>
    33 #endif
    34 #if LEMON_DEFAULT_LP == LEMON_CLP_
     31#elif LEMON_HAVE_CLP
    3532#include <lemon/clp.h>
    36 #endif
    37 #if LEMON_DEFAULT_MIP == LEMON_CBC_
    38 #include <lemon/cbc.h>
    3933#endif
    4034
     
    5044  ///\ingroup lp_group
    5145  ///
    52   ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_,
    53   ///\c LEMON_SOPLEX_ or \c LEMON_CLP_
     46  ///Currently, the possible values are \c GLPK, \c CPLEX,
     47  ///\c SOPLEX or \c CLP
    5448#define LEMON_DEFAULT_LP SOLVER
    5549  ///The default LP solver
     
    6660  ///\ingroup lp_group
    6761  ///
    68   ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_
    69   ///or \c LEMON_CBC_
     62  ///Currently, the possible values are \c GLPK, \c CPLEX or \c CBC
    7063#define LEMON_DEFAULT_MIP SOLVER
    7164  ///The default MIP solver.
     
    7770  typedef GlpkMip Mip;
    7871#else
    79 #if LEMON_DEFAULT_LP == LEMON_GLPK_
     72#if LEMON_DEFAULT_LP == GLPK
    8073  typedef GlpkLp Lp;
    81 #elif LEMON_DEFAULT_LP == LEMON_CPLEX_
     74#elif LEMON_DEFAULT_LP == CPLEX
    8275  typedef CplexLp Lp;
    83 #elif LEMON_DEFAULT_LP == LEMON_SOPLEX_
     76#elif LEMON_DEFAULT_LP == SOPLEX
    8477  typedef SoplexLp Lp;
    85 #elif LEMON_DEFAULT_LP == LEMON_CLP_
     78#elif LEMON_DEFAULT_LP == CLP
    8679  typedef ClpLp Lp;
    8780#endif
    88 #if LEMON_DEFAULT_MIP == LEMON_GLPK_
    89   typedef GlpkMip Mip;
    90 #elif LEMON_DEFAULT_MIP == LEMON_CPLEX_
     81#if LEMON_DEFAULT_MIP == GLPK
     82  typedef GlpkLp Mip;
     83#elif LEMON_DEFAULT_MIP == CPLEX
    9184  typedef CplexMip Mip;
    92 #elif LEMON_DEFAULT_MIP == LEMON_CBC_
     85#elif LEMON_DEFAULT_MIP == CBC
    9386  typedef CbcMip Mip;
    9487#endif
  • lemon/math.h

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

    r1093 r1092  
    165165    ///
    166166    /// This function instantiates a \ref CardinalityMap.
    167     /// \param digraph is the digraph, to which we would like to
    168     /// define the \ref CardinalityMap
     167    /// \param digraph is the digraph, to which we would like to define the \ref
     168    /// CardinalityMap
    169169    static CardinalityMap *createCardinalityMap(const Digraph &digraph) {
    170170      return new CardinalityMap(digraph);
     
    181181  /// Search algorithm. The maximum cardinality search first chooses any
    182182  /// node of the digraph. Then every time it chooses one unprocessed node
    183   /// with maximum cardinality, i.e the sum of capacities on out arcs
    184   /// to the nodes
     183  /// with maximum cardinality, i.e the sum of capacities on out arcs to the nodes
    185184  /// which were previusly processed.
    186185  /// If there is a cut in the digraph the algorithm should choose
  • lemon/nearest_neighbor_tsp.h

    r1101 r1092  
    116116            for (IncEdgeIt e(_gr, n1); e != INVALID; ++e) {
    117117              if (!used[_gr.runningNode(e)] &&
    118                   (min_edge1 == INVALID || _cost[e] < _cost[min_edge1])) {
     118                  (_cost[e] < _cost[min_edge1] || min_edge1 == INVALID)) {
    119119                min_edge1 = e;
    120120              }
     
    125125            for (IncEdgeIt e(_gr, n2); e != INVALID; ++e) {
    126126              if (!used[_gr.runningNode(e)] &&
    127                   (min_edge2 == INVALID||_cost[e] < _cost[min_edge2])) {
     127                  (_cost[e] < _cost[min_edge2] || min_edge2 == INVALID)) {
    128128                min_edge2 = e;
    129129              }
  • lemon/network_simplex.h

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

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

    r1134 r584  
    6363#define LEMON_RANDOM_H
    6464
    65 #include <lemon/config.h>
    66 
    6765#include <algorithm>
    6866#include <iterator>
     
    7472#include <lemon/dim2.h>
    7573
    76 #ifndef LEMON_WIN32
     74#ifndef WIN32
    7775#include <sys/time.h>
    7876#include <ctime>
     
    202200        initState(init);
    203201
    204         num = static_cast<int>(length > end - begin ? length : end - begin);
     202        num = length > end - begin ? length : end - begin;
    205203        while (num--) {
    206204          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
     
    216214        }
    217215
    218         num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
     216        num = length - 1; cnt = length - (curr - state) - 1;
    219217        while (num--) {
    220218          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
     
    608606    /// \return Currently always \c true.
    609607    bool seed() {
    610 #ifndef LEMON_WIN32
     608#ifndef WIN32
    611609      if (seedFromFile("/dev/urandom", 0)) return true;
    612610#endif
     
    628626    /// \param offset The offset, from the file read.
    629627    /// \return \c true when the seeding successes.
    630 #ifndef LEMON_WIN32
     628#ifndef WIN32
    631629    bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0)
    632630#else
     
    650648    /// \return Currently always \c true.
    651649    bool seedFromTime() {
    652 #ifndef LEMON_WIN32
     650#ifndef WIN32
    653651      timeval tv;
    654652      gettimeofday(&tv, 0);
  • lemon/static_graph.h

    r1124 r877  
    204204
    205205      node_num = n;
    206       arc_num = static_cast<int>(std::distance(first, last));
     206      arc_num = std::distance(first, last);
    207207
    208208      node_first_out = new int[node_num + 1];
  • lemon/time_measure.h

    r1134 r1092  
    2424///\brief Tools for measuring cpu usage
    2525
    26 #include <lemon/config.h>
    27 
    28 #ifdef LEMON_WIN32
     26#ifdef WIN32
    2927#include <lemon/bits/windows.h>
    3028#else
     
    105103    void stamp()
    106104    {
    107 #ifndef LEMON_WIN32
     105#ifndef WIN32
    108106      timeval tv;
    109107      gettimeofday(&tv, 0);
  • test/arc_look_up_test.cc

    r1113 r1092  
    2525using namespace lemon;
    2626
     27const int lgfn = 4;
    2728const std::string lgf =
    2829  "@nodes\n"
  • test/bpgraph_test.cc

    r1100 r1092  
    7979    e2 = G.addEdge(bn1, rn1),
    8080    e3 = G.addEdge(rn1, bn2);
    81   ::lemon::ignore_unused_variable_warning(e2,e3);
    8281
    8382  checkGraphNodeList(G, 3);
     
    121120    e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3),
    122121    e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3);
    123   ::lemon::ignore_unused_variable_warning(e1,e3,e4);
    124122
    125123  // Check edge deletion
     
    170168    e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3),
    171169    e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3);
    172   ::lemon::ignore_unused_variable_warning(e1,e3,e4);
    173170
    174171  G.changeRed(e2, n4);
     
    223220    e1 = G.addEdge(n1, n2),
    224221    e2 = G.addEdge(n1, n3);
    225   ::lemon::ignore_unused_variable_warning(e1,e2);
    226222
    227223  checkGraphNodeList(G, 3);
     
    309305    e1 = g.addEdge(n1, n2),
    310306    e2 = g.addEdge(n1, n3);
    311   ::lemon::ignore_unused_variable_warning(e2);
    312307
    313308  check(g.valid(n1), "Wrong validity check");
  • test/lp_test.cc

    r1105 r1092  
    4040#endif
    4141
    42 #ifdef LEMON_HAVE_LP
    43 #include <lemon/lp.h>
    44 #endif
    4542using namespace lemon;
    4643
     
    420417  lpTest(lp_skel);
    421418
    422 #ifdef LEMON_HAVE_LP
    423   {
    424     Lp lp,lp2;
    425     lpTest(lp);
    426     aTest(lp2);
    427     cloneTest<Lp>();
    428   }
    429 #endif
    430 
    431419#ifdef LEMON_HAVE_GLPK
    432420  {
  • test/min_cost_flow_test.cc

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

    r1105 r748  
    3131#ifdef LEMON_HAVE_CBC
    3232#include <lemon/cbc.h>
    33 #endif
    34 
    35 #ifdef LEMON_HAVE_MIP
    36 #include <lemon/lp.h>
    3733#endif
    3834
     
    133129{
    134130
    135 #ifdef LEMON_HAVE_MIP
    136   {
    137     Mip mip1;
    138     aTest(mip1);
    139     cloneTest<Mip>();
    140   }
    141 #endif
    142 
    143131#ifdef LEMON_HAVE_GLPK
    144132  {
  • test/radix_sort_test.cc

    r1135 r1092  
    1616 *
    1717 */
    18 
    19 #include <lemon/core.h>
    2018
    2119#include <lemon/time_measure.h>
  • test/tsp_test.cc

    r1106 r1092  
    6767
    6868  int node_cnt = 0;
    69   for (typename Container::const_iterator it = p.begin(); it != p.end(); ++it)
    70     {
    71       FullGraph::Node node = *it;
    72       if (used[node]) return false;
    73       used[node] = true;
    74       ++node_cnt;
    75     }
     69  for (typename Container::const_iterator it = p.begin(); it != p.end(); ++it) {
     70    FullGraph::Node node = *it;
     71    if (used[node]) return false;
     72    used[node] = true;
     73    ++node_cnt;
     74  }
    7675
    7776  return (node_cnt == gr.nodeNum());
     
    133132    int esize = n <= 1 ? 0 : n;
    134133
    135     ConstMap<Edge, int> cost_map(1);
    136     TSP alg(g, cost_map);
     134    TSP alg(g, constMap<Edge, int>(1));
    137135
    138136    check(alg.run() == esize, alg_name + ": Wrong total cost");
     
    267265  tspTestSmall<GreedyTsp<ConstMap<Edge, int> > >("Greedy");
    268266  tspTestSmall<NearestInsertionTsp<ConstMap<Edge, int> > >("Nearest Insertion");
    269   tspTestSmall<FarthestInsertionTsp<ConstMap<Edge, int> > >
    270     ("Farthest Insertion");
    271   tspTestSmall<CheapestInsertionTsp<ConstMap<Edge, int> > >
    272     ("Cheapest Insertion");
     267  tspTestSmall<FarthestInsertionTsp<ConstMap<Edge, int> > >("Farthest Insertion");
     268  tspTestSmall<CheapestInsertionTsp<ConstMap<Edge, int> > >("Cheapest Insertion");
    273269  tspTestSmall<RandomInsertionTsp<ConstMap<Edge, int> > >("Random Insertion");
    274270  tspTestSmall<ChristofidesTsp<ConstMap<Edge, int> > >("Christofides");
  • tools/dimacs-solver.cc

    r1093 r1092  
    128128  if (report) {
    129129    std::cerr << "Run NetworkSimplex: " << ti << "\n\n";
    130     std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" :
    131                                        "not found") << '\n';
     130    std::cerr << "Feasible flow: " << (res == MCF::OPTIMAL ? "found" : "not found") << '\n';
    132131    if (res) std::cerr << "Min flow cost: "
    133132                       << ns.template totalCost<LargeValue>() << '\n';
  • tools/lgf-gen.cc

    r1109 r654  
    247247  struct BeachIt;
    248248
    249   typedef std::multimap<double, BeachIt*> SpikeHeap;
     249  typedef std::multimap<double, BeachIt> SpikeHeap;
    250250
    251251  typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach;
     
    330330
    331331      if (bit->second != spikeheap.end()) {
    332         delete bit->second->second;
    333332        spikeheap.erase(bit->second);
    334333      }
     
    344343          circle_form(points[prev], points[curr], points[site])) {
    345344        double x = circle_point(points[prev], points[curr], points[site]);
    346         pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    347         pit->second->it =
     345        pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
     346        pit->second.it =
    348347          beach.insert(std::make_pair(Part(prev, curr, site), pit));
    349348      } else {
     
    357356          circle_form(points[site], points[curr],points[next])) {
    358357        double x = circle_point(points[site], points[curr], points[next]);
    359         nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    360         nit->second->it =
     358        nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
     359        nit->second.it =
    361360          beach.insert(std::make_pair(Part(site, curr, next), nit));
    362361      } else {
     
    368367      sweep = spit->first;
    369368
    370       Beach::iterator bit = spit->second->it;
     369      Beach::iterator bit = spit->second.it;
    371370
    372371      int prev = bit->first.prev;
     
    401400      int nnt = nbit->first.next;
    402401
    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      
     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
    419406      beach.erase(nbit);
    420407      beach.erase(bit);
     
    426413        double x = circle_point(points[ppv], points[prev], points[next]);
    427414        if (x < sweep) x = sweep;
    428         pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    429         pit->second->it =
     415        pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
     416        pit->second.it =
    430417          beach.insert(std::make_pair(Part(ppv, prev, next), pit));
    431418      } else {
     
    438425        double x = circle_point(points[prev], points[next], points[nnt]);
    439426        if (x < sweep) x = sweep;
    440         nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    441         nit->second->it =
     427        nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
     428        nit->second.it =
    442429          beach.insert(std::make_pair(Part(prev, next, nnt), nit));
    443430      } else {
Note: See TracChangeset for help on using the changeset viewer.