Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();

            //Initialize a test network
            testNN = new NN(4, 2, 1, new int[] { 6 });

            //Build a test population
            pop = new NNPopulation(Params.simulationPopulationSize, Params.neuralNetworkStructure);

            //Output the default object test results
            richTextBox_simpleOut.Text = getTestDataString();

            //Fill the simThread with a default value (not running)
            simThread = new Thread(new ThreadStart(runGeneticSimulation));
            //No stop is request at the beginning of execution
            requestStop = false;

            label_totalIterations.Text = "0 Total Iterations, Population Size: " + pop.StartPopulationSize;

            comboBox_BreedingType.SelectedIndex = 1;

            numIterations = 0;

            avgScoreList = new List<double>();
            movAvgScoreList = new List<double>();
            maxScoreList = new List<double>();
            movMaxScoreList = new List<double>();

            Series mAvgSeries = new Series("Average Moving Average");
            Series avgSeries = new Series("Average");
            Series mMaxSeries = new Series("Max Moving Average");
            Series maxSeries = new Series("Max");

            mAvgSeries.ChartType = SeriesChartType.Spline;
            avgSeries.ChartType = SeriesChartType.Line;
            mMaxSeries.ChartType = SeriesChartType.Spline;
            maxSeries.ChartType = SeriesChartType.Line;

            chart.Series.Add(mAvgSeries);
            chart.Series.Add(avgSeries);
            chart.Series.Add(mMaxSeries);
            chart.Series.Add(maxSeries);
        }
Beispiel #2
0
        //This function is a callback for the reset button for the simulation
        private void button_reset_Click(object sender, EventArgs e)
        {
            numIterations = 0;

            //Clear the chart
            for (int i = 0; i < chart.Series.Count; i++)
                chart.Series[i].Points.Clear();

            avgScoreList.Clear();
            movAvgScoreList.Clear();
            maxScoreList.Clear();
            movMaxScoreList.Clear();

            //Clear the iteration text
            label_iteration.Text = "Iteration: ";

            //Build a test population
            pop = new NNPopulation(Params.simulationPopulationSize, Params.neuralNetworkStructure);
        }