Пример #1
0
        private void ProbabilityDependencyAnalysis()
        {
            Console.Write("Please enter the number of vertecies (Default = 24): ");

            if (!int.TryParse(Console.ReadLine(), out this.initialVertexes))
            {
                this.initialVertexes = 24;
            }

            Console.Write("Please enter the number of realization (Default = 1): ");

            if (!int.TryParse(Console.ReadLine(), out this.realizations))
            {
                this.realizations = 1;
            }

            Bounds <double, double> bounds = this.GetProbabilityBounds();

            Dictionary <double, ICollection <double> > allResults = new Dictionary <double, ICollection <double> >();

            for (var start = bounds.InitialValue; start <= bounds.MaxValue; start += bounds.Step)
            {
                var networks = new ERNetwork[this.realizations];
                var results  = new double[this.realizations];

                allResults[start] = results;

                var prob = start;
                Parallel.For(0, this.realizations, new ParallelOptions {
                    MaxDegreeOfParallelism = this.parallel
                }, i =>
                {
                    var param = new Dictionary <GenerationParameter, object>
                    {
                        { GenerationParameter.Probability, prob },
                        { GenerationParameter.Vertices, this.initialVertexes }
                    };

                    networks[i] = (ERNetwork)AbstractNetwork.CreateNetworkByType(ModelType.ER, $"Prob_{prob}_Run_{i}",
                                                                                 ResearchType.Basic, GenerationType.Random, new Dictionary <ResearchParameter, object> {
                    }, param, AnalyzeOption.Degeneracy, ContainerMode.Fast);

                    networks[i].Generate();

                    networks[i].Analyze();

                    results[i] = (double)networks[i].NetworkResult.Result[AnalyzeOption.Degeneracy];
                });
            }

            this.SaveProbResearchResult(allResults);
            Console.WriteLine("Research is completed. You can start other experiment or close app.");
            Console.WriteLine();
        }
Пример #2
0
 public void Init()
 {
     network = new ERNetwork(500, 2000);
 }