PineForge HPO 0.1.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <map>
5#include <string>
6#include <variant>
7
8namespace pineforge::hpo {
9
11using ParameterValue = std::variant<std::int64_t, double, bool, std::string>;
12
14enum class ParameterType {
15 Integer,
16 Real,
17 Boolean,
18 String,
19};
20
23
25const char* parameter_type_name(ParameterType type) noexcept;
26
33std::string serialize_parameter_value(const ParameterValue& value);
34
36struct Candidate {
38 std::uint64_t id = 0;
39
41 std::map<std::string, ParameterValue> values;
42
46 const ParameterValue* find(const std::string& name) const noexcept;
47};
48
52 std::uint64_t trial_id = 0;
53
55 const Candidate* candidate = nullptr;
56};
57
58} // namespace pineforge::hpo
const char * parameter_type_name(ParameterType type) noexcept
Returns a stable lowercase name for type.
ParameterType parameter_type(const ParameterValue &value) noexcept
Returns the discriminator of value.
ParameterType
Runtime discriminator for a ParameterValue alternative.
Definition types.hpp:14
@ String
UTF-8 string value.
@ Boolean
The two values false and true.
@ 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.
Definition types.hpp:11
std::string serialize_parameter_value(const ParameterValue &value)
Produces the exact text passed to strategy_set_input or strategy_set_override.
Complete parameter assignment proposed by a sampler.
Definition types.hpp:36
std::map< std::string, ParameterValue > values
Parameter values keyed by search-space dimension name.
Definition types.hpp:41
const ParameterValue * find(const std::string &name) const noexcept
Returns the named value, or nullptr when the candidate does not contain it.
Metadata supplied to a custom objective while evaluating one trial.
Definition types.hpp:50
const Candidate * candidate
Non-owning candidate pointer; may be nullptr when no candidate is associated.
Definition types.hpp:55
std::uint64_t trial_id
Scheduler-level trial identifier.
Definition types.hpp:52