Exemple #1
0
        // TODO check //
        private void FillEigenDistanceDistributionResults(AnalyzeOption option, RealizationResult result)
        {
            Debug.Assert(option == AnalyzeOption.EigenDistanceDistribution);
            Debug.Assert(result.Result[option] is SortedDictionary <Double, Double>);
            SortedDictionary <Double, Double> d = result.Result[option] as SortedDictionary <Double, Double>;

            if (!Result.ContainsKey(option))
            {
                Result.Add(option, new SortedDictionary <Double, Double>());
            }
            Debug.Assert(Result[option] is SortedDictionary <Double, Double>);
            SortedDictionary <Double, Double> temp = Result[option] as SortedDictionary <Double, Double>;

            foreach (KeyValuePair <double, double> k in d)
            {
                if (temp.ContainsKey(k.Key))
                {
                    temp[k.Key] = CalculateNextAverageValue(temp[k.Key], k.Value);
                }
                else
                {
                    temp.Add(k.Key, k.Value);
                }
            }
        }
        private bool Check(AnalyzeOption o, RealizationResult rn, ResearchResult rr)
        {
            Debug.Assert(rn.Result.ContainsKey(o));
            Debug.Assert(rn.Result[o] != null);
            Debug.Assert(rr.EnsembleResults.Count() > 0);
            if (!rr.EnsembleResults[0].Result.ContainsKey(o))
                return true;
            Debug.Assert(rr.EnsembleResults[0].Result[o] != null);

            AnalyzeOptionInfo[] info = (AnalyzeOptionInfo[])o.GetType().GetField(o.ToString()).GetCustomAttributes(typeof(AnalyzeOptionInfo), false);
            OptionType ot = info[0].OptionType;
            switch (ot)
            {
                case OptionType.Global:
                    Double v1 = Convert.ToDouble(rn.Result[o]);
                    Double v2 = Convert.ToDouble(rr.EnsembleResults[0].Result[o]);
                    return Math.Round(v1, 4) == v2;
                case OptionType.Distribution:
                case OptionType.Trajectory:
                    Debug.Assert(rn.Result[o] is SortedDictionary<Double, Double>);
                    Debug.Assert(rr.EnsembleResults[0].Result[o] is SortedDictionary<Double, Double>);
                    SortedDictionary<Double, Double> d1 = rn.Result[o] as SortedDictionary<Double, Double>;
                    SortedDictionary<Double, Double> d2 = rr.EnsembleResults[0].Result[o] as SortedDictionary<Double, Double>;
                    return CheckDictionary(d1, d2);
                default:
                    Debug.Assert(false);
                    break;
            }

            return true;
        }
Exemple #3
0
 // TODO check //
 private void FillDoubleResults(AnalyzeOption option, RealizationResult result)
 {
     if (!Result.ContainsKey(option))
     {
         Result.Add(option, 0.0);
     }
     Result[option] = CalculateNextAverageValue((Double)Result[option],
                                                (Double)result.Result[option]);
 }
        public AbstractNetwork(String rName,
            Dictionary<ResearchParameter, object> rParams,
            Dictionary<GenerationParameter, object> genParams,
            AnalyzeOption AnalyzeOptions)
        {
            ResearchName = rName;
            ResearchParameterValues = rParams;
            GenerationParameterValues = genParams;
            this.AnalyzeOptions = AnalyzeOptions;

            NetworkResult = new RealizationResult();
        }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="r"></param>
        public void AddRealizationResult(RealizationResult r)
        {
            EdgesCount = CalculateNextAverageValue(EdgesCount, r.EdgesCount);

            foreach (AnalyzeOption option in r.Result.Keys)
            {
                AnalyzeOptionInfo[] info = (AnalyzeOptionInfo[])option.GetType().GetField(option.ToString()).GetCustomAttributes(typeof(AnalyzeOptionInfo), false);
                OptionType          ot   = info[0].OptionType;

                #region EIGENVALUES
                if (option == AnalyzeOption.EigenValues)
                {
                    FillEigenValuesResults(option, r);
                    continue;
                }
                else if (option == AnalyzeOption.EigenDistanceDistribution)
                {
                    FillEigenDistanceDistributionResults(option, r);
                    continue;
                }
                #endregion

                Debug.Assert(option != AnalyzeOption.EigenValues && option != AnalyzeOption.EigenDistanceDistribution);
                switch (ot)
                {
                case OptionType.Global:
                    FillDoubleResults(option, r);
                    break;

                case OptionType.ValueList:
                case OptionType.Centrality:
                    FillListResults(option, r);
                    break;

                case OptionType.Distribution:
                case OptionType.Trajectory:
                    FillDictionaryResults(option, r);
                    break;

                default: { break; }
                }
            }

            ++realizationCount;
        }
Exemple #6
0
        // TODO check //
        private void FillEigenValuesResults(AnalyzeOption option, RealizationResult result)
        {
            Debug.Assert(option == AnalyzeOption.EigenValues);
            Debug.Assert(result.Result[option] is List <Double>);
            List <Double> e = result.Result[option] as List <Double>;

            if (!Result.ContainsKey(option))
            {
                Result.Add(option, new List <Double>());
            }
            Debug.Assert(result.Result[option] is List <Double>);
            List <Double> temp = result.Result[option] as List <Double>;

            foreach (Double k in e)
            {
                temp.Add(k);
            }
        }
Exemple #7
0
        // TODO check //
        private void FillListResults(AnalyzeOption option, RealizationResult result)
        {
            if (!Result.ContainsKey(option))
            {
                Result.Add(option, new List <Double>());
            }
            Debug.Assert(Result[option] is List <Double>);
            List <Double> temp = Result[option] as List <Double>;

            Debug.Assert(result.Result[option] is List <Double>);
            List <Double> l = result.Result[option] as List <Double>;

            for (int j = 0; j < l.Count; ++j)
            {
                if (j < temp.Count())
                {
                    temp[j] = CalculateNextAverageValue(temp[j], l[j]);
                }
                else
                {
                    temp.Add(l[j]);
                }
            }
        }