propulate.propagators.ga
Module Contents
Classes
Initialize point-mutation propagator. |
|
Initialize random point-mutation propagator. |
|
Initialize interval-mutation propagator. |
|
Initialize uniform crossover propagator. |
|
Initialize a multiple-crossover propagator. |
|
Initialize a sigmoid-crossover propagator. |
- class propulate.propagators.ga.PointMutation(limits: Mapping[str, Tuple[float, float] | Tuple[int, int] | Tuple[str, Ellipsis]], points: int = 1, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize point-mutation propagator.
- Parameters:
limits (Dict[str, Tuple[float, float]] | Dict[str, Tuple[int, int]] | Dict[str, Tuple[str, ...]]) – The search space, i.e., the limits of the (hyper-)parameters to be optimized.
points (int, optional) – The number of points to mutate. Default is 1.
probability (float, optional) – The probability of application. Default is 1.0.
rng (random.Random, optional) – The separate random number generator of the Propulate optimization.
- Raises:
ValueError – If the requested number of points to mutate is greater than the number of traits.
- __call__(ind: propulate.population.Individual) propulate.population.Individual
Apply the point-mutation propagator.
- Parameters:
ind (propulate.population.Individual) – The individual the propagator is applied to.
- Returns:
The possibly point-mutated individual after application of the propagator.
- Return type:
- class propulate.propagators.ga.RandomPointMutation(limits: Dict[str, Tuple[float, float]] | Dict[str, Tuple[int, int]] | Dict[str, Tuple[str, Ellipsis]], min_points: int = 1, max_points: int = 1, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize random point-mutation propagator.
- Parameters:
limits (Dict[str, Tuple[float, float]] | Dict[str, Tuple[int, int]] | Dict[str, Tuple[str, ...]]) – The limits of the parameters to optimize, i.e., the search space.
min_points (int, optional) – minimum number of points to mutate. Default is 1.
max_points (int, optional) – maximum number of points to mutate. Default is 1.
probability (float, optional) – probability of application. Default is 1.0.
rng (random.Random, optional) – random number generator
- Raises:
ValueError – If no or a negative number of points shall be mutated. If there are fewer traits than requested number of points to mutate. If the requested minimum number of points to mutate is greater than the requested maximum number.
- __call__(ind: propulate.population.Individual) propulate.population.Individual
Apply the random-point-mutation propagator.
- Parameters:
ind (propulate.population.Individual) – The individual the propagator is applied to.
- Returns:
The possibly point-mutated individual after application of the propagator.
- Return type:
- class propulate.propagators.ga.IntervalMutationNormal(limits: Mapping[str, Tuple[float, float] | Tuple[int, int] | Tuple[str, Ellipsis]], sigma_factor: float = 0.1, points: int = 1, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize interval-mutation propagator.
- Parameters:
limits (Dict[str, Tuple[float, float]] | Dict[str, Tuple[int, int]] | Dict[str, Tuple[str, ...]]) – The limits of the (hyper-)parameters to be optimized, i.e., the search space.
sigma_factor (float, optional) – The scaling factor for the interval width to obtain the standard deviation. Default is 0.1.
points (int, optional) – The number of points to mutate. Default is 1.
probability (float, optional) – The probability of application, Default is 1.0
rng (random.Random, optional) – The separate random number generator for the Propulate optimization.
- Raises:
ValueError – If the individuals has fewer continuous traits than the requested number of points to mutate.
- __call__(ind: propulate.population.Individual) propulate.population.Individual
Apply the interval-mutation propagator.
- Parameters:
ind (propulate.population.Individual) – The input individual the propagator is applied to.
- Returns:
The possibly interval-mutated output individual after application of the propagator.
- Return type:
- class propulate.propagators.ga.CrossoverUniform(relative_parent_contribution: float = 0.5, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize uniform crossover propagator.
- Parameters:
relative_parent_contribution (float, optional) – The relative parent contribution with respect to the first parent. Default is 0.5.
probability (float, optional) – The probability of application. Default is 1.0.
rng (random.Random, optional) – The separate random number generator for the Propulate optimization.
- Raises:
ValueError – If the relative parent contribution is not within [0, 1].
- __call__(inds: List[propulate.population.Individual]) propulate.population.Individual
Apply the uniform-crossover propagator.
- Parameters:
inds (List[propulate.population.Individual]) – The individuals the propagator is applied to.
- Returns:
The possibly cross-bred individual after application of the propagator.
- Return type:
- class propulate.propagators.ga.CrossoverMultiple(parents: int = -1, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize a multiple-crossover propagator.
- Parameters:
probability (float, optional) – The probability of application. Default is 1.0.
parents (int, optional) – The number of parents (not used) here. Default is -1.
rng (random.Random, optional) – The separate random number generator for the Propulate optimization.
- __call__(inds: List[propulate.population.Individual]) propulate.population.Individual
Apply the multi-crossover propagator.
- Parameters:
inds (list[propulate.population.Individual]) – The individuals the propagator is applied to.
- Returns:
The possibly cross-bred individual after application of propagator
- Return type:
- class propulate.propagators.ga.CrossoverSigmoid(temperature: float = 1.0, probability: float = 1.0, rng: random.Random | None = None)
Bases:
propulate.propagators.base.StochasticInitialize a sigmoid-crossover propagator.
- Parameters:
temperature (float, optional) – The temperature in the Boltzmann factor of the sigmoid probability. Default is 1.0.
probability (float, optional) – The probability of application. Default is 1.0.
rng (random.Random, optional) – The separate random number generator for the Propulate optimization.
- __call__(inds: List[propulate.population.Individual]) propulate.population.Individual
Apply the sigmoid-crossover propagator.
- Parameters:
inds (List[propulate.population.Individual]) – The individuals the propagator is applied to.
- Returns:
The possibly cross-bred individual after application of the propagator.
- Return type: