Exemplo n.º 1
0
        private void AddNewSeriesExperiment()
        {
            arguments.NetworkKey = NetworkSelectBox.SelectedItem?.ToString();
            experiments.Add(arguments);

            arguments = new ExperimentationParameters()
            {
                IterationsAmount          = arguments.IterationsAmount,
                ExperimentName            = arguments.ExperimentName,
                NetworkKey                = arguments.NetworkKey,
                IsControl                 = false,
                DaysOfImmunity            = arguments.DaysOfImmunity,
                ExperimentAmount          = arguments.ExperimentAmount,
                InfectionChiSquaredFactor = arguments.InfectionChiSquaredFactor,
                RecoveryChiSquaredFactor  = arguments.InfectionChiSquaredFactor,
                VaccinatedRatio           = arguments.VaccinatedRatio,
                VaccineEfficiencyRatio    = arguments.VaccineEfficiencyRatio,
                AtRiskRatio               = arguments.AtRiskRatio
            };

            string[] seriesTextboxLines = new string[experiments.Count() + 1];

            seriesTextboxLines[0] = "Series Ingresadas:";

            for (int i = 0; i < experiments.Count(); i++)
            {
                seriesTextboxLines[i + 1] = $"{experiments[i].ExperimentName}";
            }

            IsControlCheck.Checked = false;
            SeriesListBox.Invoke(new Action(() => SeriesListBox.Lines = seriesTextboxLines));
        }
Exemplo n.º 2
0
        private List <double> ExperimentControlGroup(ExperimentationParameters exp)
        {
            Simulator.SetParameters(exp);

            List <double> averageInfectedPerDay = new List <double>();

            for (int j = 0; j < exp.IterationsAmount; j++)
            {
                averageInfectedPerDay.Add(0);
            }

            for (int ex = 0; ex < exp.ExperimentAmount; ex++)
            {
                Simulator.ResetSimulation();
                Simulator.SetCurrentNetworkSimulation(exp.NetworkKey);
                Simulator.InfectRandomNode();

                for (int j = 0; j < exp.IterationsAmount; j++)
                {
                    Simulator.RunIteration();

                    SimulationProgressBar.Value = CalculateProgress(0, ex, j);
                }

                var iterationInfectedPerDay = Simulator.GetInfectionAmountHistory();

                for (int j = 0; j < exp.IterationsAmount; j++)
                {
                    averageInfectedPerDay[j] += iterationInfectedPerDay[j];
                }
            }

            for (int j = 0; j < exp.IterationsAmount; j++)
            {
                averageInfectedPerDay[j] = (averageInfectedPerDay[j] / exp.ExperimentAmount);
            }

            return(averageInfectedPerDay);
        }
Exemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            arguments = new ExperimentationParameters()
            {
                VaccineEfficiencyRatio = 0.1,
                AtRiskRatio            = 0,
                VaccinatedRatio        = 0,
                ChiSquaredDistributionDegreesOfFreedom = 7,
                InfectionChiSquaredFactor = 4 * 7 / 10,
                RecoveryChiSquaredFactor  = 5 * 3 / 10,
                ChiSquaredRecoveryDistributionDegreesOfFreedom = 7,
                InfectionProbabilities = new List <double>()
                {
                    0.2, 0.2, 0.5, 0.4, 0.35, 0.3, 0.2, 0.2, 0.1, 0.1
                },
                //RecoveryProbabilities = new List<double>() { 0.05, 0.1, 0.25, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 },
                RecoveryProbabilities = new List <double>()
                {
                    0.05, 0.05, 0.1, 0.2, 0.3, 0.45, 0.6, 0.75, 0.9, 1
                },
                DaysOfImmunity = 4
            };
            SeriesListBox.BackColor = Color.YellowGreen;

            NetworkSelectBox.Text = "Seleccione Red";
            NetworkSelectBox.Items.Add("Red Simple");
            NetworkSelectBox.Items.Add("Red Media");
            NetworkSelectBox.Items.Add("Red Grande");
            NetworkSelectBox.Items.Add("Red Gigante");
            NetworkSelectBox.Items.Add("Red Masiva");
            NetworkSelectBox.Items.Add("Red Gargantua");

            _formViewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();

            Simulator = new InfectionSimulator(new SimulatorParameters());

            _formViewer.Graph = Simulator.SetCurrentNetworkSimulation("Red Simple");

            NetworkSelectBox.SelectedItem = "Red Simple";

            _formViewer.ToolBarIsVisible     = false;
            _formViewer.LayoutEditingEnabled = false;
            ////_formViewer.LayoutEditingEnabled = true;
            ////_formViewer.FitGraphBoundingBox();

            //TextBoxAnalysis = ((RichTextBox)this.Controls.Find("AnalysisBox", true).First()).Lines;


            this.SuspendLayout();

            //UpdateAnalysisTextBoxes();

            //_formViewer.MouseClick += GraphPanel_MouseClick;
            _formViewer.Dock = System.Windows.Forms.DockStyle.Fill;

            ////busco panel y agrego el viewer
            var panel = this.Controls.Find("GraphPanel", true).First();

            panel.Dock = DockStyle.Fill;
            panel.Controls.Add(_formViewer);

            //InfectionChart = new Chart();
            //InfectionChart.Series.Clear();

            //var resultsPanel = this.Controls.Find("GraphResultsPanel", true).First();
            //resultsPanel.Controls.Add(InfectionChart);

            //InfectionChart.ChartAreas.Add(new ChartArea());
            //InfectionChart.Legends.Add(new Legend("Infected Per Day"));


            this.ResumeLayout();
        }