metaheuristic_designer.simple package

Submodules

metaheuristic_designer.simple.bayesian_optimization module

Ready-to-run Bayesian Optimisation wrappers.

bayesian_optimization_binary(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for binary-coded vectors (not supported yet).

bayesian_optimization_discrete(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for integer-coded vectors (not supported yet).

bayesian_optimization_real(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Number of individuals in the initial population (default 50).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.differential_evolution module

Ready-to-run Differential Evolution wrappers.

differential_evolution_binary(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for binary-encoded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding; defaults to SigmoidEncoding.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

differential_evolution_discrete(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (float → int).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

differential_evolution_real(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.evolution_strategy module

Ready-to-run Evolution Strategy wrappers.

evolution_strategy_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.genetic_algorithm module

Ready-to-run Genetic Algorithm wrappers.

genetic_algorithm_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.hill_climb module

Ready-to-run Hill Climbing wrappers.

hill_climb_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.particle_swarm module

Ready-to-run Particle Swarm Optimisation wrappers.

particle_swarm_binary(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding; defaults to SigmoidEncoding.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

particle_swarm_discrete(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (float → int).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

particle_swarm_real(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

metaheuristic_designer.simple.simulated_annealing module

Ready-to-run Simulated Annealing wrappers.

simulated_annealing_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

Module contents

Ready-to-run wrappers that build complete algorithms from a few hyperparameters.

genetic_algorithm_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

genetic_algorithm_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, population_size: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Genetic Algorithm for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • population_size (int, optional) – Population size (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

hill_climb_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Hill Climbing for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

local_search_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, samples_per_iteration: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Local Search for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • samples_per_iteration (int, optional) – Number of samples evaluated per iteration (default 100).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

local_search_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, samples_per_iteration: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Local Search for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • samples_per_iteration (int, optional) – Number of samples evaluated per iteration (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

local_search_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, samples_per_iteration: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Local Search for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • samples_per_iteration (int, optional) – Number of samples evaluated per iteration (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

local_search_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, samples_per_iteration: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Local Search for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • samples_per_iteration (int, optional) – Number of samples evaluated per iteration (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

particle_swarm_binary(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding; defaults to SigmoidEncoding.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

particle_swarm_discrete(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (float → int).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

particle_swarm_real(objfunc: ObjectiveFunc, population_size: int = 100, w: float = 0.7, c1: float = 1.5, c2: float = 1.5, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Particle Swarm Optimisation for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Swarm size (default 100).

  • w (float, optional) – Inertia weight (default 0.7).

  • c1 (float, optional) – Cognitive acceleration coefficient (default 1.5).

  • c2 (float, optional) – Social acceleration coefficient (default 1.5).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

random_search_binary(objfunc: ObjectiveFunc, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Random Search for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

random_search_permutation(objfunc: ObjectiveFunc, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Random Search for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

random_search_discrete(objfunc: ObjectiveFunc, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Random Search for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

random_search_real(objfunc: ObjectiveFunc, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Random Search for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

evolution_strategy_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, population_size: int = 100, offspring_size: int = 500, elitist: bool = False, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Evolution Strategy for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • population_size (int, optional) – Population size (default 100).

  • offspring_size (int, optional) – Number of offspring per generation (default 500).

  • elitist (bool, optional) – If True, use (μ+λ) selection; otherwise (μ,λ).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

differential_evolution_binary(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for binary-encoded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding; defaults to SigmoidEncoding.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

differential_evolution_discrete(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (float → int).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

differential_evolution_real(objfunc: ObjectiveFunc, population_size: int = 100, F: float = 0.8, Cr: float = 0.9, de_operator_name: str = 'de/rand/1', encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Differential Evolution for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Population size (default 100).

  • F (float, optional) – Mutation scale factor (default 0.8).

  • Cr (float, optional) – Crossover probability (default 0.9).

  • de_operator_name (str, optional) – DE variant (default "de/rand/1").

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_binary(objfunc: ObjectiveFunc, mutated_bits: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for binary-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutated_bits (int, optional) – Number of bits flipped per mutation (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding; defaults to TypeCastEncoding (int → bool).

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_permutation(objfunc: ObjectiveFunc, swapped_positions: int = 2, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for permutation-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • swapped_positions (int, optional) – Number of positions swapped per mutation (default 2).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_discrete(objfunc: ObjectiveFunc, resampled_components: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for integer-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • resampled_components (int, optional) – Number of components resampled per mutation (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

simulated_annealing_real(objfunc: ObjectiveFunc, mutation_strength: float = 0.01, mutated_components: int = 1, initial_temperature: float = 1.0, alpha: float = 0.997, iterations: int = 100, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Simulated Annealing for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • mutation_strength (float, optional) – Standard deviation of Gaussian mutation (default 1e-2).

  • mutated_components (int, optional) – Number of components mutated per individual (default 1).

  • initial_temperature (float, optional) – Starting temperature (default 1.0).

  • alpha (float, optional) – Cooling factor per iteration (default 0.997).

  • iterations (int, optional) – Number of iterations at constant temperature (default 100).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.

bayesian_optimization_binary(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for binary-coded vectors (not supported yet).

bayesian_optimization_discrete(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for integer-coded vectors (not supported yet).

bayesian_optimization_real(objfunc: ObjectiveFunc, population_size: int = 50, encoding: Encoding | None = None, random_state: int | Generator | None = None, **kwargs) Algorithm[source]

Bayesian Optimisation for real-coded vectors.

Parameters:
  • objfunc (ObjectiveFunc) – The objective function to optimise.

  • population_size (int, optional) – Number of individuals in the initial population (default 50).

  • encoding (Encoding, optional) – Encoding applied to the genotype.

  • random_state (RNGLike, optional) – Random seed or generator.

  • **kwargs – Forwarded to Algorithm.