equal
deleted
inserted
replaced
279 template <typename LowerMap> |
279 template <typename LowerMap> |
280 CycleCanceling& lowerMap(const LowerMap& map) { |
280 CycleCanceling& lowerMap(const LowerMap& map) { |
281 _have_lower = true; |
281 _have_lower = true; |
282 for (ArcIt a(_graph); a != INVALID; ++a) { |
282 for (ArcIt a(_graph); a != INVALID; ++a) { |
283 _lower[_arc_idf[a]] = map[a]; |
283 _lower[_arc_idf[a]] = map[a]; |
284 _lower[_arc_idb[a]] = map[a]; |
|
285 } |
284 } |
286 return *this; |
285 return *this; |
287 } |
286 } |
288 |
287 |
289 /// \brief Set the upper bounds (capacities) on the arcs. |
288 /// \brief Set the upper bounds (capacities) on the arcs. |
782 } |
781 } |
783 |
782 |
784 return OPTIMAL; |
783 return OPTIMAL; |
785 } |
784 } |
786 |
785 |
787 // Check if the upper bound is greater or equal to the lower bound |
786 // Check if the upper bound is greater than or equal to the lower bound |
788 // on each arc. |
787 // on each forward arc. |
789 bool checkBoundMaps() { |
788 bool checkBoundMaps() { |
790 for (int j = 0; j != _res_arc_num; ++j) { |
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 return true; |
792 return true; |
794 } |
793 } |
795 |
794 |
796 // Build a StaticDigraph structure containing the current |
795 // Build a StaticDigraph structure containing the current |
836 |
835 |
837 // Handle non-zero lower bounds |
836 // Handle non-zero lower bounds |
838 if (_have_lower) { |
837 if (_have_lower) { |
839 int limit = _first_out[_root]; |
838 int limit = _first_out[_root]; |
840 for (int j = 0; j != limit; ++j) { |
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 } |
844 } |
843 } |
845 |
844 |
846 // Execute the "Simple Cycle Canceling" method |
845 // Execute the "Simple Cycle Canceling" method |