12 #include "../stdafx.h"
13 #include "../core/pool_func.hpp"
14 #include "../window_func.h"
18 #include "../safeguards.h"
53 for (NodeID node_id = 0; node_id < this->
Size(); ++node_id) {
54 (*this)[node_id].Flows().erase(from);
82 if (this->
thread != NULL) {
103 uint size = this->
Size();
104 for (NodeID node_id = 0; node_id < size; ++node_id) {
105 Node from = (*this)[node_id];
117 if (ge.
link_graph != this->link_graph.index || ge.
node != node_id) {
126 if (from[it->first].Flow() == 0)
continue;
127 StationID to = (*this)[it->first].Station();
131 (*lg)[node_id][it->first].LastUpdate() ==
INVALID_DATE) {
138 }
else if ((*lg)[node_id][it->first].LastUnrestrictedUpdate() ==
INVALID_DATE) {
148 for (FlowStatMap::iterator it(ge.
flows.begin()); it != ge.
flows.end();) {
149 FlowStatMap::iterator new_it = flows.find(it->first);
150 if (new_it == flows.end()) {
152 it->second.Invalidate();
155 FlowStat shares(INVALID_STATION, 1);
156 it->second.SwapShares(shares);
157 ge.
flows.erase(it++);
158 for (FlowStat::SharesMap::const_iterator shares_it(shares.
GetShares()->begin());
159 shares_it != shares.
GetShares()->end(); ++shares_it) {
164 it->second.SwapShares(new_it->second);
169 ge.
flows.insert(flows.begin(), flows.end());
181 uint size = this->
Size();
184 for (uint i = 0; i < size; ++i) {
187 for (uint j = 0; j < size; ++j) {
188 node_edges[j].
Init();
210 this->undelivered_supply = supply;
212 new (&this->paths) PathList;
227 this->distance = base->
distance + dist;
228 assert(this->distance > 0);
229 if (this->parent != base) {
234 this->origin = base->
origin;
247 if (this->parent != NULL) {
249 if (max_saturation != UINT_MAX) {
250 uint usable_cap = edge.
Capacity() * max_saturation / 100;
251 if (usable_cap > edge.
Flow()) {
252 new_flow =
min(new_flow, usable_cap - edge.
Flow());
257 new_flow = this->parent->AddFlow(new_flow, job, max_saturation);
258 if (this->flow == 0 && new_flow > 0) {
259 job[this->parent->node].Paths().push_front(
this);
263 this->flow += new_flow;
273 distance(source ? 0 : UINT_MAX),
274 capacity(source ? UINT_MAX : 0),
275 free_capacity(source ? INT_MAX : INT_MIN),
276 flow(0), node(n), origin(source ? n : INVALID_NODE),
277 num_children(0), parent(NULL)