MCPcopy Create free account
hub / github.com/anyoptimization/pymoo / _do

Method _do

pymoo/util/ref_dirs/sample_and_map.py:33–53  ·  view source on GitHub ↗

Generate reference directions via Latin Hypercube sampling. Args: random_state: Random seed for reproducibility. Returns: Array of reference directions.

(self, random_state: int | None = None)

Source from the content-addressed store, hash-verified

31 self.n_points = n_points
32
33 def _do(self, random_state: int | None = None) -> NDArray:
34 """Generate reference directions via Latin Hypercube sampling.
35
36 Args:
37 random_state: Random seed for reproducibility.
38
39 Returns:
40 Array of reference directions.
41 """
42 problem = Problem(n_var=self.n_dim, xl=0.0, xu=1.0) # type: ignore[abstract]
43 sampling = LatinHypercubeSampling()
44
45 x = sampling(
46 problem,
47 self.n_points - self.n_dim,
48 to_numpy=True,
49 random_state=random_state,
50 )
51 x = map_onto_unit_simplex(x, "kraemer")
52 x = np.vstack([x, np.eye(self.n_dim)])
53 return x

Callers

nothing calls this directly

Calls 3

ProblemClass · 0.90
map_onto_unit_simplexFunction · 0.90

Tested by

no test coverage detected