コード例 #1
0
        private void RenderPopulation()
        {
            var points = new float[_population.CurrentPopulation.Count, _population.Dimensions + 1];

            for (var i = 0; i < _population.CurrentPopulation.Count; i++)
            {
                var individual = _population.CurrentPopulation[i];
                points[i, 0] = (float)individual.Position[0];
                points[i, 1] = (float)individual.Position[1];
                points[i, 2] = (float)individual.Cost + 1000; // render point higher then function
            }

            if (_points != null)
            {
                _plotCube.Remove(_points);
                _points.Dispose();
            }

            _points       = new ILPoints();
            _points.Color = Color.White;
            _points.Positions.Update(points);
            _plotCube.Add(_points);

            RenderBestIndividual();
            renderContainer.Refresh();
        }
コード例 #2
0
        private void RenderBestIndividual()
        {
            var best      = _population.BestIndividual;
            var bestPoint = new[] { (float)best.Position[0], (float)best.Position[1], (float)best.Cost + 1500 }; // render point higher then function and other points

            if (_bestPoint != null)
            {
                _plotCube.Remove(_bestPoint);
                _bestPoint.Dispose();
            }

            _bestPoint = new ILPoints {
                Color = Color.BlueViolet
            };
            _bestPoint.Positions.Update(bestPoint);

            _plotCube.Add(_bestPoint);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: daywee/BIA
        private void RenderAdditionalPoints()
        {
            var points = new float[_population.AdditionalIndividualsToRender.Count, _population.Dimensions + 1];

            for (var i = 0; i < _population.AdditionalIndividualsToRender.Count; i++)
            {
                var individual = _population.AdditionalIndividualsToRender[i];
                points[i, 0] = (float)individual[0];
                points[i, 1] = (float)individual[1];
                points[i, 2] = (float)individual.Cost + 1000; // render point higher then function
            }

            if (_additionalPoints != null)
            {
                _plotCube.Remove(_additionalPoints);
                _additionalPoints.Dispose();
            }

            _additionalPoints       = new ILPoints();
            _additionalPoints.Color = Color.Yellow;
            _additionalPoints.Positions.Update(points);
            _plotCube.Add(_additionalPoints);
        }