saealib.space.VectorSpace#

class saealib.space.VectorSpace(dim, lb, ub, *, atol=1e-16, rtol=0.0)[source]#

Bases: object

A search space for continuous numeric vectors defined by variable bounds.

Parameters:
  • dim (int) – Dimension of the vector space.

  • lb (Sequence[float] | np.ndarray) – Lower bounds per dimension.

  • ub (Sequence[float] | np.ndarray) – Upper bounds per dimension.

  • atol (float, optional) – Absolute tolerance for approximate equivalence matching (default: 1e-16).

  • rtol (float, optional) – Relative tolerance for approximate equivalence matching (default: 0.0).

Methods

__init__

sample

Sample n random genomes uniformly within bounds.

validate

Check if genomes batch is well-formed and within bounds.

Method Details

VectorSpace.__init__(dim, lb, ub, *, atol=1e-16, rtol=0.0)[source]#
Parameters:
  • dim (int)

  • lb (Sequence[float] | ndarray)

  • ub (Sequence[float] | ndarray)

  • atol (float)

  • rtol (float)

Return type:

None

VectorSpace.sample(n, rng=None)[source]#

Sample n random genomes uniformly within bounds.

Parameters:
  • n (int)

  • rng (Generator | None)

Return type:

DenseVectorBatch

VectorSpace.validate(genomes)[source]#

Check if genomes batch is well-formed and within bounds.

Parameters:

genomes (GenomeBatch)

Return type:

ValidationResult