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

#include <types.hpp>

Inheritance diagram for sspace::quniform:
sspace::uniform sspace::param_t

Public Member Functions

 quniform (std::string n, double lower, double upper, double q)
 
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 ()
 

Public Attributes

double m_q
 
- Public Attributes inherited from sspace::uniform
double m_lower
 
double m_upper
 

Additional Inherited Members

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

Detailed Description

quniform is a parameter which has a value between the upper and lower bounds (inclusive), incrementing in steps of size q.

This is suitable for a discrete-valued parameter, with respect to which the response surface is smooth, but should be bounded above and below.

To uniformly choose an integer from the range [low, high], select a value of $q = 1$.

Constructor & Destructor Documentation

◆ quniform()

sspace::quniform::quniform ( std::string  n,
double  lower,
double  upper,
double  q 
)

The constructor

Parameters
nthe name of this parameter
lowerthe lower bound; as a double
upperthe upper bound; as a double
qthe 'quantisation'; as a double

Member Function Documentation

◆ sample()

double sspace::quniform::sample ( )
virtual

Overloads the sample method from uniform such that a value is returned according to

\[ \text{clip}\bigg(\text{round}\big( \frac{\text{uniform}(low, high)}{q}\cdot q, low, high \big)\bigg) \]

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

Reimplemented from sspace::uniform.


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