Package ec

Examples of ec.BreedingPipeline


                for(int ind=from[subpop] ; ind < numinds[subpop] - from[subpop]; ind++)
                    newpop.subpops[subpop].individuals[ind] = (Individual)(state.population.subpops[subpop].individuals[ind].clone());
                }
            else
                {
                BreedingPipeline bp = (BreedingPipeline)newpop.subpops[subpop].
                    species.pipe_prototype.clone();
                                                                       
                if (!(state.population.subpops[subpop] instanceof Space))
                    state.output.fatal("Subpopulation " + subpop + " does not implement the Space interface.");
                Space space = (Space)(state.population.subpops[subpop]);
                                                       
                // check to make sure that the breeding pipeline produces
                // the right kind of individuals.  Don't want a mistake there! :-)
                if (!bp.produces(state,newpop,subpop,threadnum))
                    state.output.fatal("The Breeding Pipeline of subpopulation " + subpop + " does not produce individuals of the expected species " + newpop.subpops[subpop].species.getClass().getName() + " or fitness " + newpop.subpops[subpop].species.f_prototype );
                bp.prepareToProduce(state,subpop,threadnum);
                                                       
                // start breedin'!
                for(int x = from[subpop]; x < from[subpop] + numinds[subpop]; x++)
                    {
                    space.setIndex(threadnum, x);
                    if (bp.produce(1, 1, x, subpop, newpop.subpops[subpop].individuals, state, threadnum) != 1)
                        state.output.fatal( "The pipelines should produce one individual at a time!" );
                    }
                                                                       
                bp.finishProducing(state,subpop,threadnum);
                }
            }
        }
View Full Code Here


                    newpop.subpops[subpop].individuals[ind] = state.population.subpops[subpop].individuals[ind];
                }
            else
                {
                // do regular breeding of this subpopulation
                BreedingPipeline bp = null;
                if (clonePipelineAndPopulation)
                    bp = (BreedingPipeline)newpop.subpops[subpop].species.pipe_prototype.clone();
                else
                    bp = (BreedingPipeline)newpop.subpops[subpop].species.pipe_prototype;
                                       
                // check to make sure that the breeding pipeline produces
                // the right kind of individuals.  Don't want a mistake there! :-)
                int x;
                if (!bp.produces(state,newpop,subpop,threadnum))
                    state.output.fatal("The Breeding Pipeline of subpopulation " + subpop + " does not produce individuals of the expected species " + newpop.subpops[subpop].species.getClass().getName() + " or fitness " + newpop.subpops[subpop].species.f_prototype );
                bp.prepareToProduce(state,subpop,threadnum);
                                       
                // start breedin'!
                                       
                x=from[subpop];
                int upperbound = from[subpop]+numinds[subpop];
                while(x<upperbound)
                    x += bp.produce(1,upperbound-x,x,subpop,
                        newpop.subpops[subpop].individuals,
                        state,threadnum);
                if (x>upperbound) // uh oh!  Someone blew it!
                    state.output.fatal("Whoa!  A breeding pipeline overwrote the space of another pipeline in subpopulation " + subpop + ".  You need to check your breeding pipeline code (in produce() ).");

                bp.finishProducing(state,subpop,threadnum);
                }
            }
        }
View Full Code Here

TOP

Related Classes of ec.BreedingPipeline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.