- double bandwidth_bound = -1.0;
- if (sg_weight_S_parameter > 0)
- for (auto const& link : route)
- action->weight_ += sg_weight_S_parameter / link->bandwidth();
-
- for (auto const& link : route) {
- double bb = bandwidthFactor(size) * link->bandwidth();
- bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
+ if (sg_weight_S_parameter > 0) {
+ action->weight_ =
+ std::accumulate(route.begin(), route.end(), action->weight_, [](double total, LinkImpl* const& link) {
+ return total + sg_weight_S_parameter / link->bandwidth();
+ });