0
3
0
| ... | ... |
@@ -66,4 +66,4 @@ |
| 66 | 66 |
|
| 67 |
/// \brief The type of the flow values. |
|
| 68 |
typedef typename SupplyMap::Value Flow; |
|
| 67 |
/// \brief The type of the flow and supply values. |
|
| 68 |
typedef typename SupplyMap::Value Value; |
|
| 69 | 69 |
|
| ... | ... |
@@ -74,3 +74,3 @@ |
| 74 | 74 |
/// concept. |
| 75 |
typedef typename Digraph::template ArcMap< |
|
| 75 |
typedef typename Digraph::template ArcMap<Value> FlowMap; |
|
| 76 | 76 |
|
| ... | ... |
@@ -106,3 +106,3 @@ |
| 106 | 106 |
/// The tolerance used by the algorithm to handle inexact computation. |
| 107 |
typedef lemon::Tolerance< |
|
| 107 |
typedef lemon::Tolerance<Value> Tolerance; |
|
| 108 | 108 |
|
| ... | ... |
@@ -189,4 +189,4 @@ |
| 189 | 189 |
typedef typename Traits::Digraph Digraph; |
| 190 |
///The type of the flow values. |
|
| 191 |
typedef typename Traits::Flow Flow; |
|
| 190 |
///The type of the flow and supply values. |
|
| 191 |
typedef typename Traits::Value Value; |
|
| 192 | 192 |
|
| ... | ... |
@@ -223,3 +223,3 @@ |
| 223 | 223 |
|
| 224 |
typedef typename Digraph::template NodeMap< |
|
| 224 |
typedef typename Digraph::template NodeMap<Value> ExcessMap; |
|
| 225 | 225 |
ExcessMap* _excess; |
| ... | ... |
@@ -532,3 +532,3 @@ |
| 532 | 532 |
} else {
|
| 533 |
|
|
| 533 |
Value fc = -(*_excess)[_g.target(e)]; |
|
| 534 | 534 |
_flow->set(e, fc); |
| ... | ... |
@@ -565,3 +565,3 @@ |
| 565 | 565 |
int mlevel=_node_num; |
| 566 |
|
|
| 566 |
Value exc=(*_excess)[act]; |
|
| 567 | 567 |
|
| ... | ... |
@@ -569,3 +569,3 @@ |
| 569 | 569 |
Node v = _g.target(e); |
| 570 |
|
|
| 570 |
Value fc=(*_up)[e]-(*_flow)[e]; |
|
| 571 | 571 |
if(!_tol.positive(fc)) continue; |
| ... | ... |
@@ -593,3 +593,3 @@ |
| 593 | 593 |
Node v = _g.source(e); |
| 594 |
|
|
| 594 |
Value fc=(*_flow)[e]-(*_lo)[e]; |
|
| 595 | 595 |
if(!_tol.positive(fc)) continue; |
| ... | ... |
@@ -663,5 +663,5 @@ |
| 663 | 663 |
|
| 664 |
/// \brief Returns the flow on the given arc. |
|
| 664 |
/// \brief Returns the flow value on the given arc. |
|
| 665 | 665 |
/// |
| 666 |
/// Returns the flow on the given arc. |
|
| 666 |
/// Returns the flow value on the given arc. |
|
| 667 | 667 |
/// |
| ... | ... |
@@ -669,3 +669,3 @@ |
| 669 | 669 |
/// using this function. |
| 670 |
|
|
| 670 |
Value flow(const Arc& arc) const {
|
|
| 671 | 671 |
return (*_flow)[arc]; |
| ... | ... |
@@ -752,3 +752,3 @@ |
| 752 | 752 |
{
|
| 753 |
|
|
| 753 |
Value dif=-(*_supply)[n]; |
|
| 754 | 754 |
for(InArcIt e(_g,n);e!=INVALID;++e) dif-=(*_flow)[e]; |
| ... | ... |
@@ -767,6 +767,6 @@ |
| 767 | 767 |
{
|
| 768 |
Flow delta=0; |
|
| 769 |
Flow inf_cap = std::numeric_limits<Flow>::has_infinity ? |
|
| 770 |
std::numeric_limits<Flow>::infinity() : |
|
| 771 |
std::numeric_limits<Flow>::max(); |
|
| 768 |
Value delta=0; |
|
| 769 |
Value inf_cap = std::numeric_limits<Value>::has_infinity ? |
|
| 770 |
std::numeric_limits<Value>::infinity() : |
|
| 771 |
std::numeric_limits<Value>::max(); |
|
| 772 | 772 |
for(NodeIt n(_g);n!=INVALID;++n) |
| ... | ... |
@@ -58,6 +58,6 @@ |
| 58 | 58 |
/// \tparam GR The digraph type the algorithm runs on. |
| 59 |
/// \tparam |
|
| 59 |
/// \tparam V The value type used for flow amounts, capacity bounds |
|
| 60 | 60 |
/// and supply values in the algorithm. By default it is \c int. |
| 61 | 61 |
/// \tparam C The value type used for costs and potentials in the |
| 62 |
/// algorithm. By default it is the same as \c |
|
| 62 |
/// algorithm. By default it is the same as \c V. |
|
| 63 | 63 |
/// |
| ... | ... |
@@ -69,3 +69,3 @@ |
| 69 | 69 |
/// by default. For more information see \ref PivotRule. |
| 70 |
template <typename GR, typename |
|
| 70 |
template <typename GR, typename V = int, typename C = V> |
|
| 71 | 71 |
class NetworkSimplex |
| ... | ... |
@@ -75,3 +75,3 @@ |
| 75 | 75 |
/// The flow type of the algorithm |
| 76 |
typedef |
|
| 76 |
typedef V Value; |
|
| 77 | 77 |
/// The cost type of the algorithm |
| ... | ... |
@@ -80,3 +80,3 @@ |
| 80 | 80 |
/// The type of the flow map |
| 81 |
typedef GR::ArcMap< |
|
| 81 |
typedef GR::ArcMap<Value> FlowMap; |
|
| 82 | 82 |
/// The type of the potential map |
| ... | ... |
@@ -85,3 +85,3 @@ |
| 85 | 85 |
/// The type of the flow map |
| 86 |
typedef typename GR::template ArcMap< |
|
| 86 |
typedef typename GR::template ArcMap<Value> FlowMap; |
|
| 87 | 87 |
/// The type of the potential map |
| ... | ... |
@@ -208,5 +208,5 @@ |
| 208 | 208 |
|
| 209 |
typedef typename GR::template ArcMap< |
|
| 209 |
typedef typename GR::template ArcMap<Value> ValueArcMap; |
|
| 210 | 210 |
typedef typename GR::template ArcMap<Cost> CostArcMap; |
| 211 |
typedef typename GR::template NodeMap< |
|
| 211 |
typedef typename GR::template NodeMap<Value> ValueNodeMap; |
|
| 212 | 212 |
|
| ... | ... |
@@ -216,3 +216,3 @@ |
| 216 | 216 |
typedef std::vector<bool> BoolVector; |
| 217 |
typedef std::vector< |
|
| 217 |
typedef std::vector<Value> FlowVector; |
|
| 218 | 218 |
typedef std::vector<Cost> CostVector; |
| ... | ... |
@@ -234,12 +234,12 @@ |
| 234 | 234 |
// Parameters of the problem |
| 235 |
FlowArcMap *_plower; |
|
| 236 |
FlowArcMap *_pupper; |
|
| 235 |
ValueArcMap *_plower; |
|
| 236 |
ValueArcMap *_pupper; |
|
| 237 | 237 |
CostArcMap *_pcost; |
| 238 |
|
|
| 238 |
ValueNodeMap *_psupply; |
|
| 239 | 239 |
bool _pstsup; |
| 240 | 240 |
Node _psource, _ptarget; |
| 241 |
|
|
| 241 |
Value _pstflow; |
|
| 242 | 242 |
SupplyType _stype; |
| 243 | 243 |
|
| 244 |
|
|
| 244 |
Value _sum_supply; |
|
| 245 | 245 |
|
| ... | ... |
@@ -280,3 +280,3 @@ |
| 280 | 280 |
int stem, par_stem, new_stem; |
| 281 |
|
|
| 281 |
Value delta; |
|
| 282 | 282 |
|
| ... | ... |
@@ -287,5 +287,5 @@ |
| 287 | 287 |
/// Constant for infinite upper bounds (capacities). |
| 288 |
/// It is \c std::numeric_limits<Flow>::infinity() if available, |
|
| 289 |
/// \c std::numeric_limits<Flow>::max() otherwise. |
|
| 290 |
|
|
| 288 |
/// It is \c std::numeric_limits<Value>::infinity() if available, |
|
| 289 |
/// \c std::numeric_limits<Value>::max() otherwise. |
|
| 290 |
const Value INF; |
|
| 291 | 291 |
|
| ... | ... |
@@ -697,8 +697,8 @@ |
| 697 | 697 |
_node_id(graph), |
| 698 |
INF(std::numeric_limits<Flow>::has_infinity ? |
|
| 699 |
std::numeric_limits<Flow>::infinity() : |
|
| 700 |
|
|
| 698 |
INF(std::numeric_limits<Value>::has_infinity ? |
|
| 699 |
std::numeric_limits<Value>::infinity() : |
|
| 700 |
std::numeric_limits<Value>::max()) |
|
| 701 | 701 |
{
|
| 702 | 702 |
// Check the value types |
| 703 |
LEMON_ASSERT(std::numeric_limits< |
|
| 703 |
LEMON_ASSERT(std::numeric_limits<Value>::is_signed, |
|
| 704 | 704 |
"The flow type of NetworkSimplex must be signed"); |
| ... | ... |
@@ -727,3 +727,3 @@ |
| 727 | 727 |
/// \param map An arc map storing the lower bounds. |
| 728 |
/// Its \c Value type must be convertible to the \c |
|
| 728 |
/// Its \c Value type must be convertible to the \c Value type |
|
| 729 | 729 |
/// of the algorithm. |
| ... | ... |
@@ -734,3 +734,3 @@ |
| 734 | 734 |
delete _plower; |
| 735 |
_plower = new |
|
| 735 |
_plower = new ValueArcMap(_graph); |
|
| 736 | 736 |
for (ArcIt a(_graph); a != INVALID; ++a) {
|
| ... | ... |
@@ -749,3 +749,3 @@ |
| 749 | 749 |
/// \param map An arc map storing the upper bounds. |
| 750 |
/// Its \c Value type must be convertible to the \c |
|
| 750 |
/// Its \c Value type must be convertible to the \c Value type |
|
| 751 | 751 |
/// of the algorithm. |
| ... | ... |
@@ -756,3 +756,3 @@ |
| 756 | 756 |
delete _pupper; |
| 757 |
_pupper = new |
|
| 757 |
_pupper = new ValueArcMap(_graph); |
|
| 758 | 758 |
for (ArcIt a(_graph); a != INVALID; ++a) {
|
| ... | ... |
@@ -792,3 +792,3 @@ |
| 792 | 792 |
/// \param map A node map storing the supply values. |
| 793 |
/// Its \c Value type must be convertible to the \c |
|
| 793 |
/// Its \c Value type must be convertible to the \c Value type |
|
| 794 | 794 |
/// of the algorithm. |
| ... | ... |
@@ -800,3 +800,3 @@ |
| 800 | 800 |
_pstsup = false; |
| 801 |
_psupply = new |
|
| 801 |
_psupply = new ValueNodeMap(_graph); |
|
| 802 | 802 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| ... | ... |
@@ -825,3 +825,3 @@ |
| 825 | 825 |
/// \return <tt>(*this)</tt> |
| 826 |
NetworkSimplex& stSupply(const Node& s, const Node& t, |
|
| 826 |
NetworkSimplex& stSupply(const Node& s, const Node& t, Value k) {
|
|
| 827 | 827 |
delete _psupply; |
| ... | ... |
@@ -1027,3 +1027,3 @@ |
| 1027 | 1027 |
/// \pre \ref run() must be called before using this function. |
| 1028 |
|
|
| 1028 |
Value flow(const Arc& a) const {
|
|
| 1029 | 1029 |
return (*_flow_map)[a]; |
| ... | ... |
@@ -1206,3 +1206,3 @@ |
| 1206 | 1206 |
for (int i = 0; i != _arc_num; ++i) {
|
| 1207 |
|
|
| 1207 |
Value c = (*_plower)[_arc_ref[i]]; |
|
| 1208 | 1208 |
if (c > 0) {
|
| ... | ... |
@@ -1277,3 +1277,3 @@ |
| 1277 | 1277 |
int result = 0; |
| 1278 |
|
|
| 1278 |
Value d; |
|
| 1279 | 1279 |
int e; |
| ... | ... |
@@ -1317,3 +1317,3 @@ |
| 1317 | 1317 |
if (delta > 0) {
|
| 1318 |
|
|
| 1318 |
Value val = _state[in_arc] * delta; |
|
| 1319 | 1319 |
_flow[in_arc] += val; |
| ... | ... |
@@ -48,3 +48,3 @@ |
| 48 | 48 |
/// \brief The type of the flow values. |
| 49 |
typedef typename CapacityMap::Value |
|
| 49 |
typedef typename CapacityMap::Value Value; |
|
| 50 | 50 |
|
| ... | ... |
@@ -54,3 +54,3 @@ |
| 54 | 54 |
/// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 55 |
typedef typename Digraph::template ArcMap< |
|
| 55 |
typedef typename Digraph::template ArcMap<Value> FlowMap; |
|
| 56 | 56 |
|
| ... | ... |
@@ -86,3 +86,3 @@ |
| 86 | 86 |
/// The tolerance used by the algorithm to handle inexact computation. |
| 87 |
typedef lemon::Tolerance< |
|
| 87 |
typedef lemon::Tolerance<Value> Tolerance; |
|
| 88 | 88 |
|
| ... | ... |
@@ -127,3 +127,3 @@ |
| 127 | 127 |
///The type of the flow values. |
| 128 |
typedef typename Traits:: |
|
| 128 |
typedef typename Traits::Value Value; |
|
| 129 | 129 |
|
| ... | ... |
@@ -153,3 +153,3 @@ |
| 153 | 153 |
|
| 154 |
typedef typename Digraph::template NodeMap< |
|
| 154 |
typedef typename Digraph::template NodeMap<Value> ExcessMap; |
|
| 155 | 155 |
ExcessMap* _excess; |
| ... | ... |
@@ -472,3 +472,3 @@ |
| 472 | 472 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| 473 |
|
|
| 473 |
Value excess = 0; |
|
| 474 | 474 |
for (InArcIt e(_graph, n); e != INVALID; ++e) {
|
| ... | ... |
@@ -521,3 +521,3 @@ |
| 521 | 521 |
for (OutArcIt e(_graph, _source); e != INVALID; ++e) {
|
| 522 |
|
|
| 522 |
Value rem = (*_capacity)[e] - (*_flow)[e]; |
|
| 523 | 523 |
if (_tolerance.positive(rem)) {
|
| ... | ... |
@@ -533,3 +533,3 @@ |
| 533 | 533 |
for (InArcIt e(_graph, _source); e != INVALID; ++e) {
|
| 534 |
|
|
| 534 |
Value rem = (*_flow)[e]; |
|
| 535 | 535 |
if (_tolerance.positive(rem)) {
|
| ... | ... |
@@ -566,3 +566,3 @@ |
| 566 | 566 |
while (num > 0 && n != INVALID) {
|
| 567 |
|
|
| 567 |
Value excess = (*_excess)[n]; |
|
| 568 | 568 |
int new_level = _level->maxLevel(); |
| ... | ... |
@@ -570,3 +570,3 @@ |
| 570 | 570 |
for (OutArcIt e(_graph, n); e != INVALID; ++e) {
|
| 571 |
|
|
| 571 |
Value rem = (*_capacity)[e] - (*_flow)[e]; |
|
| 572 | 572 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -593,3 +593,3 @@ |
| 593 | 593 |
for (InArcIt e(_graph, n); e != INVALID; ++e) {
|
| 594 |
|
|
| 594 |
Value rem = (*_flow)[e]; |
|
| 595 | 595 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -639,3 +639,3 @@ |
| 639 | 639 |
while (num > 0 && n != INVALID) {
|
| 640 |
|
|
| 640 |
Value excess = (*_excess)[n]; |
|
| 641 | 641 |
int new_level = _level->maxLevel(); |
| ... | ... |
@@ -643,3 +643,3 @@ |
| 643 | 643 |
for (OutArcIt e(_graph, n); e != INVALID; ++e) {
|
| 644 |
|
|
| 644 |
Value rem = (*_capacity)[e] - (*_flow)[e]; |
|
| 645 | 645 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -666,3 +666,3 @@ |
| 666 | 666 |
for (InArcIt e(_graph, n); e != INVALID; ++e) {
|
| 667 |
|
|
| 667 |
Value rem = (*_flow)[e]; |
|
| 668 | 668 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -780,3 +780,3 @@ |
| 780 | 780 |
while ((n = _level->highestActive()) != INVALID) {
|
| 781 |
|
|
| 781 |
Value excess = (*_excess)[n]; |
|
| 782 | 782 |
int level = _level->highestActiveLevel(); |
| ... | ... |
@@ -785,3 +785,3 @@ |
| 785 | 785 |
for (OutArcIt e(_graph, n); e != INVALID; ++e) {
|
| 786 |
|
|
| 786 |
Value rem = (*_capacity)[e] - (*_flow)[e]; |
|
| 787 | 787 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -808,3 +808,3 @@ |
| 808 | 808 |
for (InArcIt e(_graph, n); e != INVALID; ++e) {
|
| 809 |
|
|
| 809 |
Value rem = (*_flow)[e]; |
|
| 810 | 810 |
if (!_tolerance.positive(rem)) continue; |
| ... | ... |
@@ -899,3 +899,3 @@ |
| 899 | 899 |
/// using this function. |
| 900 |
|
|
| 900 |
Value flowValue() const {
|
|
| 901 | 901 |
return (*_excess)[_target]; |
| ... | ... |
@@ -903,5 +903,5 @@ |
| 903 | 903 |
|
| 904 |
/// \brief Returns the flow on the given arc. |
|
| 904 |
/// \brief Returns the flow value on the given arc. |
|
| 905 | 905 |
/// |
| 906 |
/// Returns the flow on the given arc. This method can |
|
| 906 |
/// Returns the flow value on the given arc. This method can |
|
| 907 | 907 |
/// be called after the second phase of the algorithm. |
| ... | ... |
@@ -910,3 +910,3 @@ |
| 910 | 910 |
/// using this function. |
| 911 |
|
|
| 911 |
Value flow(const Arc& arc) const {
|
|
| 912 | 912 |
return (*_flow)[arc]; |
0 comments (0 inline)