lemon/circulation.h
changeset 599 f63e87b9748e
parent 559 c5fd2d996909
child 611 85cb3aa71cce
     1.1 --- a/lemon/circulation.h	Sat Apr 18 21:54:30 2009 +0200
     1.2 +++ b/lemon/circulation.h	Tue Apr 21 10:34:49 2009 +0100
     1.3 @@ -453,13 +453,13 @@
     1.4        createStructures();
     1.5  
     1.6        for(NodeIt n(_g);n!=INVALID;++n) {
     1.7 -        _excess->set(n, (*_delta)[n]);
     1.8 +        (*_excess)[n] = (*_delta)[n];
     1.9        }
    1.10  
    1.11        for (ArcIt e(_g);e!=INVALID;++e) {
    1.12          _flow->set(e, (*_lo)[e]);
    1.13 -        _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_flow)[e]);
    1.14 -        _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_flow)[e]);
    1.15 +        (*_excess)[_g.target(e)] += (*_flow)[e];
    1.16 +        (*_excess)[_g.source(e)] -= (*_flow)[e];
    1.17        }
    1.18  
    1.19        // global relabeling tested, but in general case it provides
    1.20 @@ -482,23 +482,23 @@
    1.21        createStructures();
    1.22  
    1.23        for(NodeIt n(_g);n!=INVALID;++n) {
    1.24 -        _excess->set(n, (*_delta)[n]);
    1.25 +        (*_excess)[n] = (*_delta)[n];
    1.26        }
    1.27  
    1.28        for (ArcIt e(_g);e!=INVALID;++e) {
    1.29          if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
    1.30            _flow->set(e, (*_up)[e]);
    1.31 -          _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_up)[e]);
    1.32 -          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_up)[e]);
    1.33 +          (*_excess)[_g.target(e)] += (*_up)[e];
    1.34 +          (*_excess)[_g.source(e)] -= (*_up)[e];
    1.35          } else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
    1.36            _flow->set(e, (*_lo)[e]);
    1.37 -          _excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_lo)[e]);
    1.38 -          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_lo)[e]);
    1.39 +          (*_excess)[_g.target(e)] += (*_lo)[e];
    1.40 +          (*_excess)[_g.source(e)] -= (*_lo)[e];
    1.41          } else {
    1.42            Value fc = -(*_excess)[_g.target(e)];
    1.43            _flow->set(e, fc);
    1.44 -          _excess->set(_g.target(e), 0);
    1.45 -          _excess->set(_g.source(e), (*_excess)[_g.source(e)] - fc);
    1.46 +          (*_excess)[_g.target(e)] = 0;
    1.47 +          (*_excess)[_g.source(e)] -= fc;
    1.48          }
    1.49        }
    1.50  
    1.51 @@ -537,16 +537,16 @@
    1.52            if((*_level)[v]<actlevel) {
    1.53              if(!_tol.less(fc, exc)) {
    1.54                _flow->set(e, (*_flow)[e] + exc);
    1.55 -              _excess->set(v, (*_excess)[v] + exc);
    1.56 +              (*_excess)[v] += exc;
    1.57                if(!_level->active(v) && _tol.positive((*_excess)[v]))
    1.58                  _level->activate(v);
    1.59 -              _excess->set(act,0);
    1.60 +              (*_excess)[act] = 0;
    1.61                _level->deactivate(act);
    1.62                goto next_l;
    1.63              }
    1.64              else {
    1.65                _flow->set(e, (*_up)[e]);
    1.66 -              _excess->set(v, (*_excess)[v] + fc);
    1.67 +              (*_excess)[v] += fc;
    1.68                if(!_level->active(v) && _tol.positive((*_excess)[v]))
    1.69                  _level->activate(v);
    1.70                exc-=fc;
    1.71 @@ -561,16 +561,16 @@
    1.72            if((*_level)[v]<actlevel) {
    1.73              if(!_tol.less(fc, exc)) {
    1.74                _flow->set(e, (*_flow)[e] - exc);
    1.75 -              _excess->set(v, (*_excess)[v] + exc);
    1.76 +              (*_excess)[v] += exc;
    1.77                if(!_level->active(v) && _tol.positive((*_excess)[v]))
    1.78                  _level->activate(v);
    1.79 -              _excess->set(act,0);
    1.80 +              (*_excess)[act] = 0;
    1.81                _level->deactivate(act);
    1.82                goto next_l;
    1.83              }
    1.84              else {
    1.85                _flow->set(e, (*_lo)[e]);
    1.86 -              _excess->set(v, (*_excess)[v] + fc);
    1.87 +              (*_excess)[v] += fc;
    1.88                if(!_level->active(v) && _tol.positive((*_excess)[v]))
    1.89                  _level->activate(v);
    1.90                exc-=fc;
    1.91 @@ -579,7 +579,7 @@
    1.92            else if((*_level)[v]<mlevel) mlevel=(*_level)[v];
    1.93          }
    1.94  
    1.95 -        _excess->set(act, exc);
    1.96 +        (*_excess)[act] = exc;
    1.97          if(!_tol.positive(exc)) _level->deactivate(act);
    1.98          else if(mlevel==_node_num) {
    1.99            _level->liftHighestActiveToTop();