Ultra 0.9.4
Loading...
Searching...
No Matches
evolution_status.h
Go to the documentation of this file.
1
12
13#if !defined(ULTRA_EVOLUTION_STATUS_H)
14#define ULTRA_EVOLUTION_STATUS_H
15
16#include <functional>
17
19#include "utility/misc.h"
20
21namespace ultra
22{
23
34template<Individual I, Fitness F>
35class evolution_status
36{
37public:
38 using global_update_f = std::function<void (scored_individual<I, F>)>;
39
40 // --- Constructor and support functions ---
41 evolution_status() = default;
42 explicit evolution_status(const unsigned *, const global_update_f & = {});
43
44 // --- Misc ---
45 [[nodiscard]] scored_individual<I, F> best() const;
46 [[nodiscard]] unsigned generation() const;
48
49 // --- Serialization ---
50 [[nodiscard]] bool load(std::istream &, const problem &);
51 [[nodiscard]] bool save(std::ostream &) const;
52
53private:
55
56 global_update_f update_overall_best_ {};
57
58 // Non-owning pointer to the current generation.
59 const unsigned *generation_ {nullptr};
60};
61
63
64} // namespace ultra
65
66#endif // include guard
bool load(std::istream &, const problem &)
Definition evolution_status.h:78
bool save(std::ostream &) const
Definition evolution_status.h:96
scored_individual< I, F > best() const
Definition evolution_status.h:56
bool update_if_better(const scored_individual< I, F > &)
Definition evolution_status.h:35
Definition problem.h:26
Definition scored_individual.h:48