37 std::int64_t
step = 1,
41 const std::string&
name() const noexcept {
return name_; }
43 std::int64_t
low() const noexcept {
return low_; }
45 std::int64_t
high() const noexcept {
return high_; }
47 std::int64_t
step() const noexcept {
return step_; }
49 bool log() const noexcept {
return log_; }
74 std::optional<double>
step = std::nullopt,
78 const std::string&
name() const noexcept {
return name_; }
80 double low() const noexcept {
return low_; }
82 double high() const noexcept {
return high_; }
84 const std::optional<double>&
step() const noexcept {
return step_; }
86 bool log() const noexcept {
return log_; }
94 std::optional<double> step_;
105 const std::string&
name() const noexcept {
return name_; }
123 const std::string&
name() const noexcept {
return name_; }
125 const std::vector<ParameterValue>&
choices() const noexcept {
return choices_; }
131 std::vector<ParameterValue> choices_;
136 std::variant<IntegerDimension, RealDimension, BooleanDimension, CategoricalDimension>;
170 const std::vector<Dimension>&
dimensions() const noexcept {
return dimensions_; }
176 bool reject_unknown =
true)
const;
185 bool reject_unknown =
true)
const;
213 std::vector<Dimension> dimensions_;
Named dimension whose legal values are exactly false and true.
bool contains(const ParameterValue &value) const noexcept
Returns true only when value contains a Boolean alternative.
const std::string & name() const noexcept
Returns the unique dimension name.
BooleanDimension(std::string name)
Named dimension backed by an ordered, non-empty set of scalar choices.
const std::string & name() const noexcept
Returns the unique dimension name.
bool contains(const ParameterValue &value) const noexcept
Tests exact type-and-value membership in the declared choices.
const std::vector< ParameterValue > & choices() const noexcept
Returns choices in their declared finite-grid order.
CategoricalDimension(std::string name, std::vector< ParameterValue > choices)
Constructs a categorical dimension.
Named signed-integer dimension with inclusive bounds and a positive step.
const std::string & name() const noexcept
Returns the unique dimension name.
IntegerDimension(std::string name, std::int64_t low, std::int64_t high, std::int64_t step=1, bool log=false)
Constructs an integer dimension.
std::int64_t step() const noexcept
Returns the positive lattice step.
std::int64_t high() const noexcept
Returns the inclusive upper bound.
std::int64_t low() const noexcept
Returns the inclusive lower bound.
bool log() const noexcept
Returns whether adaptive samplers operate in logarithmic latent coordinates.
bool contains(const ParameterValue &value) const noexcept
Tests both the scalar type and membership in this dimension's integer lattice.
Named binary64 dimension with inclusive bounds and an optional finite-grid step.
RealDimension(std::string name, double low, double high, std::optional< double > step=std::nullopt, bool log=false)
Constructs a real dimension.
double low() const noexcept
Returns the inclusive lower bound.
bool log() const noexcept
Returns whether adaptive samplers operate in logarithmic latent coordinates.
const std::optional< double > & step() const noexcept
Returns the finite-grid step, or std::nullopt for a continuous dimension.
bool contains(const ParameterValue &value) const noexcept
Tests both the scalar type and interval/lattice membership.
double high() const noexcept
Returns the inclusive upper bound.
const std::string & name() const noexcept
Returns the unique dimension name.
Ordered product of named dimensions with validation and finite-space codecs.
std::uint64_t candidate_ordinal(const Candidate &candidate) const
Encodes a canonical finite-space candidate into its mixed-radix ordinal.
SearchSpace()=default
Constructs an empty search space whose finite cardinality is one.
Candidate candidate_at(std::uint64_t ordinal, std::uint64_t id=0) const
Decodes a mixed-radix ordinal into its canonical finite-space candidate.
SearchSpace(std::vector< Dimension > dimensions)
Constructs a search space in declaration order.
void add(Dimension dimension)
Appends a dimension while preserving declaration order.
const Dimension * find(std::string_view name) const noexcept
Returns the named dimension, or nullptr when it is not declared.
std::map< std::string, std::string > serialize_candidate(const Candidate &candidate, bool reject_unknown=true) const
Validates and serializes a candidate for the PineForge strategy ABI.
std::vector< ValidationIssue > validate(const Candidate &candidate, bool reject_unknown=true) const
Returns every missing, mistyped, off-grid, or optionally unknown parameter issue.
bool is_valid(const Candidate &candidate, bool reject_unknown=true) const
Returns whether validate() would produce no issues for the same arguments.
std::optional< std::uint64_t > finite_cardinality() const
Returns the exact Cartesian-product cardinality when every dimension is finite.
const std::vector< Dimension > & dimensions() const noexcept
Returns all dimensions in declaration order.
std::string_view dimension_name(const Dimension &dimension) noexcept
Returns the name of the concrete dimension.
std::variant< IntegerDimension, RealDimension, BooleanDimension, CategoricalDimension > Dimension
Closed variant over every supported search-space dimension type.
DimensionKind
Concrete dimension category stored by Dimension.
@ Boolean
The two values false and true.
@ Categorical
Explicit ordered set of scalar choices.
@ Real
Continuous or stepped binary64 interval.
@ Integer
Discrete signed-integer lattice.
std::variant< std::int64_t, double, bool, std::string > ParameterValue
Scalar parameter value accepted by search spaces and the PineForge strategy ABI.
bool dimension_contains(const Dimension &dimension, const ParameterValue &value) noexcept
Dispatches a type-aware membership test to the concrete dimension.
DimensionKind dimension_kind(const Dimension &dimension) noexcept
Returns the concrete category stored in dimension.
Complete parameter assignment proposed by a sampler.
One candidate-validation failure tied to a parameter name.
std::string message
Human-readable validation failure.
std::string parameter
Dimension name, or the offending unknown candidate key.