Exemple #1
0
 /// <summary>
 /// Handles a MSGClusterQuery message
 /// </summary>
 /// <param name="message"></param>
 private void handleMSGClusterQuery(MSGClusterQuery message)
 {
     if (message.CID == CID || message.RID != RID || KnownClusters.Contains(message.CID))
         return;
     //Console.WriteLine( QoS + "\t" + msg.GetType().FullName + "\t" + DateTime.Now);
     double _ProposedValue = calculateValue(message);
     if (_ProposedValue >= Value)
     {
         Value = _ProposedValue;
         CID = message.CID;
         KnownClusters.Add(CID);
         SIDMeasurement = message.Data;
         HCSID = message.HC;
         SID = message.CID;
         ClusterStarter = false;
         transmit(new MSGClusterQuery(Info.ID, MessageTargets.ALL_IN_RANGE, SIDMeasurement, RID, CID, HCSID + 1, estimateDEG(message)));
     }
 }
Exemple #2
0
 /// <summary>
 /// Estimates the average degree in a cluster
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 private double estimateDEG(MSGClusterQuery message)
 {
     return lambda * message.DEG + (1 - lambda) * Neighbors.Count;
 }
Exemple #3
0
 /// <summary>
 /// Gets an estimation over the size of a cluster
 /// </summary>
 /// <param name="message">The message containing the negotiation data stuff</param>
 /// <returns>The estimated cluster size</returns>
 private double getClusterSizeEstimation(MSGClusterQuery message)
 {
     //Overlapping paper, Eq. (5)
     return estimateDEG(message) * Math.Pow(message.HC, 2);
 }
Exemple #4
0
 /// <summary>
 /// Calculates the possible Value for the node if it joins the cluster
 /// </summary>
 /// <param name="message">The message containing the negotiation stuff</param>
 /// <returns>The possible new node value</returns>
 private double calculateValue(MSGClusterQuery message)
 {
     double _accuracy = getDataChange(message.Data);
     return (getClusterSizeEstimation(message) - 1) * _accuracy;
 }