SubsetRandomSampling#

class pybrops.opt.algo.pymoo_addon.SubsetRandomSampling(setspace, replace=False)[source]#

Bases: Sampling

Class implementing subset sampling for chromosome construction.

Constructor for subset random sampling.

Parameters:
  • setspace (numpy.ndarray) – Set space from which to sample elements.

  • replace (numpy.ndarray) – Whether to replace elements when subset sampling.

Methods

do

Sample new points with problem information if necessary.

Attributes

replace

Whether to replace elements when subset sampling.

setspace

Set space from which to sample elements.

__call__(problem, elem, *args, to_numpy=False, **kwargs)#

Call self as a function.

do(problem, n_samples, **kwargs)#

Sample new points with problem information if necessary.

Parameters:
  • problem (Problem) – The problem to which points should be sampled. (lower and upper bounds, discrete, binary, …)

  • n_samples (int) – Number of samples

Returns:

pop – The output population after sampling

Return type:

Population

property replace: bool#

Whether to replace elements when subset sampling.

property setspace: ndarray#

Set space from which to sample elements.