pymead.optimization.sampling.ConstrictedRandomSampling#

class ConstrictedRandomSampling(n_samples: int, norm_param_list: list, max_sampling_width: float)[source]#

Bases: Sampling

__init__(n_samples: int, norm_param_list: list, max_sampling_width: float)[source]#

A custom sampling method where the probability distribution for the new parameter value is uniform with a specified width on either side of the original parameter value. The probability of falling above or below the original parameter value is 0.5 and 0.5, respectively. The sampling width is truncated by the parameter bounds if necessary, retaining a probability of 0.5 on both sides of the original parameter value.

Parameters:
  • n_samples (int) – Number of samples

  • norm_param_list (list) – List of normalized parameter values (usually from extract_parameters in MEA).

  • max_sampling_width (float) – Maximum distance of the new parameter value from the original parameter value. The actual new parameter value falls randomly in between the original parameter value and this maximum distance in either direction.

Methods

sample()

Randomly samples the design space.

sample() List[List[float]][source]#

Randomly samples the design space.

Returns:

A new nested list of normalized parameter values to be used to update the airfoil system. Each row of the 2-D list represents a set of genes to apply to each Chromosome, and each value in the row represents an individual gene. These individual genes are bounds-normalized values representing a new value for a particular design variable in the geometry collection.

Return type:

List[List[float]]