Record Class TerminationStrategy.ExecutionState<T>

java.lang.Object
java.lang.Record
org.cicirello.search.evo.TerminationStrategy.ExecutionState<T>
Type Parameters:
T - The type of object under optimization.
Record Components:
numCompletedGenerations - the number of completed generations
fitnessEvaluations - the total number of fitness evaluations so far for this call to optimize
bestSolution - the best solution found across all generations so far for this run (i.e., for this call to optimize)
bestFitness - the fitness of the best solution found across all generations so far for this run (i.e., for this call to optimize)
currentPopulation - the current population, enabling termination strategies that rely on population-level statistics. This provides termination strategies with access to the actual encodings of the members of the population as well as their fitnesses. Do not attempt to mutate members of the population here, as the behavior of the EA may become unstable.
Enclosing interface:
TerminationStrategy<T>

public static record TerminationStrategy.ExecutionState<T>(int numCompletedGenerations, long fitnessEvaluations, T bestSolution, double bestFitness, PopulationCandidates<T> currentPopulation) extends Record
The state of the evolutionary algorithm prior to the start of a generation.
  • Constructor Details

    • ExecutionState

      public ExecutionState(int numCompletedGenerations, long fitnessEvaluations, T bestSolution, double bestFitness, PopulationCandidates<T> currentPopulation)
      Creates an instance of a ExecutionState record class.
      Parameters:
      numCompletedGenerations - the value for the numCompletedGenerations record component
      fitnessEvaluations - the value for the fitnessEvaluations record component
      bestSolution - the value for the bestSolution record component
      bestFitness - the value for the bestFitness record component
      currentPopulation - the value for the currentPopulation record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • numCompletedGenerations

      public int numCompletedGenerations()
      Returns the value of the numCompletedGenerations record component.
      Returns:
      the value of the numCompletedGenerations record component
    • fitnessEvaluations

      public long fitnessEvaluations()
      Returns the value of the fitnessEvaluations record component.
      Returns:
      the value of the fitnessEvaluations record component
    • bestSolution

      public T bestSolution()
      Returns the value of the bestSolution record component.
      Returns:
      the value of the bestSolution record component
    • bestFitness

      public double bestFitness()
      Returns the value of the bestFitness record component.
      Returns:
      the value of the bestFitness record component
    • currentPopulation

      public PopulationCandidates<T> currentPopulation()
      Returns the value of the currentPopulation record component.
      Returns:
      the value of the currentPopulation record component