Пример #1
0
        private void btnPopulation_Click(object sender, EventArgs e)
        {
            if (popSize.Value == 0)
            {
                return;
            }
            var population = new Individuals();

            population.GeneratePopulation((int)popSize.Value, _benchmark.GetById((int)comboFunctions.SelectedValue), _integer, (float)genMin.Value, (float)genMax.Value);
            //population.ComputeFitness();
            PlotGeneration((int)comboFunctions.SelectedValue, population);
        }
Пример #2
0
        public override Individuals Run(Individuals p, Function f, bool _integer, float?min = null, float?max = null)
        {
            if (min == null)
            {
                min = f.GetMin();
            }
            if (max == null)
            {
                max = f.GetMax();
            }

            Individual best = p.GetBest();

            var result = new Individuals();

            result.Population.Add(best);
            result.GeneratePopulation(p.Population.Count - 1, f, _integer, min, max);
            return(result);
        }
Пример #3
0
        private async void btnRunAlgorithm_Click(object sender, EventArgs e)
        {
            if (popSize.Value == 0)
            {
                return;
            }
            var population = new Individuals();

            population.GeneratePopulation((int)popSize.Value, _benchmark.GetById((int)comboFunctions.SelectedValue), _integer, (float)genMin.Value, (float)genMax.Value);
            population.ComputeFitness();

            for (int i = 0; i < (int)numberOfGenerationsUpDown.Value; i++)
            {
                population = _algorithms.All.FirstOrDefault(a => a.Id == (int)comboAlgorithms.SelectedValue).Run(population, _benchmark.GetById((int)comboFunctions.SelectedValue), _integer, (float)genMin.Value, (float)genMax.Value);
                population.ComputeFitness();
                PlotGeneration((int)comboFunctions.SelectedValue, population);

                await UpdateProgress(i);
            }
        }