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)
| 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. |
no test coverage detected