lemon/circulation.h
changeset 437 6a2a33ad261b
parent 417 235be9d4b6ab
child 463 88ed40ad0d4f
equal deleted inserted replaced
2:c29974b8ce22 3:1e7c0e6bb584
   417     ///
   417     ///
   418     /// Returns a const reference to the elevator.
   418     /// Returns a const reference to the elevator.
   419     ///
   419     ///
   420     /// \pre Either \ref run() or \ref init() must be called before
   420     /// \pre Either \ref run() or \ref init() must be called before
   421     /// using this function.
   421     /// using this function.
   422     const Elevator& elevator() {
   422     const Elevator& elevator() const {
   423       return *_level;
   423       return *_level;
   424     }
   424     }
   425 
   425 
   426     /// \brief Sets the tolerance used by algorithm.
   426     /// \brief Sets the tolerance used by algorithm.
   427     ///
   427     ///
   642     ///
   642     ///
   643     /// Returns a const reference to the arc map storing the found flow.
   643     /// Returns a const reference to the arc map storing the found flow.
   644     ///
   644     ///
   645     /// \pre Either \ref run() or \ref init() must be called before
   645     /// \pre Either \ref run() or \ref init() must be called before
   646     /// using this function.
   646     /// using this function.
   647     const FlowMap& flowMap() {
   647     const FlowMap& flowMap() const {
   648       return *_flow;
   648       return *_flow;
   649     }
   649     }
   650 
   650 
   651     /**
   651     /**
   652        \brief Returns \c true if the given node is in a barrier.
   652        \brief Returns \c true if the given node is in a barrier.
   667        using this function.
   667        using this function.
   668 
   668 
   669        \sa barrierMap()
   669        \sa barrierMap()
   670        \sa checkBarrier()
   670        \sa checkBarrier()
   671     */
   671     */
   672     bool barrier(const Node& node)
   672     bool barrier(const Node& node) const
   673     {
   673     {
   674       return (*_level)[node] >= _el;
   674       return (*_level)[node] >= _el;
   675     }
   675     }
   676 
   676 
   677     /// \brief Gives back a barrier.
   677     /// \brief Gives back a barrier.
   690     /// using this function.
   690     /// using this function.
   691     ///
   691     ///
   692     /// \sa barrier()
   692     /// \sa barrier()
   693     /// \sa checkBarrier()
   693     /// \sa checkBarrier()
   694     template<class BarrierMap>
   694     template<class BarrierMap>
   695     void barrierMap(BarrierMap &bar)
   695     void barrierMap(BarrierMap &bar) const
   696     {
   696     {
   697       for(NodeIt n(_g);n!=INVALID;++n)
   697       for(NodeIt n(_g);n!=INVALID;++n)
   698         bar.set(n, (*_level)[n] >= _el);
   698         bar.set(n, (*_level)[n] >= _el);
   699     }
   699     }
   700 
   700 
   710 
   710 
   711     ///Check if the found flow is a feasible circulation
   711     ///Check if the found flow is a feasible circulation
   712 
   712 
   713     ///Check if the found flow is a feasible circulation,
   713     ///Check if the found flow is a feasible circulation,
   714     ///
   714     ///
   715     bool checkFlow() {
   715     bool checkFlow() const {
   716       for(ArcIt e(_g);e!=INVALID;++e)
   716       for(ArcIt e(_g);e!=INVALID;++e)
   717         if((*_flow)[e]<(*_lo)[e]||(*_flow)[e]>(*_up)[e]) return false;
   717         if((*_flow)[e]<(*_lo)[e]||(*_flow)[e]>(*_up)[e]) return false;
   718       for(NodeIt n(_g);n!=INVALID;++n)
   718       for(NodeIt n(_g);n!=INVALID;++n)
   719         {
   719         {
   720           Value dif=-(*_delta)[n];
   720           Value dif=-(*_delta)[n];
   728     ///Check whether or not the last execution provides a barrier
   728     ///Check whether or not the last execution provides a barrier
   729 
   729 
   730     ///Check whether or not the last execution provides a barrier.
   730     ///Check whether or not the last execution provides a barrier.
   731     ///\sa barrier()
   731     ///\sa barrier()
   732     ///\sa barrierMap()
   732     ///\sa barrierMap()
   733     bool checkBarrier()
   733     bool checkBarrier() const
   734     {
   734     {
   735       Value delta=0;
   735       Value delta=0;
   736       for(NodeIt n(_g);n!=INVALID;++n)
   736       for(NodeIt n(_g);n!=INVALID;++n)
   737         if(barrier(n))
   737         if(barrier(n))
   738           delta-=(*_delta)[n];
   738           delta-=(*_delta)[n];