MCPcopy Create free account
hub / github.com/akeranen/the-one / updateTransitivePreds

Method updateTransitivePreds

routing/ProphetRouter.java:143–161  ·  view source on GitHub ↗

Updates transitive (A->B->C) delivery predictions. P(a,c) = P(a,c)_old + (1 - P(a,c)_old) P(a,b) P(b,c) BETA @param host The B host who we just met

(DTNHost host)

Source from the content-addressed store, hash-verified

141 * @param host The B host who we just met
142 */
143 private void updateTransitivePreds(DTNHost host) {
144 MessageRouter otherRouter = host.getRouter();
145 assert otherRouter instanceof ProphetRouter : "PRoPHET only works " +
146 " with other routers of same type";
147
148 double pForHost = getPredFor(host); // P(a,b)
149 Map<DTNHost, Double> othersPreds =
150 ((ProphetRouter)otherRouter).getDeliveryPreds();
151
152 for (Map.Entry<DTNHost, Double> e : othersPreds.entrySet()) {
153 if (e.getKey() == getHost()) {
154 continue; // don't add yourself
155 }
156
157 double pOld = getPredFor(e.getKey()); // P(a,c)_old
158 double pNew = pOld + ( 1 - pOld) * pForHost * e.getValue() * beta;
159 preds.put(e.getKey(), pNew);
160 }
161 }
162
163 /**
164 * Ages all entries in the delivery predictions.

Callers 1

changedConnectionMethod · 0.95

Calls 7

getPredForMethod · 0.95
getRouterMethod · 0.80
getKeyMethod · 0.80
getValueMethod · 0.80
getDeliveryPredsMethod · 0.45
getHostMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected