Class Evaluators

java.lang.Object
io.jenetics.engine.Evaluators

public final class Evaluators extends Object
This class contains factory methods for creating commonly usable Evaluator implementations.
Since:
5.0
Version:
8.0
See Also:
  • Method Details

    • async

      public static <G extends Gene<?, G>, C extends Comparable<? super C>> Evaluator<G,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 type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function
      Returns:
      a new (asynchronous) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null
      See Also:
    • async

      public 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.
      Type Parameters:
      T - the native fitness domain type
      G - the gene type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function, working on the native fitness domain
      decoder - the decoder function for the fitness domain
      Returns:
      a new (async) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null
    • async

      public static <T, G extends Gene<?, G>, C extends Comparable<? super C>> Evaluator<G,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 type
      G - the gene type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function, working on the native fitness domain
      codec - the codec used for transforming the fitness domain
      Returns:
      a new (async) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null
    • completable

      public 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.
      Type Parameters:
      G - the gene type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function
      Returns:
      a new (asynchronous) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null
      See Also:
    • completable

      public 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.
      Type Parameters:
      T - the native fitness domain type
      G - the gene type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function, working on the native fitness domain
      decoder - the decoder function for the fitness domain
      Returns:
      a new (async) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null
    • completable

      public 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.
      Type Parameters:
      T - the native fitness domain type
      G - the gene type
      C - the fitness value type
      Parameters:
      fitness - the asynchronous fitness function, working on the native fitness domain
      codec - the codec used for transforming the fitness domain
      Returns:
      a new (async) fitness evaluator
      Throws:
      NullPointerException - if one of the arguments is null