コード例 #1
0
        private Route[] Recombine(Route[] parents, int eliteCount)
        {
            Route[] children = new Route[parents.Length];

            Route[] pool = (Route[])parents.Clone();
            pool.Shuffle();

            for (int i = 0; i < eliteCount; i++)
            {
                children[i] = parents[i];
            }

            for (int i = eliteCount; i < parents.Length; i++)
            {
                children[i] = crossoverStratergy.CrossOver(parents[i], pool[parents.Length - i - 1]);
            }

            return(children);
        }