saealib.Crossover¶
- class saealib.Crossover[source]¶
Bases:
ABCBase class for crossover operators.
- n_parents¶
Number of parents required per crossover call. Default is 2. Subclasses may override this class attribute if they require a different number of parents.
- Type:
int
- n_children¶
Number of offspring produced per crossover call. Default is 2. Subclasses may override this class attribute if they produce a different number of offspring.
- Type:
int
Methods
Method Details
- Crossover.__init__()¶
- abstract Crossover.crossover(parent, rng=Generator(PCG64) at 0x7F65E9C911C0)[source]¶
Execute crossover.
- Parameters:
parent (np.ndarray) – Parent individuals. shape = (n_parents, dim)
rng (np.random.Generator, optional) – Random number generator, by default np.random.default_rng()
- Returns:
Offspring individuals. shape = (n_offspring, dim)
- Return type:
np.ndarray