/** * Return the {@link Executor} the engine is using for executing the * evolution steps. * * @return the executor used for performing the evolution steps */ public Executor getExecutor() { return _executor.get(); }
_executor.async(() -> selectOffspring(evalPop), _clock _executor.async(() -> selectSurvivors(evalPop), _clock _executor.thenApply(offspring, p -> _alterer.alter(p.result, start.getGeneration()), _clock _executor.thenApply(survivors, pop -> filter(pop.result, start.getGeneration()), _clock _executor.thenApply(alteredOffspring, pop -> filter(pop.result.getPopulation(), start.getGeneration()), _clock filteredSurvivors.thenCombineAsync(filteredOffspring, (s, o) -> ISeq.of(s.result.population.append(o.result.population)), _executor.get() );
_maximalPhenotypeAge = require.positive(maximalPhenotypeAge); _executor = new TimedExecutor(requireNonNull(executor)); _evaluator = requireNonNull(evaluator); _clock = requireNonNull(clock);
/** * Create a new evolution {@code Engine.Builder} initialized with the values * of the current evolution {@code Engine}. With this method, the evolution * engine can serve as a template for a new one. * * @return a new engine builder */ public Builder<G, C> builder() { return new Builder<G, C>(_genotypeFactory, _fitnessFunction) .alterers(_alterer) .clock(_clock) .evaluator(_evaluator) .executor(_executor.get()) .fitnessScaler(_fitnessScaler) .maximalPhenotypeAge(_maximalPhenotypeAge) .offspringFraction((double)_offspringCount/(double)getPopulationSize()) .offspringSelector(_offspringSelector) .optimize(_optimize) .phenotypeValidator(_validator) .populationSize(getPopulationSize()) .survivorsSelector(_survivorsSelector) .individualCreationRetries(_individualCreationRetries) .mapping(_mapper); }