Ejemplo n.º 1
0
 /// <summary>
 /// Primary Constructor
 /// </summary>
 /// <param name="cluster">An EventCollection representing a cluster</param>
 /// <param name="clusterid">The ID of the cluster</param>
 public ClusterAnalysis(EventCollection cluster, int clusterid)
 {
     Cluster      = cluster;
     ClusterID    = clusterid;
     DropAnalysis = new DropAnalysis(Cluster);
     FailAnalysis = new FailAnalysis(Cluster);
 }
 /// <summary>
 /// Primary Constructor
 /// </summary>
 /// <param name="cluster">An EventCollection representing a cluster</param>
 /// <param name="clusterid">The ID of the cluster</param>
 public ClusterAnalysis(EventCollection cluster, int clusterid)
 {
     Cluster = cluster;
       ClusterID = clusterid;
       DropAnalysis = new DropAnalysis(Cluster);
       FailAnalysis = new FailAnalysis(Cluster);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This method will produce a JSON object that contains all the data from
        /// the current instance. Only focusing upon drop events, this method will
        /// firstly group the events by the start RAT only, and then by the start
        /// and end RAT values.
        /// </summary>
        /// <returns>A well formed JSON string</returns>
        public String CreateDropRATJSON()
        {
            // Create a new JSONResults Data Structure
            JSONResults json = new JSONResults(WeekNumber);

            // Loop over all clusters in this week
            foreach (KeyValuePair <int, ClusterAnalysis> pair in ClustersAnalysis)
            {
                // Get the Drop Analysis object
                DropAnalysis analysis = pair.Value.DropAnalysis;
                // Used to stores the split up events
                List <String>             keys   = analysis.GroupByStartRat().Keys.ToList();
                AnalysisResultsCollection groups = new AnalysisResultsCollection(keys);
                // Get the Analysis result
                AnalysisResults results = analysis.GroupByStartEndRat();
                // Loop over each result
                foreach (KeyValuePair <String, EventCollection> p in results)
                {
                    // Calculate the Key
                    String key = p.Value[0].StartRat;
                    // Add into the array
                    groups[key].Add(p.Key, p.Value);
                }
                // Add the RAT goup to the JSONResults Data Structure
                json.Add(pair.Key, groups);
            }
            // return the JSON data structure for this week
            return(json.ToString());
        }
        public void Initialise()
        {
            // Create a new KML Reader
              KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");

              // Read in all call logs
              EventCollection collection = reader.GetCallLogs();

              // Cluster the call logs
              DBSCAN scan = new DBSCAN(collection);
              scan.Analyse();

              // Initialise the cluster
              Cluster = new EventCollection(scan.Clusters.OrderBy(col => col.Count).Last());

              // Initialise the Cluster analysis
              Analysis = new DropAnalysis(Cluster);
        }