00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 00006 namespace GEP.Core.Common.GeneticOperators 00007 { 00013 [Serializable] 00014 public class Elitism : GeneticOperator 00015 { 00022 public Elitism(int n_children, GenotypeSelection.GenotypeSelection selection) 00023 : base(0, n_children, true, false, selection, "Elitism") 00024 { 00025 00026 } 00027 00028 public override void Apply(Genotype[] parameters, int[] selectionIndexes, 00029 Genotype[] destination, ref int destIndex) 00030 { 00031 for (int i = selectionIndexes.Length - 1; 0 <= i; i--) 00032 { 00033 destination[destIndex++] = parameters[selectionIndexes[i]].Clone(); 00034 } 00035 } 00036 00037 public override void Apply(Genotype[] parameters, int[] selectionIndexes) 00038 { 00039 throw new NotImplementedException(); 00040 } 00041 00046 public Elitism(Elitism symbol) 00047 :base(symbol) 00048 { 00049 00050 } 00051 00056 public override GEP.Core.Common.Symbol Clone() 00057 { 00058 return new Elitism(this); 00059 } 00060 } 00061 }