src/bisection_tree/aggregator.rs

branch
dev
changeset 86
d5b0e496b72f
parent 63
f7b87d84864d
equal deleted inserted replaced
76:99ad55974e62 86:d5b0e496b72f
1 /*! 1 /*!
2 Aggregation / summarisation of information in branches of bisection trees. 2 Aggregation / summarisation of information in branches of bisection trees.
3 */ 3 */
4 4
5 use serde::{Serialize, Deserialize};
5 use crate::types::*; 6 use crate::types::*;
6 use crate::sets::Set; 7 use crate::sets::Set;
7 use crate::instance::Instance; 8 use crate::instance::Instance;
8 9
9 /// Trait for aggregating information about a branch of a [bisection tree][super::BT]. 10 /// Trait for aggregating information about a branch of a [bisection tree][super::BT].
31 /// Create a new “empty” aggregate data. 32 /// Create a new “empty” aggregate data.
32 fn new() -> Self; 33 fn new() -> Self;
33 } 34 }
34 35
35 /// An [`Aggregator`] that doesn't aggregate anything. 36 /// An [`Aggregator`] that doesn't aggregate anything.
36 #[derive(Clone,Debug)] 37 #[derive(Clone,Debug,Serialize,Deserialize)]
37 pub struct NullAggregator; 38 pub struct NullAggregator;
38 39
39 impl Aggregator for NullAggregator { 40 impl Aggregator for NullAggregator {
40 fn aggregate<I>(&mut self, _aggregates : I) 41 fn aggregate<I>(&mut self, _aggregates : I)
41 where I : Iterator<Item=Self> {} 42 where I : Iterator<Item=Self> {}
45 46
46 fn new() -> Self { NullAggregator } 47 fn new() -> Self { NullAggregator }
47 } 48 }
48 49
49 /// Upper and lower bounds on an `F`-valued function. 50 /// Upper and lower bounds on an `F`-valued function.
50 #[derive(Copy,Clone,Debug)] 51 #[derive(Copy,Clone,Debug,Serialize,Deserialize)]
51 pub struct Bounds<F>( 52 pub struct Bounds<F>(
52 /// Lower bound 53 /// Lower bound
53 pub F, 54 pub F,
54 /// Upper bound 55 /// Upper bound
55 pub F 56 pub F

mercurial