Пример #1
0
        /// <summary>
        ///
        /// </summary>
        static void HashSetTest()
        {
            HashSet <IGenotype>       hashSet;
            GenotypeGenericList <int> a, b;

            hashSet = new HashSet <IGenotype>();

            a = new GenotypeGenericList <int>(new int[] { 1, 2, 3 }, 1.0);
            b = new GenotypeGenericList <int>(new int[] { 1, 2, 3 }, 1.0);

            hashSet.Add(a);
            hashSet.Add(b);
        }
Пример #2
0
        /// <summary>
        /// Tests this crossover method.
        /// </summary>
        public void Test()
        {
            GenotypeGenericList <int> parentA, parentB;

            int[][] children;

            parentA  = new GenotypeGenericList <int>(new int[] { 1, 4, 2, 8, 5, 7, 3, 6, 9 }, 0);
            parentB  = new GenotypeGenericList <int>(new int[] { 7, 5, 3, 1, 9, 8, 6, 4, 2 }, 0);
            children = DoCrossover <int>(new List <IGenotype>(2)
            {
                parentA, parentB
            });

            Console.WriteLine(string.Join(" ", parentA.ToList()));
            Console.WriteLine(string.Join(" ", parentB.ToList()));
            Console.WriteLine(string.Join(" ", children[0].ToList()));
            Console.WriteLine(string.Join(" ", children[1].ToList()));
        }