GERARDIUM RUSH - MINERAL CIRCUIT OPTIMIZER v1.0.0
"A powerful tool designed to optimize circuit configurations using advanced genetic algorithms." - by Pentlandite
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
UniformCrossover Class Reference

#include <UniformCrossover.h>

Inheritance diagram for UniformCrossover:
Inheritance graph
Collaboration diagram for UniformCrossover:
Collaboration graph

Public Member Functions

 UniformCrossover (const Algorithm_Parameters &params)
 Constructs a UniformCrossover object with specified algorithm parameters.
 
void setParents (Individual &offspring, const Individual &parent1, const Individual &parent2) override
 Sets the parents and offspring for the crossover operation.
 
void setPopulation (const std::vector< Individual > &population, std::vector< Individual > &selected)
 Sets the population and selected vectors for the selection operation.
 
void setIndividual (Individual &individual)
 Sets the individual for the selection operation.
 
void apply (std::mt19937 &generator) override
 Performs the uniform crossover operation.
 
- Public Member Functions inherited from Operator
virtual ~Operator ()=default
 Virtual destructor for the Operator class.
 

Private Attributes

Individualoffspring
 
const Individualparent1
 
const Individualparent2
 
double crossoverRate
 

Constructor & Destructor Documentation

◆ UniformCrossover()

UniformCrossover::UniformCrossover ( const Algorithm_Parameters & params)

Constructs a UniformCrossover object with specified algorithm parameters.

Parameters
paramsThe algorithm parameters including the crossover rate.

Member Function Documentation

◆ apply()

void UniformCrossover::apply ( std::mt19937 & generator)
overridevirtual

Performs the uniform crossover operation.

This method performs a uniform crossover on the two parent individuals to generate an offspring individual. Each gene in the offspring is chosen randomly from one of the two parents.

Parameters
generatorThe random number generator used to determine gene selection.

Implements Operator.

◆ setIndividual()

void UniformCrossover::setIndividual ( Individual & individual)
inlinevirtual

Sets the individual for the selection operation.

This method is not used in the UniformCrossover class.

Parameters
individualThe individual to be set.

Implements Operator.

◆ setParents()

void UniformCrossover::setParents ( Individual & offspring,
const Individual & parent1,
const Individual & parent2 )
overridevirtual

Sets the parents and offspring for the crossover operation.

Parameters
offspringThe offspring individual to be generated.
parent1The first parent individual.
parent2The second parent individual.

Implements Operator.

◆ setPopulation()

void UniformCrossover::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 UniformCrossover class.

Parameters
populationThe vector of individuals in the population.
selectedThe vector of selected individuals.

Implements Operator.

Field Documentation

◆ crossoverRate

double UniformCrossover::crossoverRate
private

The crossover rate used to determine if crossover should occur

◆ offspring

Individual* UniformCrossover::offspring
private

Pointer to the offspring individual

◆ parent1

const Individual* UniformCrossover::parent1
private

Pointer to the first parent individual

◆ parent2

const Individual* UniformCrossover::parent2
private

Pointer to the second parent individual


The documentation for this class was generated from the following files: