@Test(dataProvider = "minimalEvaluationLimits") public void minimalEvaluation(final int limit) { final AtomicInteger count = new AtomicInteger(); final Evaluator<IntegerGene, Integer> evaluator = population -> { count.incrementAndGet(); return population .map(pt -> pt.withFitness(1)) .asISeq(); }; final Codec<Integer, IntegerGene> codec = Codecs.ofScalar(IntRange.of(1, 100)); final Engine<IntegerGene, Integer> engine = new Engine.Builder<>(evaluator, codec.encoding()) .alterers(new Mutator<>(1.0)) .build(); final EvolutionResult<IntegerGene, Integer> result = engine.stream() .limit(limit) .collect(EvolutionResult.toBestEvolutionResult()); Assert.assertEquals(count.get(), limit == 0 ? 0 : limit +1); }
@Override public EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start) { return EvolutionStream.ofEvolution( () -> evolutionStart(start.get()), this ); }
Engine implements
		Evolution<G, C>,
		EvolutionStreamable<G, C>,
		Evaluator<G, C> { @Override public EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start) { return EvolutionStream.ofEvolution( () -> evolutionStart(start.get()), this ); } }
Engine implements
		Evolution<G, C>,
		EvolutionStreamable<G, C>,
		Evaluator<G, C> { @Override public EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start) { return EvolutionStream.ofEvolution( () -> evolutionStart(start.get()), this ); } Engine(
		final Evaluator<G, C> evaluator,
		final Factory<Genotype<G>> genotypeFactory,
		final Constraint<G, C> constraint,
		final Optimize optimize,
		final EvolutionParams<G, C> evolutionParams,
		final Executor executor,
		final Clock clock,
		final EvolutionInterceptor<G, C> interceptor
	); }
Engine implements
		Evolution<G, C>,
		EvolutionStreamable<G, C>,
		Evaluator<G, C> { @Override public EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start) { return EvolutionStream.ofEvolution( () -> evolutionStart(start.get()), this ); } Engine(
		final Evaluator<G, C> evaluator,
		final Factory<Genotype<G>> genotypeFactory,
		final Constraint<G, C> constraint,
		final Optimize optimize,
		final EvolutionParams<G, C> evolutionParams,
		final Executor executor,
		final Clock clock,
		final EvolutionInterceptor<G, C> interceptor
	); @Override EvolutionResult<G, C> evolve(final EvolutionStart<G, C> start); @Override ISeq<Phenotype<G, C>> eval(final Seq<Phenotype<G, C>> population); @Override EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start); @Override EvolutionStream<G, C> stream(final EvolutionInit<G> init); Factory<Genotype<G>> genotypeFactory(); Constraint<G, C> constraint(); Selector<G, C> survivorsSelector(); Selector<G, C> offspringSelector(); Alterer<G, C> alterer(); int offspringSize(); int survivorsSize(); int populationSize(); long maximalPhenotypeAge(); Optimize optimize(); Clock clock(); Executor executor(); EvolutionInterceptor<G, C> interceptor(); Builder<G, C> toBuilder(); static Builder<G, C> builder(
		final Function<? super Genotype<G>, ? extends C> ff,
		final Factory<Genotype<G>> gtf
	); static Builder<G, C> builder(
		final Function<? super T, ? extends C> ff,
		final Codec<T, G> codec
	); static Builder<G, C> builder(final Problem<T, G, C> problem); @SafeVarargs static Builder<G, C> builder(
		final Function<? super Genotype<G>, ? extends C> ff,
		final Chromosome<G> chromosome,
		final Chromosome<G>... chromosomes
	); }
Engine implements
		Evolution<G, C>,
		EvolutionStreamable<G, C>,
		Evaluator<G, C> { @Override public EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start) { return EvolutionStream.ofEvolution( () -> evolutionStart(start.get()), this ); } Engine(
		final Evaluator<G, C> evaluator,
		final Factory<Genotype<G>> genotypeFactory,
		final Constraint<G, C> constraint,
		final Optimize optimize,
		final EvolutionParams<G, C> evolutionParams,
		final Executor executor,
		final Clock clock,
		final EvolutionInterceptor<G, C> interceptor
	); @Override EvolutionResult<G, C> evolve(final EvolutionStart<G, C> start); @Override ISeq<Phenotype<G, C>> eval(final Seq<Phenotype<G, C>> population); @Override EvolutionStream<G, C> stream(final Supplier<EvolutionStart<G, C>> start); @Override EvolutionStream<G, C> stream(final EvolutionInit<G> init); Factory<Genotype<G>> genotypeFactory(); Constraint<G, C> constraint(); Selector<G, C> survivorsSelector(); Selector<G, C> offspringSelector(); Alterer<G, C> alterer(); int offspringSize(); int survivorsSize(); int populationSize(); long maximalPhenotypeAge(); Optimize optimize(); Clock clock(); Executor executor(); EvolutionInterceptor<G, C> interceptor(); Builder<G, C> toBuilder(); static Builder<G, C> builder(
		final Function<? super Genotype<G>, ? extends C> ff,
		final Factory<Genotype<G>> gtf
	); static Builder<G, C> builder(
		final Function<? super T, ? extends C> ff,
		final Codec<T, G> codec
	); static Builder<G, C> builder(final Problem<T, G, C> problem); @SafeVarargs static Builder<G, C> builder(
		final Function<? super Genotype<G>, ? extends C> ff,
		final Chromosome<G> chromosome,
		final Chromosome<G>... chromosomes
	);  }