Sampling¶
In the beginning, initial points need to be sampled. pymoo offers different sampling methods depending on the variable type.
Random Sampling¶
[1]:
from pymoo.core.problem import Problem
from pymoo.operators.sampling.rnd import FloatRandomSampling
from pymoo.util import plotting
problem = Problem(n_var=2, xl=0, xu=1)
sampling = FloatRandomSampling()
X = sampling(problem, 200).get("X")
plotting.plot(X, no_fill=True)
Latin Hypercube Sampling¶
[2]:
from pymoo.operators.sampling.lhs import LHS
sampling = LHS()
X = sampling(problem, 200).get("X")
plotting.plot(X, no_fill=True)