COIN-OR::LEMON - Graph Library

Ticket #266: circ-impr-c20b7ed31aad.patch

File circ-impr-c20b7ed31aad.patch, 1.9 KB (added by Peter Kovacs, 16 years ago)
  • lemon/circulation.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1240656142 -7200
    # Node ID c20b7ed31aad9cd7b491423034cde965044b9986
    # Parent  547e6b876ee16dec1a965c114282dc5be05e75ba
    Bug fix + improvements in Circulation (#266)
    
     - Bug fix in upperMap().
     - Add LEMON_DEBUG checks for lower<=upper.
    
    diff --git a/lemon/circulation.h b/lemon/circulation.h
    a b  
    151151     the direction of the arcs and taking the negative of the supply values
    152152     (e.g. using \ref ReverseDigraph and \ref NegMap adaptors).
    153153
     154     This algorithm either calculates a feasible circulation, or provides
     155     a \ref barrier() "barrier", which prooves that a feasible soultion
     156     cannot exist.
     157
    154158     Note that this algorithm also provides a feasible solution for the
    155159     \ref min_cost_flow "minimum cost flow problem".
    156160
     
    337341
    338342  private:
    339343
     344    bool checkBoundMaps() {
     345      for (ArcIt e(_g);e!=INVALID;++e) {
     346        if (_tol.less((*_up)[e], (*_lo)[e])) return false;
     347      }
     348      return true;
     349    }
     350
    340351    void createStructures() {
    341352      _node_num = _el = countNodes(_g);
    342353
     
    380391
    381392    /// Sets the upper bound (capacity) map.
    382393    /// \return <tt>(*this)</tt>
    383     Circulation& upperMap(const LowerMap& map) {
     394    Circulation& upperMap(const UpperMap& map) {
    384395      _up = &map;
    385396      return *this;
    386397    }
     
    467478    /// to the lower bound.
    468479    void init()
    469480    {
     481      LEMON_DEBUG(checkBoundMaps(),
     482        "Upper bounds must be greater or equal to the lower bounds");
     483
    470484      createStructures();
    471485
    472486      for(NodeIt n(_g);n!=INVALID;++n) {
     
    496510    /// to construct the initial solution.
    497511    void greedyInit()
    498512    {
     513      LEMON_DEBUG(checkBoundMaps(),
     514        "Upper bounds must be greater or equal to the lower bounds");
     515
    499516      createStructures();
    500517
    501518      for(NodeIt n(_g);n!=INVALID;++n) {