Bases: Crossover[FloatSolution, FloatSolution]
Arithmetic Crossover for real-valued solutions.
This operator performs an arithmetic combination of two parent solutions to produce two offspring. For each variable, a random weight (alpha) is used to compute a weighted average of the parent values.
The crossover works by: 1. For each variable, generate a random weight alpha in [0, 1] 2. Calculate new values as:
child1 = alpha * parent1 + (1 - alpha) * parent2
child2 = (1 - alpha) * parent1 + alpha * parent2
Apply bounds repair if values fall outside the variable bounds
probability: Crossover probability (0.0 to 1.0) repair_operator: Optional function to repair out-of-bounds values.
If None, values are clamped to the variable bounds using min/max. Signature: repair_operator(value: float, lower_bound: float, upper_bound: float) -> float
ValueError: If probability is not in [0,1]
Michalewicz, Z. (1996). Genetic Algorithms + Data Structures = Evolution Programs. Springer-Verlag, Berlin.
Perform the arithmetic crossover operation.
probability: Crossover probability parent1: First parent solution parent2: Second parent solution
A list containing two offspring solutions
Bases: Crossover[FloatSolution, FloatSolution]
BLX-αβ (Blend Crossover with separate alpha and beta) for real-valued solutions.
An extension of BLX-α crossover that uses two different expansion factors (α and β) for the lower and upper bounds respectively. This allows for asymmetric exploration around the parent solutions.
The crossover works by: 1. For each variable, determine the min and max values from the parents 2. Calculate the range between parents (d = max - min) 3. Expand the range by α*d below the min and β*d above the max 4. Sample new values uniformly from this expanded range 5. Apply bounds repair if values fall outside the variable bounds
probability: Crossover probability (0.0 to 1.0) alpha: Lower expansion factor (must be ≥ 0). Controls exploration below parents:
alpha = 0: No exploration below the smaller parent value
alpha > 0: Expands range below smaller parent by alpha*d
Typical values: 0.1 to 0.5
beta = 0: No exploration above the larger parent value
beta > 0: Expands range above larger parent by beta*d
Typical values: 0.1 to 0.5
If None, values are clamped to the variable bounds using min/max. Signature: repair_operator(value: float, lower_bound: float, upper_bound: float) -> float
ValueError: If probability is not in [0,1] or alpha/beta are negative.
Eshelman, L. J., & Schaffer, J. D. (1993). Real-coded genetic algorithms and interval-schemata. Foundations of genetic algorithms, 2, 187-202.
Bases: Crossover[FloatSolution, FloatSolution]
BLX-α (Blend Crossover) for real-valued solutions.
The BLX-α crossover creates offspring within a range that is extended by a factor of α (alpha) beyond the range defined by the parent values. This allows for exploration beyond the region defined by the parents while maintaining a balance between exploration and exploitation.
The crossover works by: 1. For each variable, determine the min and max values from the parents 2. Calculate the range between parents 3. Expand the range by α * range in both directions 4. Sample new values uniformly from this expanded range 5. Apply bounds repair if values fall outside the variable bounds
probability: Crossover probability (0.0 to 1.0) alpha: Expansion factor (must be ≥ 0). Controls the exploration range:
alpha = 0: Offspring will be in the range defined by parents (no exploration)
alpha > 0: Offspring can be outside parent range (increased exploration)
Typical values: 0.1 to 0.5
If None, values are clamped to the variable bounds using min/max. Signature: repair_operator(value: float, lower_bound: float, upper_bound: float) -> float
ValueError: If probability is not in [0,1] or alpha is negative.
Eshelman, L. J., & Schaffer, J. D. (1993). Real-coded genetic algorithms and interval-schemata. Foundations of genetic algorithms, 2, 187-202.
Bases: Crossover[PermutationSolution, PermutationSolution]
Bases: Crossover[CompositeSolution, CompositeSolution]
Bases: Crossover[FloatSolution, FloatSolution]
Differential Evolution (DE) crossover operator for real-valued solutions.
This operator implements the standard DE crossover used in the DE/rand/1/bin and DE/best/1/bin variants. It creates a trial vector by combining the target vector with a difference vector, then performs binomial crossover between the target and trial vectors.
The operator requires three parents and three mutation factors (F, CR, and K). The first parent is the target vector, while the other two are used to compute the difference vector.
taken from the trial vector versus the target vector.
f: Differential weight (mutation factor) for the difference vector. Typically in [0, 2]. k: Scaling factor for the difference vector. Typically in [0, 1].
ValueError: If cr is not in [0,1] or f/k are negative.
Storn, R., & Price, K. (1997). Differential evolution - a simple and efficient heuristic for global optimization over continuous spaces. Journal of global optimization, 11(4), 341-359.
Bases: Crossover[IntegerSolution, IntegerSolution]
Bases: Crossover[PermutationSolution, PermutationSolution]
Bases: Crossover[FloatSolution, FloatSolution]
Simulated Binary Crossover (SBX) for real-valued solutions.
SBX is a popular crossover operator for real-coded genetic algorithms that simulates the behavior of the single-point crossover operator in binary-coded GAs. It creates offspring solutions based on a probability distribution centered around the parent solutions, with the spread of the distribution controlled by the distribution index.
probability: Crossover probability (0.0 to 1.0) distribution_index: Distribution index (must be ≥ 0). Higher values produce offspring closer to parents.
Typical values range from 5 to 30, with 20 being a common default.
Exception: If distribution_index is negative
Bases: Crossover[BinarySolution, BinarySolution]
A high-performance single-point crossover operator for BinarySolution.
This implementation uses NumPy’s vectorized operations for better performance when working with BinarySolution solutions. It performs a single-point crossover between two parent solutions to produce two offspring.
The crossover point is selected uniformly at random from all possible bit positions in the solution. The bits after the crossover point are swapped between the two parents to create the offspring.
probability: The probability of applying the crossover (must be between 0.0 and 1.0)
ValueError: If the probability is not in the range [0.0, 1.0]
Execute the single-point crossover operation.
Both parents must have the same number of bits.
List[BinarySolution]: A list containing two offspring solutions.
This method assumes that both parents are valid BinarySolution instances with properly initialized bits attributes.
Bases: Crossover[FloatSolution, FloatSolution]
Unimodal Normal Distribution Crossover (UNDX) for real-valued solutions.
UNDX is a multi-parent crossover operator that generates offspring based on the normal distribution defined by three parent solutions. It is particularly effective for continuous optimization problems as it preserves the statistics of the population.
Onikura, T., & Kobayashi, S. (1999). Extended UNIMODAL DISTRIBUTION CROSSOVER for REAL-CODED GENETIC ALGORITHMS. In Proceedings of the 1999 Congress on Evolutionary Computation-CEC99 (Cat. No. 99TH8406) (Vol. 2, pp. 1581-1588). IEEE.
probability: Crossover probability (0.0 to 1.0) zeta: Controls the spread along the line connecting parents (typically in [0.1, 1.0],
where smaller values produce offspring closer to the parents)
where smaller values produce more concentrated distributions)
If None, values are clamped to the variable bounds using min/max. Signature: repair_operator(value: float, lower_bound: float, upper_bound: float) -> float
ValueError: If probability is not in [0,1] or if zeta or eta are negative
Perform the UNDX crossover operation.
probability: Crossover probability parent1: First parent solution parent2: Second parent solution parent3: Third parent solution (used to determine the orthogonal direction)
A list containing two offspring solutions