// compute the probabilities of the links in the routing table, // using the utilizations of the links on the ring. *operation* void compute_probabilities(RoutingTable* rtable, Ring* ring) *traverse* *from* ProbAlg *to* {Priority} *wrapper* Priority (@ rtable->compute_priority_probabilities(ring); @) // this is the standard priority algorithm used for the computation // of the probabilities. *operation* void compute_priority_probabilities(Ring* ring) *traverse* *from* RoutingTable *through* -> *, dag, *, -> *, neighbors, * *to* DagNeighbor *carry* *in* VNode* source_vnode = (@ get_source() @), *inout* double all_product = (@ 1.0 @), *inout* double part_product = (@ 1.0 @), *inout* double all_sum = (@ 0.0 @), *in* VNode* next_default_vnode *along* *from* DagAdjacency *through* -> *, neighbors, * *to* DagNeighbor *wrapper* DagAdjacency (@ VirtualAdjacency* adj = ring->find(get_source()); next_default_vnode = ring->get_nextdefault(adj)->get_source(); compute_all_product_sum(ring, all_product, all_sum); @) *wrapper* DagNeighbor (@ double util = ring->get_utilization(source_vnode, get_neighbor()); double prob; if (all_sum) prob = (1.0 - util) * part_product + all_product * ((1.0 - util) / all_sum); else if (get_neighbor() == next_default_vnode) prob = 1.0; // always follow the default link else prob = 0.0; this->get_prob()->set_val(prob); part_product *= util; @) // find the product of the utilizations of all the neighbors of the // DAG adjacency and also compute the sum of (1-util) for all neighbors. *operation* void compute_all_product_sum(Ring* ring, double& product, double& sum) *traverse* *from* DagAdjacency *through* -> *, neighbors, * *to-stop* VNode *carry* *in* VNode* source_vnode = (@ get_source() @) *along* *from* DagAdjacency *through* -> *, neighbors, * *to-stop* VNode *wrapper* VNode (@ double util = ring->get_utilization(source_vnode, this); product *= util; sum += (1.0 - util); @)