metaheuristic_designer.initializers.sobol_initializer module#

Initializer that implements Sobol sequences as an initialization technique.

class SobolInitializer(dimension, lower_bound, upper_bound, population_size=1, scramble=True, fallback=None, encoding=None, dtype=<class 'float'>, rng=None)[source]#

Bases: Initializer

Initializer that generates individuals using the Sobol sequences, this is a quasi-random method designed for covering the space with low-discrepancy samples.

Parameters:
dimensionint

Length of the genotype vector.

lower_boundfloat or array

Lower bound(s) of the distribution. If an array is given, it must have length dimension.

upper_boundfloat or array

Upper bound(s) of the distribution. Must match the shape of lower_bound.

population_sizeint, optional

Number of individuals to generate (default 1).

encodingEncoding, optional

Encoding that will be passed to each individual.

dtypetype, optional

Desired NumPy dtype of the generated vectors (default float).

rngRNGLike, optional

Random number generator.

Parameters:

fallback (Optional[Initializer])

Methods

generate_individual()

Generate a single individual.

generate_population([n_individuals])

Create a fully formed population of n_individuals individuals.

generate_random()

Generate a single random genotype vector (1-D array).

get_state()

Return a minimal dictionary identifying this initializer.

generate_random()[source]#

Generate a single random genotype vector (1-D array).

Returns:
VectorLike

A newly generated genotype vector (1-D array).

generate_population(n_individuals=None)[source]#

Create a fully formed population of n_individuals individuals.

Return type:

Population

Parameters:
objfunc: ObjectiveFunc

Objective function that will be propagated to each individual.

n_individual: int, optional

Number of individuals to generate

Returns:
generated_population: Population

Newly generated population.

Parameters:

n_individuals (int | None)