PineForge HPO 0.1.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge::hpo::DlibGlobalSampler Class Referencefinal

Adaptive derivative-free optimizer backed by dlib::global_function_search. More...

#include <pineforge/hpo/sampler.hpp>

+ Inheritance diagram for pineforge::hpo::DlibGlobalSampler:

Public Member Functions

 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.
 
 ~DlibGlobalSampler () override
 
 DlibGlobalSampler (const DlibGlobalSampler &)=delete
 
DlibGlobalSampleroperator= (const DlibGlobalSampler &)=delete
 
 DlibGlobalSampler (DlibGlobalSampler &&) noexcept
 
DlibGlobalSampleroperator= (DlibGlobalSampler &&) noexcept
 
std::optional< Candidatenext () override
 Alias for ask().
 
std::optional< Candidateask ()
 Issues the next dlib evaluation request, or std::nullopt at the budget.
 
void tell (std::uint64_t candidate_id, double objective_value)
 Completes an outstanding request with its original finite objective value.
 
void abandon (std::uint64_t candidate_id)
 Cancels an outstanding failed or pruned trial without fabricating a score.
 
void reset () override
 Cancels all outstanding requests and restores the seeded initial state.
 
std::uint64_t generated () const noexcept override
 Returns the number of candidates issued since construction or reset.
 
std::uint64_t completed () const noexcept
 Returns the number of candidates completed through tell().
 
std::uint64_t outstanding () const noexcept
 Returns the number of candidates awaiting tell() or abandon().
 
std::uint64_t seed () const noexcept
 Returns the reproducibility seed.
 
ObjectiveDirection direction () const noexcept
 Returns the configured optimization direction.
 
- Public Member Functions inherited from pineforge::hpo::Sampler
virtual ~Sampler ()=default
 

Detailed Description

Adaptive derivative-free optimizer backed by dlib::global_function_search.

next() is an alias for ask(). Every returned candidate remains outstanding until tell() or abandon() receives its ID. Multiple candidates may be outstanding, allowing external concurrent evaluation while retaining dlib's native ask/tell behavior. Public operations are serialized internally.

Definition at line 208 of file sampler.hpp.

Constructor & Destructor Documentation

◆ DlibGlobalSampler() [1/3]

pineforge::hpo::DlibGlobalSampler::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.

A fixed seed and ask/tell ordering are deterministic.

Exceptions
std::invalid_argumentwhen the seed exceeds dlib's signed 32-bit range or the search space cannot be represented by the adapter.

◆ ~DlibGlobalSampler()

pineforge::hpo::DlibGlobalSampler::~DlibGlobalSampler ( )
override

◆ DlibGlobalSampler() [2/3]

pineforge::hpo::DlibGlobalSampler::DlibGlobalSampler ( const DlibGlobalSampler )
delete

◆ DlibGlobalSampler() [3/3]

pineforge::hpo::DlibGlobalSampler::DlibGlobalSampler ( DlibGlobalSampler &&  )
noexcept

Member Function Documentation

◆ abandon()

void pineforge::hpo::DlibGlobalSampler::abandon ( std::uint64_t  candidate_id)

Cancels an outstanding failed or pruned trial without fabricating a score.

Exceptions
std::invalid_argumentwhen candidate_id is not outstanding.

◆ ask()

std::optional< Candidate > pineforge::hpo::DlibGlobalSampler::ask ( )

Issues the next dlib evaluation request, or std::nullopt at the budget.

◆ completed()

std::uint64_t pineforge::hpo::DlibGlobalSampler::completed ( ) const
noexcept

Returns the number of candidates completed through tell().

◆ direction()

ObjectiveDirection pineforge::hpo::DlibGlobalSampler::direction ( ) const
inlinenoexcept

Returns the configured optimization direction.

Definition at line 253 of file sampler.hpp.

◆ generated()

std::uint64_t pineforge::hpo::DlibGlobalSampler::generated ( ) const
overridevirtualnoexcept

Returns the number of candidates issued since construction or reset.

Implements pineforge::hpo::Sampler.

◆ next()

std::optional< Candidate > pineforge::hpo::DlibGlobalSampler::next ( )
overridevirtual

Alias for ask().

Implements pineforge::hpo::Sampler.

◆ operator=() [1/2]

DlibGlobalSampler & pineforge::hpo::DlibGlobalSampler::operator= ( const DlibGlobalSampler )
delete

◆ operator=() [2/2]

DlibGlobalSampler & pineforge::hpo::DlibGlobalSampler::operator= ( DlibGlobalSampler &&  )
noexcept

◆ outstanding()

std::uint64_t pineforge::hpo::DlibGlobalSampler::outstanding ( ) const
noexcept

Returns the number of candidates awaiting tell() or abandon().

◆ reset()

void pineforge::hpo::DlibGlobalSampler::reset ( )
overridevirtual

Cancels all outstanding requests and restores the seeded initial state.

Implements pineforge::hpo::Sampler.

◆ seed()

std::uint64_t pineforge::hpo::DlibGlobalSampler::seed ( ) const
inlinenoexcept

Returns the reproducibility seed.

Definition at line 251 of file sampler.hpp.

◆ tell()

void pineforge::hpo::DlibGlobalSampler::tell ( std::uint64_t  candidate_id,
double  objective_value 
)

Completes an outstanding request with its original finite objective value.

Minimize mode negates the value before passing it to dlib, whose optimizer maximizes.

Exceptions
std::invalid_argumentfor a non-finite value or non-outstanding ID.

The documentation for this class was generated from the following file: