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 generationsfitnessEvaluations- the total number of fitness evaluations so far for this call to optimizebestSolution- 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 Summary
ConstructorsConstructorDescriptionExecutionState(int numCompletedGenerations, long fitnessEvaluations, T bestSolution, double bestFitness, PopulationCandidates<T> currentPopulation) Creates an instance of aExecutionStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thebestFitnessrecord component.Returns the value of thebestSolutionrecord component.Returns the value of thecurrentPopulationrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefitnessEvaluationsrecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of thenumCompletedGenerationsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ExecutionState
public ExecutionState(int numCompletedGenerations, long fitnessEvaluations, T bestSolution, double bestFitness, PopulationCandidates<T> currentPopulation) Creates an instance of aExecutionStaterecord class.- Parameters:
numCompletedGenerations- the value for thenumCompletedGenerationsrecord componentfitnessEvaluations- the value for thefitnessEvaluationsrecord componentbestSolution- the value for thebestSolutionrecord componentbestFitness- the value for thebestFitnessrecord componentcurrentPopulation- the value for thecurrentPopulationrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
numCompletedGenerations
public int numCompletedGenerations()Returns the value of thenumCompletedGenerationsrecord component.- Returns:
- the value of the
numCompletedGenerationsrecord component
-
fitnessEvaluations
public long fitnessEvaluations()Returns the value of thefitnessEvaluationsrecord component.- Returns:
- the value of the
fitnessEvaluationsrecord component
-
bestSolution
Returns the value of thebestSolutionrecord component.- Returns:
- the value of the
bestSolutionrecord component
-
bestFitness
public double bestFitness()Returns the value of thebestFitnessrecord component.- Returns:
- the value of the
bestFitnessrecord component
-
currentPopulation
Returns the value of thecurrentPopulationrecord component.- Returns:
- the value of the
currentPopulationrecord component
-