|
OPTK
0.1.2
Toolkit for global optimisation algorithms
|
#include <types.hpp>
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 |
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$.
| sspace::quniform::quniform | ( | std::string | n, |
| double | lower, | ||
| double | upper, | ||
| double | q | ||
| ) |
The constructor
| n | the name of this parameter |
| lower | the lower bound; as a double |
| upper | the upper bound; as a double |
| q | the 'quantisation'; as a double |
|
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) \]
Reimplemented from sspace::uniform.
1.8.13