java.lang.Object
io.jenetics.engine.Evaluators
This class contains factory methods for creating commonly usable
Evaluator implementations. By default, the evolution Engine
uses the concurrent evaluators (concurrent(Function, Executor)).- Since:
- 5.0
- Version:
- 5.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <G extends Gene<?,G>, C extends Comparable<? super C>>
Evaluator<G,C> Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> async(Function<? super T, ? extends Future<C>> fitness, Function<? super Genotype<G>, ? extends T> decoder) Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <G extends Gene<?,G>, C extends Comparable<? super C>>
Evaluator<G,C> completable(Function<? super Genotype<G>, ? extends CompletableFuture<C>> fitness) Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> completable(Function<? super T, ? extends CompletableFuture<C>> fitness, Codec<T, G> codec) Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> completable(Function<? super T, ? extends CompletableFuture<C>> fitness, Function<? super Genotype<G>, ? extends T> decoder) Return a new fitness evaluator, which evaluates asynchronous fitness functions.static <G extends Gene<?,G>, C extends Comparable<? super C>>
Evaluator<G,C> concurrent(Function<? super Genotype<G>, ? extends C> fitness, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> concurrent(Function<? super T, ? extends C> fitness, Codec<T, G> codec, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> concurrent(Function<? super T, ? extends C> fitness, Function<? super Genotype<G>, ? extends T> decoder, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor.static <G extends Gene<?,G>, C extends Comparable<? super C>>
Evaluator<G,C> Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread.static <T,G extends Gene<?, G>, C extends Comparable<? super C>>
Evaluator<G,C> Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread.
-
Method Details
-
serial
public static <G extends Gene<?,G>, Evaluator<G,C extends Comparable<? super C>> C> serial(Function<? super Genotype<G>, ? extends C> fitness) Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread. Might be useful for testing purpose.- Type Parameters:
G- the gene typeC- the fitness value type- Parameters:
fitness- the fitness function- Returns:
- a new serial fitness evaluator
- Throws:
NullPointerException- if the fitnessfunctionisnull
-
serial
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> serial(Function<? super T, ? extends C> fitness, Function<? super Genotype<G>, ? extends T> decoder) Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread. Might be useful for testing purpose.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the fitness functiondecoder- the decoder function for the fitness domain- Returns:
- a new (concurrent) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
serial
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> serial(Function<? super T, ? extends C> fitness, Codec<T, G> codec) Return a new fitness evaluator, which evaluates the fitness function of the population serially in the main thread. Might be useful for testing purpose.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the fitness functioncodec- the codec used for transforming the fitness domain- Returns:
- a new (concurrent) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
concurrent
public static <G extends Gene<?,G>, Evaluator<G,C extends Comparable<? super C>> C> concurrent(Function<? super Genotype<G>, ? extends C> fitness, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor. This is the default evaluator used by the evolution engine.- Type Parameters:
G- the gene typeC- the fitness value type- Parameters:
fitness- the fitness functionexecutor- theExecutorused for evaluating the fitness function- Returns:
- a new (concurrent) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
concurrent
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> concurrent(Function<? super T, ? extends C> fitness, Function<? super Genotype<G>, ? extends T> decoder, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor. This is the default evaluator used by the evolution engine.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the fitness function, working on the native fitness domaindecoder- the decoder function for the fitness domainexecutor- theExecutorused for evaluating the fitness function- Returns:
- a new (concurrent) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
concurrent
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> concurrent(Function<? super T, ? extends C> fitness, Codec<T, G> codec, Executor executor) Return a new fitness evaluator, which evaluates the fitness function of the population (concurrently) with the givenexecutor. This is the default evaluator used by the evolution engine.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the fitness function, working on the native fitness domaincodec- the codec used for transforming the fitness domainexecutor- theExecutorused for evaluating the fitness function- Returns:
- a new (concurrent) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
async
public static <G extends Gene<?,G>, Evaluator<G,C extends Comparable<? super C>> C> async(Function<? super Genotype<G>, ? extends Future<C>> fitness) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
G- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function- Returns:
- a new (asynchronous) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull- See Also:
-
async
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> async(Function<? super T, ? extends Future<C>> fitness, Function<? super Genotype<G>, ? extends T> decoder) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function, working on the native fitness domaindecoder- the decoder function for the fitness domain- Returns:
- a new (async) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
async
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> async(Function<? super T, ? extends Future<C>> fitness, Codec<T, G> codec) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function, working on the native fitness domaincodec- the codec used for transforming the fitness domain- Returns:
- a new (async) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
completable
public static <G extends Gene<?,G>, Evaluator<G,C extends Comparable<? super C>> C> completable(Function<? super Genotype<G>, ? extends CompletableFuture<C>> fitness) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
G- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function- Returns:
- a new (asynchronous) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull- See Also:
-
completable
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> completable(Function<? super T, ? extends CompletableFuture<C>> fitness, Function<? super Genotype<G>, ? extends T> decoder) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function, working on the native fitness domaindecoder- the decoder function for the fitness domain- Returns:
- a new (async) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-
completable
public static <T,G extends Gene<?, Evaluator<G,G>, C extends Comparable<? super C>> C> completable(Function<? super T, ? extends CompletableFuture<C>> fitness, Codec<T, G> codec) Return a new fitness evaluator, which evaluates asynchronous fitness functions.- Type Parameters:
T- the native fitness domain typeG- the gene typeC- the fitness value type- Parameters:
fitness- the asynchronous fitness function, working on the native fitness domaincodec- the codec used for transforming the fitness domain- Returns:
- a new (async) fitness evaluator
- Throws:
NullPointerException- if one of the arguments isnull
-