SearchSpace API#

Layer 4: Extend Framework

The SearchSpace API is the public facade for candidate representations and space-specific services. Use names from saealib.space rather than the space implementation modules.

Spaces, services, and adapters#

Search spaces#

Search spaces provide GenomeBatch representations.

saealib.space.SearchSpace

Protocol for an optimization search space.

saealib.space.ServiceRegistry

Registry of services offered by a SearchSpace.

saealib.space.ValidationResult

The result of validating a GenomeBatch against a SearchSpace.

saealib.core.contracts.RepresentationSpec

A concrete representation: a registered kind name plus its parameters.

saealib.space.VectorSpace

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

saealib.space.ObjectSpace

A search space for arbitrary Python objects.

saealib.space.SequenceSpace

A search space for finite-alphabet sequences with a length range.

saealib.space.PermutationSpace

A search space whose genomes are permutations of range(length).

SearchSpace services#

SearchSpace services such as sampling and validation are capabilities provided by a space.

saealib.space.GenomeCodec

Service for encoding genomes into persistable primitives and decoding back.

saealib.space.SamplingService

Service for drawing new genomes from a SearchSpace.

saealib.space.ValidationService

Service for checking if genomes are well-formed for a space.

Adapters#

EvaluationAdapter is an adapter at the evaluation boundary that converts a GenomeBatch into an EvaluationPayload. FeatureEncoder is an adapter subtype exposed as saealib.space.FeatureEncoder. It converts a GenomeBatch into a FeatureBatch and determines which features a surrogate can learn. It differs in kind from space capabilities such as SamplingService. In the current implementation, the SurrogateManager contract declares ServiceRequirement("FeatureEncoder"), and VectorSpace registers a default encoder as a service, so numeric vector spaces resolve it without extra configuration. ObjectSpace, PermutationSpace, and SequenceSpace fail to resolve it unless the user provides a FeatureEncoder. The user decides which input is passed to the surrogate.

saealib.space.FeatureEncoder

Service that maps opaque genomes to surrogate feature rows.