#include <PureSinglePointCrossover.h>
◆ PureSinglePointCrossover()
Constructs a PureSinglePointCrossover object with specified algorithm parameters.
- Parameters
-
params | The algorithm parameters including the crossover rate. |
◆ apply()
void PureSinglePointCrossover::apply |
( |
std::mt19937 & | generator | ) |
|
|
overridevirtual |
Performs the single-point crossover operation.
This method performs a single-point crossover on the two parent individuals to generate an offspring individual. The crossover point is chosen randomly, and the genetic material from the two parents is combined to create the offspring.
- Parameters
-
generator | The random number generator used to determine the crossover point. |
Implements Operator.
◆ setIndividual()
void PureSinglePointCrossover::setIndividual |
( |
Individual & | individual | ) |
|
|
inlinevirtual |
◆ setParents()
Sets the parents and offspring for the crossover operation.
- Parameters
-
offspring | The offspring individual to be generated. |
parent1 | The first parent individual. |
parent2 | The second parent individual. |
Implements Operator.
◆ setPopulation()
void PureSinglePointCrossover::setPopulation |
( |
const std::vector< Individual > & | population, |
|
|
std::vector< Individual > & | selected ) |
|
inlinevirtual |
Sets the population and selected vectors for the selection operation.
This method is not used in the PureSinglePointCrossover class.
- Parameters
-
Implements Operator.
◆ crossoverRate
double PureSinglePointCrossover::crossoverRate |
|
private |
The crossover rate used to determine if crossover should occur
◆ offspring
Pointer to the offspring individual
◆ parent1
const Individual* PureSinglePointCrossover::parent1 |
|
private |
Pointer to the first parent individual
◆ parent2
const Individual* PureSinglePointCrossover::parent2 |
|
private |
Pointer to the second parent individual
The documentation for this class was generated from the following files: