コード例 #1
0
ファイル: MainForm.cs プロジェクト: homoluden/SharpNEAT
        private void specieChampFitnessByRankToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SummaryDataSource dsSpecieChampFitnessRank = new SummaryDataSource("Specie Fitness (Champs)", 0, Color.Red, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int specieCount = _ea.SpecieList.Count;
                                        if(null == _specieDataArray || _specieDataArray.Length != specieCount) {
                                            _specieDataArray = new double[specieCount];
                                        }

                                        // Copy specie fitnesses into the data array.
                                        for(int i=0; i<specieCount; i++) {
                                            _specieDataArray[i] = _ea.SpecieList[i].GenomeList[0].EvaluationInfo.Fitness;
                                        }

                                        // Build/create point array.
                                        UpdateRankedDataPoints(_specieDataArray, ref _specieDataPointArray);

                                        // Return plot points.
                                        return _specieDataPointArray;
                                    });

            SummaryDataSource dsSpecieMeanFitnessRank = new SummaryDataSource("Specie Fitness (Means)", 0, Color.Black, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int specieCount = _ea.SpecieList.Count;
                                        if(null == _specieDataArray || _specieDataArray.Length != specieCount) {
                                            _specieDataArray = new double[specieCount];
                                        }

                                        // Copy specie fitnesses into the data array.
                                        for(int i=0; i<specieCount; i++) {
                                            _specieDataArray[i] = _ea.SpecieList[i].CalcMeanFitness();
                                        }

                                        // Build/create point array.
                                        UpdateRankedDataPoints(_specieDataArray, ref _specieDataPointArray);

                                        // Return plot points.
                                        return _specieDataPointArray;
                                    });


            // Create form.
            SummaryGraphForm graphForm = new SummaryGraphForm("Specie Fitness by Rank", "Species", "Fitness", string.Empty,
                                                 new SummaryDataSource[] {dsSpecieChampFitnessRank, dsSpecieMeanFitnessRank}, _ea);
            _summaryGraphFormList.Add(graphForm);

            // Attach a event handler to update this main form when the graph form is closed.
            graphForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs)
            {
                _summaryGraphFormList.Remove(senderObj as SummaryGraphForm);
                specieChampFitnessByRankToolStripMenuItem.Enabled = true;
            });

            // Prevent creating more then one instance fo the form.
            specieChampFitnessByRankToolStripMenuItem.Enabled = false;

            // Show the form.
            graphForm.Show(this);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: homoluden/SharpNEAT
        private void specieSizeByRankToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SummaryDataSource dsSpecieSizeRank = new SummaryDataSource("Specie Size", 0, Color.Red, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int specieCount = _ea.SpecieList.Count;
                                        if(null == _specieDataArrayInt || _specieDataArrayInt.Length != specieCount) {
                                            _specieDataArrayInt = new int[specieCount];
                                        }

                                        // Copy specie sizes into _specieSizeArray.
                                        for(int i=0; i<specieCount; i++) {
                                            _specieDataArrayInt[i] = _ea.SpecieList[i].GenomeList.Count;
                                        }

                                        // Build/create _specieSizePointArray from the _specieSizeArray.
                                        UpdateRankedDataPoints(_specieDataArrayInt, ref _specieDataPointArrayInt);

                                        // Return plot points.
                                        return _specieDataPointArrayInt;
                                    });
            // Create form.
            SummaryGraphForm graphForm = new SummaryGraphForm("Specie Size by Rank", "Species (largest to smallest)", "Size", string.Empty,
                                                 new SummaryDataSource[] {dsSpecieSizeRank}, _ea);
            _summaryGraphFormList.Add(graphForm);

            // Attach a event handler to update this main form when the graph form is closed.
            graphForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs)
            {
                _summaryGraphFormList.Remove(senderObj as SummaryGraphForm);
                specieSizeByRankToolStripMenuItem.Enabled = true;
            });

            // Prevent creating more then one instance fo the form.
            specieSizeByRankToolStripMenuItem.Enabled = false;

            // Show the form.
            graphForm.Show(this);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: homoluden/SharpNEAT
        private void specieFitnessDistributionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SummaryDataSource dsSpecieChampFitnessDist = new SummaryDataSource("Specie Fitness Distribution (Champ)", 0, Color.Red, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int specieCount = _ea.SpecieList.Count;
                                        if(null == _specieDataArray || _specieDataArray.Length != specieCount) {
                                            _specieDataArray = new double[specieCount];
                                        }

                                        // Copy specie sizes into _specieSizeArray.
                                        for(int i=0; i<specieCount; i++) {
                                            _specieDataArray[i] = _ea.SpecieList[i].GenomeList[0].EvaluationInfo.Fitness;
                                        }

                                        // Calculate a frequency distribution and retrieve it as an array of plottable points.
                                        Point2DDouble[] pointArr = CalcDistributionDataPoints(_specieDataArray);

                                        // Return plot points.
                                        return pointArr;
                                    });

            SummaryDataSource dsSpecieMeanFitnessDist = new SummaryDataSource("Specie Fitness Distribution (Mean)", 0, Color.Black, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int specieCount = _ea.SpecieList.Count;
                                        if(null == _specieDataArray || _specieDataArray.Length != specieCount) {
                                            _specieDataArray = new double[specieCount];
                                        }

                                        // Copy specie sizes into _specieSizeArray.
                                        for(int i=0; i<specieCount; i++) {
                                            _specieDataArray[i] = _ea.SpecieList[i].CalcMeanFitness();
                                        }

                                        // Calculate a frequency distribution and retrieve it as an array of plottable points.
                                        Point2DDouble[] pointArr = CalcDistributionDataPoints(_specieDataArray);

                                        // Return plot points.
                                        return pointArr;
                                    });
            // Create form.
            SummaryGraphForm graphForm = new SummaryGraphForm("Specie Fitness Distribution", "Fitness", "Frequency", string.Empty,
                                                 new SummaryDataSource[] {dsSpecieChampFitnessDist, dsSpecieMeanFitnessDist}, _ea);
            _summaryGraphFormList.Add(graphForm);

            // Attach a event handler to update this main form when the graph form is closed.
            graphForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs)
            {
                _summaryGraphFormList.Remove(senderObj as SummaryGraphForm);
                specieFitnessDistributionsToolStripMenuItem.Enabled = true;
            });

            // Prevent creating more then one instance fo the form.
            specieFitnessDistributionsToolStripMenuItem.Enabled = false;

            // Show the form.
            graphForm.Show(this);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: homoluden/SharpNEAT
        private void genomeComplexityDistributionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SummaryDataSource dsGenomeComplexityDist = new SummaryDataSource("Genome Complexity Distribution", 0, Color.Red, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int genomeCount = _ea.GenomeList.Count;
                                        if(null == _genomeDataArray || _genomeDataArray.Length != genomeCount) {
                                            _genomeDataArray = new double[genomeCount];
                                        }

                                        // Copy genome fitness values into the data array.
                                        for(int i=0; i<genomeCount; i++) {
                                            _genomeDataArray[i] = _ea.GenomeList[i].Complexity;
                                        }

                                        // Calculate a frequency distribution and retrieve it as an array of plottable points.
                                        Point2DDouble[] pointArr = CalcDistributionDataPoints(_genomeDataArray);

                                        // Return plot points.
                                        return pointArr;
                                    });
            // Create form.
            SummaryGraphForm graphForm = new SummaryGraphForm("Genome Complexity Distribution", "Complexity", "Frequency", string.Empty,
                                                 new SummaryDataSource[] {dsGenomeComplexityDist}, _ea);
            _summaryGraphFormList.Add(graphForm);

            // Attach a event handler to update this main form when the graph form is closed.
            graphForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs)
            {
                _summaryGraphFormList.Remove(senderObj as SummaryGraphForm);
                genomeComplexityDistributionToolStripMenuItem.Enabled = true;
            });

            // Prevent creating more then one instance fo the form.
            genomeComplexityDistributionToolStripMenuItem.Enabled = false;

            // Show the form.
            graphForm.Show(this);
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: homoluden/SharpNEAT
        private void genomeComplexityByRankToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SummaryDataSource dsGenomeComplexityRank = new SummaryDataSource("Genome Complexity", 0, Color.Red, delegate()
                                    {
                                        // Ensure temp working storage is ready.
                                        int genomeCount = _ea.GenomeList.Count;
                                        if(null == _genomeDataArray || _genomeDataArray.Length != genomeCount) {
                                            _genomeDataArray = new double[genomeCount];
                                        }

                                        // Copy genome complexity values into the data array.
                                        for(int i=0; i<genomeCount; i++) {
                                            _genomeDataArray[i] = _ea.GenomeList[i].Complexity;
                                        }

                                        // Build/create point array.
                                        UpdateRankedDataPoints(_genomeDataArray, ref _genomeDataPointArray);

                                        // Return plot points.
                                        return _genomeDataPointArray;
                                    });
            // Create form.
            SummaryGraphForm graphForm = new SummaryGraphForm("Genome Complexity by Rank", "Genomes", "Complexity", string.Empty,
                                                 new SummaryDataSource[] {dsGenomeComplexityRank}, _ea);
            _summaryGraphFormList.Add(graphForm);

            // Attach a event handler to update this main form when the graph form is closed.
            graphForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs)
            {
                _summaryGraphFormList.Remove(senderObj as SummaryGraphForm);
                genomeComplexityByRankToolStripMenuItem.Enabled = true;
            });

            // Prevent creating more then one instance fo the form.
            genomeComplexityByRankToolStripMenuItem.Enabled = false;

            // Show the form.
            graphForm.Show(this);
        }