Esempio n. 1
0
	/**
	 * 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.
	 * @param to Node to be checked.
	 * @return If demand is left.
	 */
	inline bool HasDemandLeft(const Node &to)
	{
		return (to.Supply() == 0 || to.UndeliveredSupply() > 0) && to.Demand() > 0;
	}
Esempio n. 2
0
	/**
	 * Get the effective supply of one node towards another one. In asymmetric
	 * distribution the demand of the other node is weighed in.
	 * @param from The supplying node.
	 * @param to The receiving node.
	 */
	inline uint EffectiveSupply(const Node &from, const Node &to)
	{
		return max(from.Supply() * to.Demand() / this->demand_per_node, (uint)1);
	}
Esempio n. 3
0
	/**
	 * Check if there is any acceptance left for this node. In asymmetric distribution
	 * nodes always accept as long as their demand > 0.
	 * @param to The node to be checked.
	 * @param to_anno Unused.
	 */
	inline bool HasDemandLeft(const Node &to) { return to.Demand() > 0; }
Esempio n. 4
0
	/**
	 * Count a node's demand into the sum of demands.
	 * @param node The node to be counted.
	 */
	inline void AddNode(const Node &node)
	{
		this->demand_sum += node.Demand();
	}