示例#1
0
 public MODPhenomemon(MODPhenomemonType type, int nodeId, double time, Packet pkg)
 {
     this.type = type;
     this.nodeId = nodeId;
     this.start = this.end = time;
     this.pkg = pkg;
 }
示例#2
0
 public MODPhenomemon(MODPhenomemonType type, int nodeId, double start, double end, Packet pkg)
 {
     this.type = type;
     this.nodeId = nodeId;
     this.start = start;
     this.end = end;
     this.pkg = pkg;
 }
示例#3
0
 static double ConditionHappened(HashSet<MODPhenomemon> observedPhenomemons, MODPhenomemonType type, int node,
     double starttime, double endtime, MODPhenomemon p1, ComparePhenomemon comparer)
 {
     foreach (MODPhenomemon p in observedPhenomemons)
     {
         if (p.nodeId == node && p.type == type
             && p.start >= starttime && p.end <= endtime
             && comparer(p1, p))
         {
             return p.likehood;
         }
     }
     return global.SmallValue;
 }
示例#4
0
 static double ConditionHappened(HashSet<MODPhenomemon> observedPhenomemons, MODPhenomemonType type, int node,
     double starttime, double endtime, MODPhenomemon p1, List<MODPhenomemon> list, ComparePhenomemon comparer)
 {
     double likehood = global.SmallValue;
     foreach (MODPhenomemon p in observedPhenomemons)
     {
         if (p.nodeId == node && p.type == type
             && p.start >= starttime && p.end <= endtime
             && comparer(p1, p))
         {
             list.Add(p);
             likehood = Math.Max(p.likehood, likehood);
         }
     }
     return likehood;
 }
示例#5
0
 static double ConditionHappened(HashSet<MODPhenomemon> observedPhenomemons, MODPhenomemonType type, int node, double starttime, double endtime, Packet pkg)
 {
     foreach (MODPhenomemon p in observedPhenomemons)
     {
         if (p.nodeId == node && p.type == type
             && p.start >= starttime && p.end <= endtime
             && Packet.IsSamePacket(p.pkg, pkg))
             return p.likehood;
     }
     return global.SmallValue;
 }
示例#6
0
 static double ConditionHappened(HashSet<MODPhenomemon> observedPhenomemons, MODPhenomemonType type, int node, double time)
 {
     foreach (MODPhenomemon p in observedPhenomemons)
     {
         if (p.nodeId == node && p.type == type && Utility.DoubleEqual(p.start, time))
             return p.likehood;
     }
     return global.SmallValue;
 }
示例#7
0
 static double ConditionHappened(HashSet<MODPhenomemon> observedPhenomemons, MODPhenomemonType type, int node, double starttime, double endtime)
 {
     foreach (MODPhenomemon p in observedPhenomemons)
     {
         if (p.nodeId == node && p.type == type
             && p.start >= starttime && p.end <= endtime)
             return p.likehood;
     }
     if (type == MODPhenomemonType.DIST_FAR)//如果计算节点距离的可能性,且不在邻居中,则说明该节点很远,可能性为很大
         return 0.8;
     else
         return global.SmallValue;
 }
示例#8
0
 public MODPhenomemon(MODPhenomemonType type, int nodeId)
 {
     this.type = type;
     this.nodeId = nodeId;
     this.start = this.end = Scheduler.getInstance().currentTime;
 }