Scaler for symmetric distribution. More...
#include <demands.h>
Public Member Functions | |
SymmetricScaler (uint mod_size) | |
void | AddNode (const Node &node) |
Count a node's supply into the sum of supplies. | |
void | SetDemandPerNode (uint num_demands) |
Calculate the mean demand per node using the sum of supplies. | |
uint | EffectiveSupply (const Node &from, const Node &to) |
Get the effective supply of one node towards another one. | |
bool | HasDemandLeft (Node &to, NodeAnnotation &to_anno) |
Check if there is any acceptance left for this node. | |
void | SetDemands (LinkGraphJob *job, NodeID from, NodeID to, uint demand_forw) |
Set the demands between two nodes using the given base demand. | |
Private Attributes | |
uint | mod_size |
Size modifier. Determines how much demands increase with the supply of the remote station. | |
uint | supply_sum |
Sum of all supplies in the component. |
Scaler for symmetric distribution.
Definition at line 25 of file demands.h.
void SymmetricScaler::AddNode | ( | const Node & | node | ) | [inline] |
Count a node's supply into the sum of supplies.
node | Node. |
Definition at line 33 of file demands.h.
References Node::supply, and supply_sum.
Get the effective supply of one node towards another one.
In symmetric distribution the supply of the other node is weighed in.
from | The supplying node. | |
to | The receiving node. |
Definition at line 54 of file demands.h.
References max(), and Node::supply.
bool SymmetricScaler::HasDemandLeft | ( | Node & | to, | |
NodeAnnotation & | to_anno | |||
) | [inline] |
Check if there is any acceptance left for this node.
In symmetric distribution nodes only accept anything if they also supply something. So if undelivered_supply == 0 at the node there isn't any demand left either.
to | Node to be checked. | |
to_anno | Annotation to get undelivered_suppy from. |
Definition at line 66 of file demands.h.
References Node::demand, Node::supply, and NodeAnnotation::undelivered_supply.
void SymmetricScaler::SetDemandPerNode | ( | uint | num_demands | ) | [inline] |
Calculate the mean demand per node using the sum of supplies.
num_demands | Number of accepting nodes. |
Definition at line 42 of file demands.h.
References Scaler::demand_per_node, max(), and supply_sum.
void SymmetricScaler::SetDemands | ( | LinkGraphJob * | job, | |
NodeID | from_id, | |||
NodeID | to_id, | |||
uint | demand_forw | |||
) |
Set the demands between two nodes using the given base demand.
In symmetric mode this sets demands in both directions.
job | The link graph job. | |
from_id | The supplying node. @þaram to_id The receiving node. | |
demand_forw | Demand calculated for the "forward" direction. |
Reimplemented from Scaler.
Definition at line 22 of file demands.cpp.
References Node::demand, LinkGraphJob::GetNode(), LinkGraph::GetNode(), LinkGraphJob::Graph(), max(), mod_size, and NodeAnnotation::undelivered_supply.