trigger#
Classes#
Set#
-
class Set : public ioh::logger::Trigger#
Interface to combine several triggers in a single one.
By default, the Logger class manage combine several triggers with a logical “or” (see trigger::Any), but you may want to do differently, in which case you can inherit from this class to enjoy the triggers list management, and just do what you want with
operator()
.Subclassed by ioh::trigger::All, ioh::trigger::Any
Each#
-
class Each : public ioh::logger::Trigger#
A trigger that fire at a regular interval.
Public Functions
-
inline Each(const size_t interval, const size_t starting_at = 0)#
Constructor.
- Parameters:
interval – number of evaluations between two triggering events.
starting_at – minimum time at which to start triggering events.
-
inline size_t interval() const#
Accessor for _interval.
-
inline size_t starting_at() const#
Accessor for _starting_at.
-
inline Each(const size_t interval, const size_t starting_at = 0)#
At#
-
class At : public ioh::logger::Trigger#
A trigger that fire only at specific number of evaluations.
Public Functions
-
inline At(const std::set<size_t> time_points)#
Constructor.
- Parameters:
time_points – the set of evaluations for which to trigger an event.
-
inline std::set<size_t> time_points() const#
Return the time points when to log.
Protected Functions
-
inline bool matches(const size_t evals)#
Check if time is in the managed set.
-
inline At(const std::set<size_t> time_points)#
During#
-
class During : public ioh::logger::Trigger#
A trigger that fire only when the number of evaluations is within certain range(s).
Note
Ranges are closed intervals: with
[start,end]
, the trigger will fire for start and end. Ranges may overlap with each other.Public Functions
-
inline During(std::set<std::pair<size_t, size_t>> time_ranges)#
Constructor.
- Parameters:
time_ranges – the set of [min_evals,max_evals] during which events will be triggered.
-
inline std::set<std::pair<size_t, size_t>> time_ranges() const#
Accessor for _time_ranges.
Protected Functions
-
inline bool matches(const size_t evals)#
Check if a time is in one of the ranges.
Protected Attributes
-
const std::set<std::pair<size_t, size_t>> _time_ranges#
Time ranges during which events are triggered.
-
inline During(std::set<std::pair<size_t, size_t>> time_ranges)#
Structs#
Any#
All#
Always#
OnImprovement#
OnDeltaImprovement#
-
struct OnDeltaImprovement : public ioh::logger::Trigger#
Public Functions
-
inline OnDeltaImprovement(const double delta = 1e-10)#
-
inline OnDeltaImprovement(const double delta, const double best_so_far)#
-
inline virtual bool operator()(const logger::Info &log_info, const problem::MetaData &pb_info) override#
- Returns:
true if a log event is to be triggered given the passed state.
-
inline virtual void reset() override#
Reset any internal state.
Useful if, for instance, the trigger maintain its own “best value so far” (
See also
logger::OnImprovement).
Note
This is called when the logger is attached to a new problem/run/etc.
-
inline OnDeltaImprovement(const double delta = 1e-10)#
OnViolation#
-
struct OnViolation : public ioh::logger::Trigger#
Trigger when there is constraint violation.
Public Functions
-
inline virtual bool operator()(const logger::Info &log_info, const problem::MetaData&) override#
Call interface.
-
inline virtual void reset() override#
Reset the violations counter.
Public Members
-
int violations = {}#
Track the number of violations.
-
inline virtual bool operator()(const logger::Info &log_info, const problem::MetaData&) override#
Functions#
all#
any#
at#
during#
each#
Variables#
always#
on_improvement#
-
OnImprovement ioh::trigger::on_improvement#
Do log only if the transformed best objective function value found so far has strictly improved.
on_violation#
-
OnViolation ioh::trigger::on_violation#
Log when there are violations.