Package edu.cnu.mdi.sim.ga
Record Class GAOperators<C extends GASolution<C>>
java.lang.Object
java.lang.Record
edu.cnu.mdi.sim.ga.GAOperators<C>
- Type Parameters:
C- solution type- Record Components:
selection- parent-selection strategycrossover- parent recombination strategymutation- offspring mutation strategyreplacement- next-generation strategy
public record GAOperators<C extends GASolution<C>>(SelectionOperator<C extends GASolution<C>> selection, CrossoverOperator<C extends GASolution<C>> crossover, MutationOperator<C extends GASolution<C>> mutation, ReplacementOperator<C extends GASolution<C>> replacement)
extends Record
A record to hold the operators used in a genetic algorithm. This includes selection,
crossover, mutation, and replacement operators.
The GA will use these operators to evolve the population of solutions.
-
Constructor Summary
ConstructorsConstructorDescriptionGAOperators(SelectionOperator<C> selection, CrossoverOperator<C> crossover, MutationOperator<C> mutation, ReplacementOperator<C> replacement) Creates an instance of aGAOperatorsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecrossoverrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.mutation()Returns the value of themutationrecord component.Returns the value of thereplacementrecord component.Returns the value of theselectionrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GAOperators
public GAOperators(SelectionOperator<C> selection, CrossoverOperator<C> crossover, MutationOperator<C> mutation, ReplacementOperator<C> replacement) Creates an instance of aGAOperatorsrecord class.- Parameters:
selection- the value for theselectionrecord componentcrossover- the value for thecrossoverrecord componentmutation- the value for themutationrecord componentreplacement- the value for thereplacementrecord component
-
-
Method Details
-
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. -
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. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
selection
Returns the value of theselectionrecord component.- Returns:
- the value of the
selectionrecord component
-
crossover
Returns the value of thecrossoverrecord component.- Returns:
- the value of the
crossoverrecord component
-
mutation
Returns the value of themutationrecord component.- Returns:
- the value of the
mutationrecord component
-
replacement
Returns the value of thereplacementrecord component.- Returns:
- the value of the
replacementrecord component
-