internal void Update(Population population)
        {
            lblGenValue.Text = population.Generation.ToString();
            lblBestValue.Text = population.FitnessStats.Best.ToString();
            lblWorstValue.Text = population.FitnessStats.Worst.ToString();
            lblAvgValue.Text = Math.Round(population.FitnessStats.Average, 2).ToString("0.00");

            lblLastBest.Text = string.Format("({0})", population.FitnessStats.PreviousGenerationsBest.LastOrDefault());
            lblLastWorst.Text = string.Format("({0})", population.FitnessStats.PreviousGenerationsWorst.LastOrDefault());
            lblLastAvg.Text = string.Format("({0:0.00})", Math.Round(population.FitnessStats.PreviousGenerationsAverage.LastOrDefault(), 2));
        }
        public void Setup()
        {
            var weightCount = getNewBrain(SimpleSweeper.BrainInputs, SimpleSweeper.BrainOutputs).AllWeightsCount();

            Population = new Population(new GeneticAlgorithm(Settings));
            Population.Populate(Settings.SweeperCount, weightCount);

            _sweepers = createSweepers(Settings.SweeperCount).ToList();
            for (int i = 0; i < _sweepers.Count; i++)
            {
                _sweepers[i].Brain.UpdateGenome(Population.Genomes[i]);
            }

            _mines.AddRange(getMines(Settings.MineCount));
        }
        public void Update(Population population)
        {
            Image = new Bitmap(Width, Height);
            var avgpoints = getGraphPoints(population.FitnessStats.PreviousGenerationsAverage);
            var bestpoints = getGraphPoints(population.FitnessStats.PreviousGenerationsBest);
            var worstpoints = getGraphPoints(population.FitnessStats.PreviousGenerationsWorst);

            var graphHeight = (float)Height - 10;
            var maxHeight = bestpoints.Max(x => x.Y);
            var graphWidth = (float)(Width - 10);
            var maxWidth = bestpoints.Count();
            var yScale = graphHeight / maxHeight;
            var xScale = graphWidth / maxWidth;

            using (var graphics = Graphics.FromImage(Image))
            {
                if (avgpoints.Count() > 1)
                {
                    drawGrid(graphics, population.FitnessStats.PreviousGenerationsBest.Max(), avgpoints, yScale, xScale);

                    using (var neutralPen = new Pen(_neutralColor))
                    {
                        drawGraphLine(graphics, avgpoints, neutralPen, yScale, xScale);
                    }
                    using (var bestPen = new Pen(_bestColor))
                    {
                        drawGraphLine(graphics, bestpoints, bestPen, yScale, xScale);
                    }
                    using (var worstPen = new Pen(_worstColor))
                    {
                        drawGraphLine(graphics, worstpoints, worstPen, yScale, xScale);
                    }
                }
            }
            Image.RotateFlip(RotateFlipType.RotateNoneFlipY);
        }
        public void Setup()
        {
            _sweepers = createSweepers(Settings.SweeperCount).ToList();

            Population = new Population(new GeneticAlgorithm(Settings));
            Population.Populate(_sweepers.Select(x => x.Brain.Genome));

            createNewObjects();
        }
        public void Setup()
        {
            _sweepers = createSweepers(Settings.SweeperCount - 1).ToList();

            Population = new Population(new GeneticAlgorithm(Settings));
            Population.Populate(_sweepers.Select(x => x.Brain.Genome));

            Population.Genomes.Add(new EliteSweeper2070Genome());

            _mines.AddRange(getMines(Settings.MineCount));
        }