public void SwapGenesBetween( int first_index, int last_index, geneticfx.IChromosome other_chromosome ) { // swap genes between two chromosomes MyChromosome ocs = (MyChromosome) other_chromosome; for (int i=first_index;i<=last_index;i++) { bool swap = this.genes[ i ]; this.genes[ i ] = ocs.genes[ i]; ocs.genes[ i] = swap; } }
public void SwapGenesBetween( int first_index, int last_index, geneticfx.IChromosome other_chromosome ) { MyChromosome ocs = (MyChromosome) other_chromosome; for (int i=first_index;i<=last_index;i++) { MyGene swap = (MyGene) this.genes[ i ]; this.genes[ i ] = ocs.genes[ i]; ocs.genes[ i] = swap; } }
public static void StartGenerationHandler( geneticfx.Generation g, System.EventArgs e ) { System.Console.WriteLine(">Generation: ID={0}", g.ID ); System.Console.WriteLine("\t>Population Size: {0}", g.population.Size ); for (int i=0;i<g.population.Size;i++) { geneticfx.Organism o = g.population[ i ]; System.Console.WriteLine("\t\t\t--------"); System.Console.WriteLine("\t\t\torg ID {0}", o.ID ); System.Console.WriteLine("\t\t\tge {0}",o.GenerationID); System.Console.WriteLine("\t\t\tfitness {0}", o.Fitness); System.Console.WriteLine("\t\t\tgenes {0}",o.Genes.GetGeneString() ); } }
public static void EndGenerationHandler( geneticfx.Generation g, System.EventArgs e ) { System.Console.WriteLine("End {0}",g.ID ); }
public void StartGenerationHandler( geneticfx.Generation g, System.EventArgs e ) { System.Console.WriteLine(">Generation: ID={0}", g.ID ); System.Console.WriteLine("\t>Population Size: {0}", g.population.Size ); }