protected EvolutionaryOptimization( int genomLength, int populationSize, PointMutationPars mutationPars, IComparer<Genom> fitnessComparer) { Contract.Requires(genomLength > 0); Contract.Requires(populationSize > 1); Contract.Requires(fitnessComparer != null); GenomLength = genomLength; PopulationSize = populationSize; MutationPars = mutationPars; FitnessComparer = new SmartComparer<Genom>(new GenomBagComparer(fitnessComparer)); }
static void Main(string[] args) { List <byte> b = new List <byte>() { 50, 60, 70, 80, 90, 10, 20, 1, 2, 3, 4, 5, 50, 2, 3, 1, 2, 3, 4, 5 }; List <byte> b2 = new List <byte>() { 1, 2, 3, 4, 5 }; SmartComparer comparer = new SmartComparer(); var result = comparer.CompareArraysWithDepth(b, b2, 3); foreach (var keyValuePair in result) { Console.WriteLine(String.Format("b[{0}]->b[{1}] are equal to b2[{2}]->b2[{3}]", keyValuePair.Key.Key, keyValuePair.Key.Value, keyValuePair.Value.Key, keyValuePair.Value.Value)); } }