routing代码分析1--ProphetRouter
来源:互联网 发布:运营数据分析专员 编辑:程序博客网 时间:2024/05/24 05:49
Implementation of PRoPHET router as described in
* <I>Probabilistic routing in intermittently connected networks</I> by
* Anders Lindgren et al
原理
outline
public class ProphetRouter extends ActiveRouter
重要属性:
P_INIT = 0.75 //delivery predictability initialization constant交付预测初始常量
DEFAULT_BETA = 0.25 //delivery predictability transitivity scaling constant default value 交付预测传输缩放默认值
GAMMA = 0.98 //delivery predictability aging constant交付预测衰减常量
SECONDS_IN_UNIT_S ="secondsInTimeUnit" //Number of seconds in time unit在一个时间单位中有多少秒(当计算交付预测时)
BETA_S = "beta" //Transitivity scaling constant传输缩放常量 (默认值为0.25)
变量
secondsInTimeUnit //the value of nrof seconds in time unit在一个时间单位内秒数的值
beta //value of beta setting(beta设置的值)
private Map<DTNHost, Double> preds //交付预测
lastAgeUpdate //last delivery predictability update (sim)time(上一次交付预测的仿真更新时间)
方法
构造方法
public ProphetRouter(Settings s){} //根据setting文件建立新的信息路由
super(s); //建立新的信息路由,读取设置中的缓存大小,TTL,主机上的application
//设置此路由的名称
获得可配置参数SECONDS_IN_UNIT_S,beta
initPreds(); // 初始化预测哈希表
protected ProphetRouter(ProphetRouter r){} //构造方法的重载
initPreds() {}//初始化预测哈希表
changedConnection(Connection con){} // 覆写,当连接状态变化时被调用
updateDeliveryPredFor(otherHost);
updateTransitivePreds(otherHost); //当与其他主机连接时,更新
updateDeliveryPredFor(DTNHost host){} //为主机更新交付预测
oldValue = getPredFor(host); //返回当前交付预测p的值
newValue = oldValue + (1 - oldValue) * P_INIT
getPredFor(DTNHost host){} //返回当前交付预测p的值,若没有,返回0
ageDeliveryPreds(); //Ages all entries in the delivery predictions
updateTransitivePreds(DTNHost host){} //更新传递交付预测(A->B->C)
//注:PRoPHET only works with other routers of same type
pForHost = getPredFor(host); // P(a,b)
pOld = getPredFor(e.getKey()); // P(a,c)_old
pNew = pOld + ( 1 - pOld) * pForHost * e.getValue() * beta;
ageDeliveryPreds(){} //衰减交付预测中的记录
timeDiff = (SimClock.getTime() - this.lastAgeUpdate) / secondsInTimeUnit;
mult = Math.pow(GAMMA, timeDiff) ;
e.setValue(e.getValue()*mult)
getDeliveryPreds(){} //返回路由的交付预测
update(){} //Checks out all sending connections to finalize the ready ones and abort those whose connection went down. Also drops messages whose TTL <= 0 (checking every one simulated minute).
tryOtherMessages(){} // Tries to send all other messages to all connected hosts ordered by their delivery probability 返回tryMessagesForConnected(List)
//for all connected hosts collect all messages that have a higher probability of delivery by the other host
if (othRouter.getPredFor(m.getTo()) > getPredFor(m.getTo())) {// the other node has higher probability of delivery
messages.add(new Tuple<Message, Connection>(m,con));}
private class TupleComparator implements Comparator <Tuple<Message, Connection>>{} //Comparator for Message-Connection-Tuples that orders the tuples by their delivery probability by the host on the other side of the connection (GRTRMax)
public RoutingInfo getRoutingInfo(){} //Returns routing information about this router
public MessageRouter replicate(){} //Creates a replicate of this router. The replicate has the same settings as this router but empty buffers and routing tables.
0 0
- routing代码分析1--ProphetRouter
- routing包中的类及代码分析
- ONE源代码分析——router之Prophetrouter
- Rails源代码分析(30):ActionController::Routing(1)
- Routing
- Routing
- Routing
- OSPF inter-area routing (1)
- ASP.NET WebAPI - Routing 1
- Rails源代码分析(31):ActionController::Routing(2) PolymorphicRoutes
- Rails源代码分析(32):ActionController::Routing(3) RouteSet
- Rails源代码分析(33):ActionController::Routing(4) Builder
- Rails源代码分析(34):ActionController::Routing(5) Route
- Rails源代码分析(35):ActionController::Routing(6) Segment
- Rails源代码分析(36):ActionController::Routing(7) Optimisation
- Rails源代码分析(37):ActionController::Routing(8) Recognition Optimisation
- Rails源代码分析(38):ActionController::Routing(9) 总结
- ASP.NET MVC 1.0 - 2. 流程分析 (System.Web.Routing)
- Linux查看用户登陆历史记录(last命令的使用)
- UIButton总结
- Nginx初探
- mysql 查询某表的外键关系
- python网络编程socketserver
- routing代码分析1--ProphetRouter
- js-dom树2(删除,复制,替换节点)
- git命令
- 深入理解Java:注解(Annotation)--注解处理器
- 怎样连接SQL Server Local DB
- 0106—mybatis单独配置
- 带色彩恢复的视网膜增强算法实现 (MATLAB版本)
- 梯度下降法 matlab
- CentOS源码编译安装Haproxy