metaheuristic_designer.initializers.gaussian_initializer module#

Initializer that samples from a Gaussian (normal) distribution.

class GaussianInitializer(dimension, g_mean, g_std, pop_size=1, encoding=None, dtype=<class 'float'>, rng=None)[source]#

Bases: Initializer

Initializer that generates individuals with values drawn from a Gaussian (normal) distribution.

Parameters:
dimensionint

Length of the genotype vector.

g_meanfloat or array

Mean of the distribution. If an array is given, it must have length dimension.

g_stdfloat or array

Standard deviation of the distribution. If an array is given, it must have length dimension.

pop_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.

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).