public override LGPProgram Compete(LGPPop pop, LGPProgram weak_program_in_current_pop, LGPProgram child_program) { if (child_program.IsBetterThan(weak_program_in_current_pop)) { pop.Replace(weak_program_in_current_pop, child_program); return(weak_program_in_current_pop); } return(child_program); }
public override LGPProgram Compete(LGPPop pop, LGPProgram weak_program_in_current_pop, LGPProgram child_program) { double r = DistributionModel.GetUniform(); if (r < m_reproduction_probability) { //Console.WriteLine("replacing..."); pop.Replace(weak_program_in_current_pop, child_program); return(weak_program_in_current_pop); } return(child_program); }