1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// The data of generation sampling.
#[derive(Clone, Debug)]
pub struct Report {
    /// Generation.
    pub gen: u64,
    /// Best fitness.
    pub best_f: f64,
    /// Is the best fitness feasible.
    pub best_feasible: bool,
    /// Gradient of the best fitness, between the current and the previous.
    pub diff: f64,
    /// Average of the finite-fitness individuals.
    ///
    /// The first value might be [`f64::NAN`].
    pub average: f64,
    /// Adaptive factor.
    pub adaptive: f64,
    /// Time duration.
    #[cfg(feature = "std")]
    #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
    pub time: f64,
}

impl Default for Report {
    fn default() -> Self {
        Self {
            gen: 0,
            best_f: f64::INFINITY,
            best_feasible: false,
            diff: 0.,
            average: f64::NAN,
            adaptive: 0.,
            #[cfg(feature = "std")]
            time: 0.,
        }
    }
}