Class SelectiveRefinementTournament<T extends Comparable<T>>

java.lang.Object
net.bmahe.genetics4j.core.spec.selection.SelectiveRefinementTournament<T>
Type Parameters:
T - the fitness type, must be Comparable
All Implemented Interfaces:
SelectionPolicy
Direct Known Subclasses:
ImmutableSelectiveRefinementTournament

@Immutable public abstract class SelectiveRefinementTournament<T extends Comparable<T>> extends Object implements SelectionPolicy
Selective Refinement Tournament selection strategy that enhances traditional tournament selection by applying an additional refinement step to a subset of candidates.

This selection mechanism first performs standard tournament selection, then applies a secondary refinement process using a custom comparator to a portion of the selected candidates. This allows for more sophisticated selection criteria beyond simple fitness-based comparison.

Algorithm Overview:

  1. Conduct standard tournament selection based on the configured tournament parameters
  2. Apply refinement using the provided comparator to a fraction of candidates (determined by refinementRatio)
  3. Return the refined selection results

Use Cases:

  • Multi-objective optimization where secondary criteria matter
  • Diversity preservation by considering genetic distance in refinement
  • Age-based selection refinement in evolutionary strategies
  • Custom fitness landscape exploration with domain-specific comparators
See Also:
  • Constructor Details

    • SelectiveRefinementTournament

      public SelectiveRefinementTournament()
  • Method Details

    • tournament

      public abstract Tournament<T> tournament()
      Gets the base tournament configuration used for initial selection.

      This tournament defines the primary selection mechanism including the number of candidates per tournament and the comparison strategy for determining winners.

      Returns:
      the tournament configuration for initial selection
    • refinementComparator

      public abstract Comparator<Individual<T>> refinementComparator()
      Gets the comparator used for refining the selection results.

      This comparator is applied during the refinement phase to reorder or filter a subset of the initially selected individuals. It allows for secondary selection criteria beyond basic fitness comparison, such as diversity measures, age-based preferences, or multi-objective considerations.

      Returns:
      the comparator for refinement selection
    • refinementRatio

      public abstract float refinementRatio()
      Gets the ratio of candidates that undergo refinement selection.

      This value determines what fraction of the initially selected candidates will be subject to the refinement process using the refinement comparator. A value of 0.0 means no refinement (equivalent to standard tournament), while 1.0 means all candidates undergo refinement.

      Returns:
      the refinement ratio, must be between 0.0 and 1.0 inclusive
    • check

      @Check public void check()
      Validates the configuration parameters for this selection policy.

      Ensures that the refinement ratio is within the valid range of [0.0, 1.0]. This method is automatically called by the Immutables framework during object construction.

      Throws:
      IllegalArgumentException - if refinement ratio is not between 0.0 and 1.0 inclusive
    • builder

      public static <U extends Comparable<U>> SelectiveRefinementTournament.Builder<U> builder()