// Shows the best path public void outputBest() { Variables.paused = true; string s = "Best path: " + Variables.bestPopulation[0].Genome.write() + " with a rating of: " + Variables.bestPopulation[0].Rating.ToString() + " in: " + elapsedTime; Output output = new Output(s); output.Show(); Application.DoEvents(); }
// This function opens a new window containing the current population and an option to save all populations to a text file public void output() { Variables.paused = true; string s = ""; for (int i = 0; i < populationSize; i++) { s += i + " : " + "Selected: " + population[i].Selected + " , Mutated: " + population[i].Mutated + " , Rating: " + population[i].Rating + " = Distances: " + population[i].Distances + " + Collisions: " + population[i].Collisions + System.Environment.NewLine; } Output output = new Output(s); output.Show(); Application.DoEvents(); // Deactivates after first Generation // Variables.popDebugging = false; }
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(); }
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(); }