Example #1
0
        private void button_start_Click(object sender, EventArgs e)
        {
            // !! Currently DOES NOT run as a background task!
            GeneticAlgorithm ga = new GeneticAlgorithm(this.glControl1, this.textBox3, this.bar_algorithm_progress);
            ga.gaMain();

            //// Disables the Start button until the GA is done
            //this.button_start.Enabled = false;

            //// Disables the tabs until the GA is done
            //this.tabControl1.Enabled = false;

            //// Enables the Cancel Button until GA is done
            //this.button_cancel.Enabled = true;

            //// Runs the DoWork function
            //this.geneticalgorithm.RunWorkerAsync();
        }
Example #2
0
        private void geneticalgorithm_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            stopWatch.Start();
            GeneticAlgorithm ga = new GeneticAlgorithm(this.glControl1, this.textBox3, this.bar_algorithm_progress);
            //e.Result = ga.gaMain(worker, e);
        }
Example #3
0
 private void button_evaluation_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < Variables.evaluationsize; i++)
     {
         GeneticAlgorithm ga = new GeneticAlgorithm(this.glControl1, this.textBox3, this.bar_algorithm_progress);
         ga.gaMain();
     }
     string s = "";
     for (int i = 0; i < Variables.evaluationsize; i++)
     {
         /**s += "Best path: " + Variables.bestPopulation[i].Genome.write() +
                " with a rating of: " + Variables.bestPopulation[i].Rating.ToString() +
                " in: " + Variables.time[i] + Environment.NewLine;
          * **/
         s += Variables.bestPopulation[i].Rating.ToString() + " in: " + Variables.time[i] + Environment.NewLine;
     }
     Output output = new Output(s);
     output.Show();
 }