metaheuristic_designer.strategies.EDA package#

Submodules#

Module contents#

Estimation of Distribution Algorithms (EDA) strategies.

class BernoulliPBIL(initializer, parent_sel=None, survivor_sel=None, name='BernoulliPBIL', offspring_size=None, rng=None, p=None, lr=0.001, noise=0, **kwargs)[source]#

Bases: EDAStrategy

PBIL for binary vectors using a Bernoulli distribution.

The probability vector p is updated each generation with a learning rate and optional Gaussian noise, then a new population is sampled.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "BernoulliPBIL").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

parray-like, optional

Initial probability vector. Defaults to uniform over [0,1].

lrfloat, optional

Learning rate for updating p (default 1e-3).

noisefloat, optional

Standard deviation of Gaussian noise added to p (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

class BernoulliUMDA(initializer, parent_sel=None, survivor_sel=None, name='BernoulliUMDA', offspring_size=None, rng=None, p=0.5, noise=0, **kwargs)[source]#

Bases: EDAStrategy

UMDA for binary vectors using a Bernoulli distribution.

The probability vector is estimated from the selected parents (no smoothing). Gaussian noise can optionally be added.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "BernoulliUMDA").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

pfloat or array-like, optional

Initial probability (default 0.5).

noisefloat, optional

Gaussian noise standard deviation (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

class BinomialPBIL(initializer, parent_sel=None, survivor_sel=None, name='BernoulliPBIL', offspring_size=None, rng=None, p=0.5, n=None, lr=0.001, noise=0, **kwargs)[source]#

Bases: EDAStrategy

PBIL for discrete vectors using a Binomial distribution.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "BinomialPBIL").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

pfloat or array-like, optional

Initial success probability (default 0.5).

nint or array-like

Number of trials. Must be provided; there is no default.

lrfloat, optional

Learning rate (default 1e-3).

noisefloat, optional

Gaussian noise standard deviation (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Return type:

Operator

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

Parameters:

population (Population)

class BinomialUMDA(initializer, parent_sel=None, survivor_sel=None, name='BinomialUMDA', offspring_size=None, rng=None, p=0.5, n=None, noise=0, **kwargs)[source]#

Bases: EDAStrategy

UMDA for discrete vectors using a Binomial distribution.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "BinomialUMDA").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

pfloat or array-like, optional

Initial success probability (default 0.5).

nint or array-like

Number of trials. Must be provided; there is no default.

noisefloat, optional

Gaussian noise standard deviation (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

class CrossEntropyMethod(initializer, name='CrossEntropyMethod', rng=None, elite_amount=None, scale='calculated', **kwargs)[source]#

Bases: EDAStrategy

Cross-Entropy Method for continuous optimization.

At each generation, the best individuals are selected and the mean of a Gaussian distribution is updated to their location, optionally with a scale estimated from the data. New solutions are sampled from this distribution.

Note

This class will be refactored when the EDA interface is finalized. Smoothing (learning rate) for the mean still needs to be added.

Parameters:
initializerInitializer

Population initializer.

namestr, optional

Display name (default "CrossEntropyMethod").

rngRNGLike, optional

Random number generator.

elite_amountint or SchedulableParameter, optional

Number of best individuals used to estimate the distribution.

scaleVectorLike or "calculated", optional

Standard deviation of the Gaussian. If "calculated", it is estimated from the selected individuals.

**kwargs

Forwarded to StaticPopulation.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:
  • initializer (Initializer)

  • name (str)

  • rng (int | Generator | None)

  • elite_amount (int | SchedulableParameter | None)

  • scale (ndarray[tuple[int], floating] | ndarray[tuple[int], integer] | ndarray[tuple[int], uint8 | bool] | str)

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Return type:

Population

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

Parameters:

population (Population)

class GaussianPBIL(initializer, parent_sel=None, survivor_sel=None, name='GaussianPBIL', offspring_size=None, rng=None, loc=None, scale=1, lr=0.001, noise=0, **kwargs)[source]#

Bases: EDAStrategy

PBIL for continuous vectors using a Gaussian distribution.

The location vector loc is updated each generation with a learning rate and optional Gaussian noise, then a new population is sampled.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "GaussianPBIL").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

locarray-like, optional

Initial mean vector (default None; the operator uses a fallback).

scalefloat or array-like, optional

Standard deviation (default 1).

lrfloat, optional

Learning rate (default 1e-3).

noisefloat, optional

Gaussian noise standard deviation added to loc (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.

class GaussianUMDA(initializer, parent_sel=None, survivor_sel=None, name='GaussianUMDA', offspring_size=None, rng=None, loc=0, scale=1, noise=0, **kwargs)[source]#

Bases: EDAStrategy

UMDA for continuous vectors using a Gaussian distribution.

The location vector is estimated from the selected parents. Gaussian noise can optionally be added.

Reference: https://doi.org/10.1016/j.swevo.2011.08.003

Parameters:
initializerInitializer

Population initializer.

parent_selParentSelection, optional

Parent selection method.

survivor_selSurvivorSelection, optional

Survivor selection method.

namestr, optional

Display name (default "GaussianUMDA").

offspring_sizeint or SchedulableParameter, optional

Number of offspring per generation.

rngRNGLike, optional

Random number generator.

locfloat or array-like, optional

Initial mean (default 0).

scalefloat or array-like, optional

Standard deviation (default 1).

noisefloat, optional

Gaussian noise standard deviation added to loc (default 0).

**kwargs

Forwarded to EDAStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:

Methods

estimate_parameters(population)

Utilizes the samples present in the input population to estimate the parameters used by the operator.

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

estimate_parameters(population)[source]#

Utilizes the samples present in the input population to estimate the parameters used by the operator.

Parameters:
populationPopulation

Data to use for estimating parameters.

Returns:
Operator

Newly configured operator.