Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::evolution_status< I, F > Class Template Reference

#include <evolution_status.h>

Public Types

using global_update_f = std::function<void (scored_individual<I, F>)>

Public Member Functions

 evolution_status (const unsigned *, const global_update_f &={})
scored_individual< I, F > best () const
unsigned generation () const
bool update_if_better (const scored_individual< I, F > &)
bool load (std::istream &, const problem &)
bool save (std::ostream &) const

Detailed Description

template<Individual I, Fitness F>
class ultra::evolution_status< I, F >

A collection of information about the ongoing search.

Remarks
Every thread has its own evolution_status.
Warning
The generation pointer and any objects referenced by the update callback must outlive this object and all its copies.

Member Function Documentation

◆ best()

template<Individual I, Fitness F>
scored_individual< I, F > evolution_status::best ( ) const
nodiscard
Returns
a copy of the best scored individual found so far

◆ load()

template<Individual I, Fitness F>
bool evolution_status::load ( std::istream & in,
const problem & p )
nodiscard

Loads the object from a stream.

Parameters
[in]ininput stream
[in]pactive problem
Returns
true if the object loaded correctly
Note
If the load operation isn't successful the current object isn't changed.

◆ save()

template<Individual I, Fitness F>
bool evolution_status::save ( std::ostream & out) const
nodiscard

Saves the object into a stream.

Parameters
[out]outoutput stream
Returns
true if the object was saved correctly

◆ update_if_better()

template<Individual I, Fitness F>
bool evolution_status::update_if_better ( const scored_individual< I, F > & si)

Update, when appropriate, the best known individual.

Parameters
[in]sia scored individual
Returns
true if best individual has been updated

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