static void OnNewPopulation_ShowParents(object o, NewPopulationEventArgs e) { // // 00101110 // + 10100010 // ----^--- // = 00100010 // foreach (Chromosome c in e.NewPopulation.Chromosomes) { Console.WriteLine(" {0}", c.Parents[0]); Console.WriteLine("+ {0}", c.Parents[1]); Console.Write(" "); for (int i = 0; i < c.CrossoverPoint; i++) { Console.Write("--"); } Console.Write("^-"); for (int i = c.CrossoverPoint + 1; i < c.Genes.Length; i++) { Console.Write("--"); } Console.WriteLine(); Console.WriteLine("= {0}", c); Console.WriteLine(); } }
// // Handler for the "NewPopulation" event that is raised by the GA // component each time a new population has been evaluated. We take // the opportunity to print out some of the summary data for the // just-evaluated generation. // static void OnNewPopulation_ShowSummary(object o, NewPopulationEventArgs e) { Population oldPopulation = e.OldPopulation; // the just-evaluated population Console.WriteLine("Generation: {0}", e.Generation); Console.WriteLine(" Highest Objective: {0}", oldPopulation.Summary.HighestObjective); Console.WriteLine(" Lowest Objective : {0}", oldPopulation.Summary.LowestObjective); Console.WriteLine(" Best Individual : {0}", oldPopulation.Summary.BestChromosome); }
static void OnNewPopulation(object o, NewPopulationEventArgs e) { Chromosome c = e.OldPopulation.Summary.BestChromosome; Console.WriteLine("Best of Generation: {0}", e.OldPopulation.Summary.BestChromosome); Console.WriteLine(" cost = {0}", Objective.GetCost(c)); Console.WriteLine(" value = {0}", Objective.GetValue(c)); Console.WriteLine(" objective = {0}", c.RawObjective); }
// // Handler for the "NewPopulation" event that is raised by the GA // component each time a new population has been evaluated. We take // the opportunity to print out information about the best chromosome // in the just-evaluated generation. // static void OnNewPopulation_ShowSummary(object o, NewPopulationEventArgs e) { Chromosome bestChromosome = e.OldPopulation.Summary.BestChromosome; Console.WriteLine("{0}: {1} ({2})", e.Generation, bestChromosome, bestChromosome.RawObjective ); }
static void OnNewPopulation(object o, NewPopulationEventArgs e) { Console.WriteLine(); for (int i = 0; i < e.NewPopulation.PopulationSize; i++) { Console.WriteLine( "{0,2}) {1} {2,2}) {3}", e.OldPopulation.Chromosomes[i].ID, e.OldPopulation.Chromosomes[i], e.NewPopulation.Chromosomes[i].ID, e.NewPopulation.Chromosomes[i] ); } }
void OnNewPopulation(object o, NewPopulationEventArgs e) { //System.Threading.Monitor.Enter(this); currentPopulationSummary = e.OldPopulation.Summary; //System.Threading.Monitor.Exit(this); axMSChart1.RowCount++; axMSChart1.DataGrid.SetData( ++generation, 1, currentPopulationSummary.BestChromosome.RawObjective, 0 ); graphPanel.Invalidate(); }
static void OnNewPopulation(object o, NewPopulationEventArgs e) { //Console.WriteLine("Gen {0}: {1}", gen++, e.OldPopulation.Summary.BestChromosome); Console.WriteLine(e.OldPopulation.Summary); }
static void OnNewPopulation_ShowSummary(object o, NewPopulationEventArgs e) { Console.WriteLine(e.OldPopulation.Summary.ToString()); }