12 #include "../stdafx.h"
13 #include "../core/pool_func.hpp"
14 #include "../window_func.h"
18 #include "../safeguards.h"
46 for (NodeID node_id = 0; node_id < this->
Size(); ++node_id) {
47 (*this)[node_id].Flows().erase(from);
75 if (this->
thread != NULL) {
96 uint size = this->
Size();
97 for (NodeID node_id = 0; node_id < size; ++node_id) {
98 Node from = (*this)[node_id];
110 if (ge.
link_graph != this->link_graph.index || ge.
node != node_id) {
119 if (from[it->first].Flow() == 0)
continue;
120 StationID to = (*this)[it->first].Station();
124 (*lg)[node_id][it->first].LastUpdate() ==
INVALID_DATE) {
131 }
else if ((*lg)[node_id][it->first].LastUnrestrictedUpdate() ==
INVALID_DATE) {
141 for (FlowStatMap::iterator it(ge.
flows.begin()); it != ge.
flows.end();) {
142 FlowStatMap::iterator new_it = flows.find(it->first);
143 if (new_it == flows.end()) {
145 it->second.Invalidate();
148 FlowStat shares(INVALID_STATION, 1);
149 it->second.SwapShares(shares);
150 ge.
flows.erase(it++);
151 for (FlowStat::SharesMap::const_iterator shares_it(shares.
GetShares()->begin());
152 shares_it != shares.
GetShares()->end(); ++shares_it) {
157 it->second.SwapShares(new_it->second);
162 ge.
flows.insert(flows.begin(), flows.end());
174 uint size = this->
Size();
177 for (uint i = 0; i < size; ++i) {
180 for (uint j = 0; j < size; ++j) {
181 node_edges[j].
Init();
203 this->undelivered_supply = supply;
205 new (&this->paths) PathList;
220 this->distance = base->
distance + dist;
221 assert(this->distance > 0);
222 if (this->parent != base) {
227 this->origin = base->
origin;
240 if (this->parent != NULL) {
242 if (max_saturation != UINT_MAX) {
243 uint usable_cap = edge.
Capacity() * max_saturation / 100;
244 if (usable_cap > edge.
Flow()) {
245 new_flow =
min(new_flow, usable_cap - edge.
Flow());
250 new_flow = this->parent->AddFlow(new_flow, job, max_saturation);
251 if (this->flow == 0 && new_flow > 0) {
252 job[this->parent->node].Paths().push_front(
this);
256 this->flow += new_flow;
266 distance(source ? 0 : UINT_MAX),
267 capacity(source ? UINT_MAX : 0),
268 free_capacity(source ? INT_MAX : INT_MIN),
269 flow(0), node(n), origin(source ? n : INVALID_NODE),
270 num_children(0), parent(NULL)