예제 #1
0
    public List <Genome> FillNewGeneration(List <Genome> oldPool)
    {
        List <Genome> result = ObjectCopier.Clone <List <Genome> >(oldPool);

        for (int i = 0; i < result.Count; i++)
        {
            result[i]._index = i;
        }
        for (int i = 0; i < oldPool.Count; i += 2)
        {
            Genome Offspring1 = new Genome(_index, i + oldPool.Count, oldPool[i]._inputCount, oldPool[i]._outputCount);
            Genome Offspring2 = new Genome(_index, i + 1 + oldPool.Count, oldPool[i]._inputCount, oldPool[i]._outputCount);
            oldPool[i].Mate(oldPool[i + 1], Offspring1, Offspring2);
            Offspring1.CreateBasicNodes();
            Offspring1.CreateExtendedNodes();
            Offspring2.CreateBasicNodes();
            Offspring2.CreateExtendedNodes();
            result.Add(Offspring1);
            result.Add(Offspring2);
        }
        return(result);
    }