OPTK  0.1.2
Toolkit for global optimisation algorithms
Public Member Functions | List of all members
sspace::loguniform Class Reference

#include <types.hpp>

Inheritance diagram for sspace::loguniform:
sspace::uniform sspace::param_t sspace::qloguniform

Public Member Functions

 loguniform (std::string n, double lower, double upper)
 
 loguniform (std::string n, double lower, double upper, pt t)
 
double sample ()
 
- Public Member Functions inherited from sspace::uniform
 uniform (std::string n, double lower, double upper)
 
 uniform (std::string n, double lower, double upper, pt type)
 
- Public Member Functions inherited from sspace::param_t
 param_t (std::string n, pt t)
 
virtual ~param_t ()
 
virtual pt get_type ()
 
virtual std::string get_name ()
 

Additional Inherited Members

- Public Attributes inherited from sspace::uniform
double m_lower
 
double m_upper
 
- Protected Attributes inherited from sspace::uniform
std::random_device rd
 
std::mt19937 generator
 
std::uniform_real_distribution< double > dist
 

Detailed Description

loguniform parameters are drawn such that they follow a log-uniform (reciprocal) distribution.

The variable value is drawn from within the closed range of the upper and lower bound, such that the logarithm of the return value is uniformly distributed.

Constructor & Destructor Documentation

◆ loguniform() [1/2]

sspace::loguniform::loguniform ( std::string  n,
double  lower,
double  upper 
)

The constructor

Parameters
nthe name of this parameter
lowerthe lower bound; must be strictly positive
upperthe upper bound; must be strictly positive
qthe 'quantisation'; as a double
Exceptions
invalid_argumenton negative or zero-valued bounds

◆ loguniform() [2/2]

sspace::loguniform::loguniform ( std::string  n,
double  lower,
double  upper,
pt  t 
)

Using the same polymorphic constructor pattern as the vanilla uniform type, this should be called by classes inheriting this one.

Member Function Documentation

◆ sample()

double sspace::loguniform::sample ( )
virtual

Overloads the sample method from uniform such that a value is returned according to \( v = \exp \bigg(\text{uniform}\big(\log (l),\log(u)\big)\bigg)\)

Returns
a double-precision floating point value sampled from a loguniform distribution.

Reimplemented from sspace::uniform.

Reimplemented in sspace::qloguniform.


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