20 virtual std::optional<Candidate>
next() = 0;
24 virtual std::uint64_t
generated() const noexcept = 0;
34 std::optional<Candidate>
next()
override;
38 std::uint64_t
generated() const noexcept
override {
return generated_; }
44 std::uint64_t total_candidates_ = 0;
45 std::uint64_t generated_ = 0;
58 std::optional<Candidate>
next()
override;
62 std::uint64_t
generated() const noexcept
override {
return generated_; }
64 std::uint64_t
seed() const noexcept {
return seed_; }
69 std::uint64_t max_candidates_;
70 std::uint64_t generated_ = 0;
71 std::mt19937_64 engine_;
109 virtual std::uint64_t
size() const noexcept = 0;
111 virtual std::uint64_t
id(std::uint64_t row) const = 0;
113 virtual
ParameterValue parameter(std::uint64_t row, std::
size_t dimension) const = 0;
115 virtual std::optional<
double> objective(std::uint64_t row) const = 0;
123 std::uint64_t startup_trials = 10;
129 std::uint64_t ei_candidates = 24;
132 double gamma_fraction = 0.10;
137 std::uint64_t gamma_cap = 25;
140 double prior_weight = 1.0;
147 bool constant_liar =
true;
150 std::optional<std::uint64_t> history_switch = std::nullopt;
153 std::uint64_t scale_ei_candidates = 8;
156 std::uint64_t bad_reservoir_size = 448;
160 std::uint32_t max_threads = 0;
191 std::uint64_t max_candidates = 0,
211 void tell(std::uint64_t candidate_id,
double objective_value);
215 void abandon(std::uint64_t candidate_id);
226 std::uint64_t replay_batch_size = 0,
227 const std::
string& sampler_state = {});
231 bool warm_start(std::shared_ptr<const WarmStartSource> source,
232 std::uint64_t replay_batch_size = 0,
233 const std::string& sampler_state = {});
249 std::uint64_t completed() const noexcept;
251 std::uint64_t outstanding() const noexcept;
253 std::
size_t retained_observations() const;
255 std::uint64_t duplicate_proposals_skipped() const noexcept;
257 std::uint64_t seed() const noexcept {
return seed_; }
271 std::uint64_t max_candidates_;
274 std::unique_ptr<Impl> impl_;
293 std::uint64_t max_candidates = 0);
311 void tell(std::uint64_t candidate_id,
double objective_value);
315 void abandon(std::uint64_t candidate_id);
318 void reset() override;
320 std::uint64_t generated() const noexcept override;
322 std::uint64_t completed() const noexcept;
324 std::uint64_t outstanding() const noexcept;
326 std::uint64_t seed() const noexcept {
return seed_; }
336 std::uint64_t max_candidates_;
337 std::unique_ptr<Impl> impl_;
Adaptive derivative-free optimizer backed by dlib::global_function_search.
DlibGlobalSampler(const DlibGlobalSampler &)=delete
DlibGlobalSampler & operator=(const DlibGlobalSampler &)=delete
~DlibGlobalSampler() override
DlibGlobalSampler(DlibGlobalSampler &&) noexcept
ObjectiveDirection direction() const noexcept
Returns the configured optimization direction.
DlibGlobalSampler(SearchSpace space, std::uint64_t seed, ObjectiveDirection direction=ObjectiveDirection::Maximize, std::uint64_t max_candidates=0)
Constructs a dlib global sampler; max_candidates == 0 means unbounded generation.
Lazy exhaustive sampler over a finite SearchSpace in mixed-radix order.
std::optional< Candidate > next() override
Returns each finite candidate once, then std::nullopt.
std::uint64_t total_candidates() const noexcept
Returns the exact finite search-space cardinality.
std::uint64_t generated() const noexcept override
Returns the number of candidates issued since construction or reset.
GridSampler(SearchSpace space)
void reset() override
Rewinds enumeration to ordinal zero.
Seeded independent sampler with replacement.
std::uint64_t seed() const noexcept
Returns the reproducibility seed.
void reset() override
Reseeds the generator and restores the original sequence.
std::optional< Candidate > next() override
Samples one independent candidate, or returns std::nullopt at the configured limit.
std::uint64_t generated() const noexcept override
Returns the number of candidates issued since construction or reset.
RandomSampler(SearchSpace space, std::uint64_t seed, std::uint64_t max_candidates=0)
Constructs a random sampler; max_candidates == 0 means unbounded generation.
Minimal pull-based interface shared by candidate samplers.
virtual std::uint64_t generated() const noexcept=0
Returns the number of candidates issued since construction or the last reset.
virtual std::optional< Candidate > next()=0
Returns the next candidate, or std::nullopt when the configured budget is exhausted.
virtual ~Sampler()=default
virtual void reset()=0
Restores the sampler's seeded initial state.
Ordered product of named dimensions with validation and finite-space codecs.
Independent, single-objective Tree-structured Parzen Estimator sampler.
TpeSampler(SearchSpace space, std::uint64_t seed, ObjectiveDirection direction=ObjectiveDirection::Maximize, std::uint64_t max_candidates=0, TpeSamplerConfig config={}, CandidatePolicy candidate_policy=CandidatePolicy::SamplerDefault)
Constructs a native TPE sampler; max_candidates == 0 means unbounded generation.
CandidatePolicy candidate_policy() const noexcept
Returns the configured uniqueness/coverage policy.
std::uint64_t generated() const noexcept override
Returns the number of candidates issued since construction or reset.
TpeSampler & operator=(const TpeSampler &)=delete
void reset() override
Restores the seeded initial state and clears finite-space reservations.
TpeSampler(TpeSampler &&) noexcept
ObjectiveDirection direction() const noexcept
Returns the configured optimization direction.
TpeSampler(const TpeSampler &)=delete
const TpeSamplerConfig & config() const noexcept
Returns the immutable TPE tuning configuration.
bool warm_start(std::shared_ptr< const WarmStartSource > source, std::uint64_t replay_batch_size=0, const std::string &sampler_state={})
Restores exact ordered observations while retaining the immutable source by reference.
std::string sampler_state() const
Returns a versioned, checksummed checkpoint bound to the configuration and observations.
Immutable, ordered sampler observations, optionally backed by mapped binary columns.
virtual ~WarmStartSource()=default
Releases the source and any resources retained by its implementation.
virtual std::uint64_t size() const noexcept=0
Returns the number of attempted trials, including abandoned trials.
ObjectiveDirection
Direction used to rank a scalar objective.
@ Maximize
Larger finite values are better.
@ Minimize
Smaller finite values are better.
CandidatePolicy
Uniqueness and coverage contract applied to sampler proposals.
@ SamplerDefault
Preserve native sampler behavior, including possible duplicates.
@ WithoutReplacement
Issue at most the requested number of unique finite candidates.
@ Exhaustive
Require a budget equal to cardinality and cover every candidate.
std::uint64_t continuation_seed(std::uint64_t seed, std::uint64_t warm_trials) noexcept
Derives a portable continuation RNG seed; an empty history preserves the original seed.
std::variant< std::int64_t, double, bool, std::string > ParameterValue
Scalar parameter value accepted by search spaces and the PineForge strategy ABI.
const char * candidate_policy_name(CandidatePolicy policy) noexcept
Returns the stable StudySpec spelling of policy.
Complete parameter assignment proposed by a sampler.
Tuning parameters for the native product-density TPE implementation.
One previously attempted candidate; only finite, feasible completed objectives are supplied.
std::optional< double > objective