void universe_AnyEnvironmentEnds(object sender, GeneticFaraday.Contracts.Universe.Events.AnyEnvironmentEndsEventArgs e) { var mostValuable = (IGEPOrganism)e.EnvironmentEndEventArgs.Environment.GetMostValuableOrganism(); var phenome = (IGEPPhenome)mostValuable.ToPhenome(new GEPSurroundings(this.GetInputRegistry(mostValuable, 3))); var programString = phenome.Chromosomes[0].Main.ToDebuggablePhenomeString(mostValuable.Parent.GeneticCode, printIVariablesAsValues: false); Console.WriteLine(programString); var metrics = MetricsFunction(mostValuable); mostValuable.ResultsRegistry.MoveToZero(); var zeroPosition = mostValuable.ResultsRegistry.Read().Value; Console.WriteLine(mostValuable.Metrics.Value.Value); var genome = mostValuable.ToGenome(); var genomeString = genome.ToGenomeString(); var reconvertedOrganism = genome.ToOrganism(e.EnvironmentEndEventArgs.Environment); }
public override void ConstructFromOrganism(IOrganism organism, GeneticFaraday.Contracts.Organisms.OrganismBehavior.Surroundings.ISurroundings surroundings) { this.Chromosomes = new List<IDebuggableChromosome>(); }
void environment_GenerationEnd(object sender, GeneticFaraday.Contracts.Environment.Events.GenerationEndEventArgs e) { var mostValuable = (IGEPOrganism)e.Environment.GetMostValuableOrganism(); var phenome = (IGEPPhenome)mostValuable.ToPhenome(new GEPSurroundings(this.GetInputRegistry(mostValuable, 3))); var programString = phenome.Chromosomes[0].Main.ToDebuggablePhenomeString(mostValuable.Parent.GeneticCode, printIVariablesAsValues: false); Console.WriteLine(programString); Console.WriteLine(mostValuable.Metrics.Value.Value); }