Public Member Functions | Private Attributes

SymmetricScaler Class Reference

Scaler for symmetric distribution. More...

#include <demands.h>

Inheritance diagram for SymmetricScaler:
Scaler

Public Member Functions

FORCEINLINE SymmetricScaler (uint mod_size)
FORCEINLINE void AddNode (const Node &node)
 count a node's supply into the sum of supplies
FORCEINLINE void SetDemandPerNode (uint num_demands)
 calculate the mean demand per node using the sum of supplies
FORCEINLINE uint EffectiveSupply (const Node &from, const Node &to)
 get the effective supply of one node towards another one.
FORCEINLINE bool DemandLeft (Node &to)
 Check if there is any acceptance left for this node.
void SetDemands (LinkGraphComponent *graph, NodeID from, NodeID to, uint demand_forw)
 Set the demands between two nodes using the given base demand.

Private Attributes

uint mod_size
uint supply_sum

Detailed Description

Scaler for symmetric distribution.

Definition at line 35 of file demands.h.


Member Function Documentation

FORCEINLINE void SymmetricScaler::AddNode ( const Node node  )  [inline]

count a node's supply into the sum of supplies

Parameters:
node the node

Definition at line 43 of file demands.h.

References Node::supply.

FORCEINLINE bool SymmetricScaler::DemandLeft ( Node to  )  [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

Parameters:
to The node to be checked

Definition at line 68 of file demands.h.

References Node::demand, Node::supply, and Node::undelivered_supply.

FORCEINLINE uint SymmetricScaler::EffectiveSupply ( const Node from,
const Node to 
) [inline]

get the effective supply of one node towards another one.

In symmetric distribution the supply of the other node is weighed in.

Parameters:
from The supplying node
to The receiving node
Returns:
the effective supply

Definition at line 59 of file demands.h.

References max(), and Node::supply.

FORCEINLINE void SymmetricScaler::SetDemandPerNode ( uint  num_demands  )  [inline]

calculate the mean demand per node using the sum of supplies

Parameters:
num_demands the number of accepting nodes

Definition at line 49 of file demands.h.

References Scaler::demand_per_node, and max().

void SymmetricScaler::SetDemands ( LinkGraphComponent graph,
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.

Parameters:
graph The link graph
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 30 of file demands.cpp.

References Node::demand, LinkGraphComponent::GetNode(), max(), and Node::undelivered_supply.


The documentation for this class was generated from the following files: