template<Individual I, Fitness F>
class ultra::summary< I, F >
A summary of information about evolution (results, statistics...).
Part of the information (status) supports concurrent access and is keep up to date while evolution is ongoing; the remaining part is calculated at the end of evolution.
template<Individual I, Fitness F>
| summary< I, F > & summary::on_new_best |
( |
on_new_best_callback_t | f | ) |
|
Registers a callback invoked whenever a new best individual is discovered.
- Parameters
-
| [in] | f | the callback to invoke on improvement. If empty, no callback is invoked |
- Returns
- a reference to *this (fluent interface)
- Precondition
- This function must be called during the configuration phase, before concurrent evolution begins
The callback is triggered only when update_if_better() observes an improvement over the current best.
The callback is copied while holding the internal mutex and invoked after releasing it. As a consequence, it must be thread-safe and must not assume any additional synchronisation with summary.
- Warning
- Changing the callback while evolution is running is not supported.
template<Individual I, Fitness F>
| void summary::set_best_fitness |
( |
F | fit | ) |
|
Replaces the fitness associated with the best individual.
- Parameters
-
| [in] | fit | fitness under the current evaluation context |
This is used after the evaluation context changes and the current best individual is evaluated again. The individual and last-improvement generation are preserved, and the new-best callback isn't invoked.