# Tunable¶

class Tunable

A tunable parameter attempts to reach a target value of acceptance (or generic measure) by modifying it by a percentage. The relationship between the target and the parameter is assumed by the sign of the percent change (by default, inverse relationship assumed).

Public Functions

void set_min_and_max(const double min, const double max)

By default, the value is not bound. This function sets the minimum and maximum bounds.

double max() const

Return the above parameter.

double min() const

Return the above parameter.

void set_value(const double value)

Set the value, optionally subject to bounds.

double value() const

Return the value.

void disable()

Disable tuning.

void enable()

Enable tuning.

bool is_enabled() const

Return if enabled.

void set_percent_change(const double percent = 0.05)

A positive percent change indicates that the value of the parameter and the target have an inverse relationship. Thus, if the actual value is greater than the target, the value will be increased upon tuning.

void set_target(const double target = 0.25)

Set the target to reach for tuning.

void tune(const double actual)

Change the value to attempt to reach a point where the actual is equal to the target.

void serialize(std::ostream &ostr) const

Serialize.

Tunable(std::istream &istr)

Construct from serialization.