Class FitnessEvaluatorSync<T extends Comparable<T>>

java.lang.Object
net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorSync<T>
Type Parameters:
T -
All Implemented Interfaces:
FitnessEvaluator<T>

public class FitnessEvaluatorSync<T extends Comparable<T>> extends Object implements FitnessEvaluator<T>
Wrapper around Fitness for computing the fitness of a population

In order to leverage multi-core systems and speed up computations, the population will be split according to the number of partitions defined in

invalid reference
net.bmahe.genetics4j.core.EASystemnet.bmahe.genetics4j.core.spec.EAExecutionContext#numberOfPartitions()
and processed concurrently
  • Field Details

  • Constructor Details

  • Method Details

    • evaluate

      public List<T> evaluate(long generation, List<Genotype> population)
      Description copied from interface: FitnessEvaluator
      Evaluates the fitness of all genotypes in the given population.

      This is the core method that computes fitness values for an entire population of genotypes. The implementation strategy (synchronous, parallel, asynchronous) is determined by the specific evaluator implementation.

      Requirements:

      • Return fitness values in the same order as input genotypes
      • Return exactly one fitness value per input genotype
      • Ensure fitness values are comparable for selection operations
      • Handle empty populations gracefully (return empty list)

      The generation parameter can be used for:

      • Adaptive fitness functions that change over time
      • Logging and monitoring evaluation progress
      • Implementing generation-specific evaluation strategies
      • Debugging and performance analysis
      Specified by:
      evaluate in interface FitnessEvaluator<T extends Comparable<T>>
      Parameters:
      generation - the current generation number (0-based)
      population - the population of genotypes to evaluate
      Returns:
      a list of fitness values corresponding to each genotype