예제 #1
0
        public IList <IGenome> Cross(IList <IGenome> parents)
        {
            Trace.Assert(parents.Count == NbOfParents);

            var children = PerformCross(parents);

            Trace.Assert(children.EveryoneIsUnique());

            thisSession.RegisterParticipants(parents);
            return(children);
        }
        public IList <IGenome> Produce(
            IList <IGenome> sampleGenomes,
            GenomeProductionSession thisSession,
            GenomeProductionSession totalSession)
        {
            selection.Prepare(
                sampleGenomes,
                thisSession,
                totalSession,
                thisSession.requiredNb);

            var participants = selection.Select(thisSession.requiredNb);
            var produced     = participants.Select(x => x.CreateNew(x.Genes))
                               .ToArray();

            Trace.Assert(produced.EveryoneIsUnique());

            thisSession.RegisterParticipants(participants);
            thisSession.AddNewProducedGenomes(produced);

            return(produced);
        }