COIN-OR::LEMON - Graph Library

Changeset 814:11c946fa8d13 in lemon for lemon/howard.h


Ignore:
Timestamp:
08/11/09 22:52:35 (10 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Simplify comparisons in min mean cycle classes (#179)
using extreme INF values instead of bool flags.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/howard.h

    r811 r814  
    179179    Tolerance _tolerance;
    180180 
     181    // Infinite constant
     182    const LargeValue INF;
     183
    181184  public:
    182185 
     
    231234    Howard( const Digraph &digraph,
    232235            const LengthMap &length ) :
    233       _gr(digraph), _length(length), _cycle_path(NULL), _local_path(false),
     236      _gr(digraph), _length(length), _best_found(false),
     237      _best_length(0), _best_size(1), _cycle_path(NULL), _local_path(false),
    234238      _policy(digraph), _reached(digraph), _level(digraph), _dist(digraph),
    235       _comp(digraph), _in_arcs(digraph)
     239      _comp(digraph), _in_arcs(digraph),
     240      INF(std::numeric_limits<LargeValue>::has_infinity ?
     241          std::numeric_limits<LargeValue>::infinity() :
     242          std::numeric_limits<LargeValue>::max())
    236243    {}
    237244
     
    308315        }
    309316        // Update the best cycle (global minimum mean cycle)
    310         if ( !_best_found || (_curr_found &&
     317        if ( _curr_found && (!_best_found ||
    311318             _curr_length * _best_size < _best_length * _curr_size) ) {
    312319          _best_found = true;
     
    447454      }
    448455      for (int i = 0; i < int(_nodes->size()); ++i) {
    449         _dist[(*_nodes)[i]] = std::numeric_limits<LargeValue>::max();
     456        _dist[(*_nodes)[i]] = INF;
    450457      }
    451458      Node u, v;
Note: See TracChangeset for help on using the changeset viewer.