| 57 } |
56 } |
| 58 |
57 |
| 59 impl<F: Float, T: GlobalAnalysis<F, Bounds<F>>> Bounded<F> for T {} |
58 impl<F: Float, T: GlobalAnalysis<F, Bounds<F>>> Bounded<F> for T {} |
| 60 |
59 |
| 61 /// A [`RealMapping`] that provides rough bounds as well as minimisation and maximisation. |
60 /// A [`RealMapping`] that provides rough bounds as well as minimisation and maximisation. |
| 62 pub trait MinMaxMapping<const N: usize, F: Float = f64>: RealMapping<N, F> + Bounded<F> { |
61 pub trait MinMaxMapping<Domain: Space, F: Float = f64>: |
| |
62 Mapping<Domain, Codomain = F> + Bounded<F> |
| |
63 { |
| 63 /// Maximise the mapping within stated value `tolerance`. |
64 /// Maximise the mapping within stated value `tolerance`. |
| 64 /// |
65 /// |
| 65 /// At most `max_steps` refinement steps are taken. |
66 /// At most `max_steps` refinement steps are taken. |
| 66 /// Returns the approximate maximiser and the corresponding function value. |
67 /// Returns the approximate maximiser and the corresponding function value. |
| 67 fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Loc<N, F>, F); |
68 fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Domain, F); |
| 68 |
69 |
| 69 /// Maximise the mapping within stated value `tolerance` subject to a lower bound. |
70 /// Maximise the mapping within stated value `tolerance` subject to a lower bound. |
| 70 /// |
71 /// |
| 71 /// At most `max_steps` refinement steps are taken. |
72 /// At most `max_steps` refinement steps are taken. |
| 72 /// Returns the approximate maximiser and the corresponding function value when one is found |
73 /// Returns the approximate maximiser and the corresponding function value when one is found |
| 73 /// above the `bound` threshold, otherwise `None`. |
74 /// above the `bound` threshold, otherwise `None`. |
| 74 fn maximise_above( |
75 fn maximise_above(&mut self, bound: F, tolerance: F, max_steps: usize) -> Option<(Domain, F)>; |
| 75 &mut self, |
|
| 76 bound: F, |
|
| 77 tolerance: F, |
|
| 78 max_steps: usize, |
|
| 79 ) -> Option<(Loc<N, F>, F)>; |
|
| 80 |
76 |
| 81 /// Minimise the mapping within stated value `tolerance`. |
77 /// Minimise the mapping within stated value `tolerance`. |
| 82 /// |
78 /// |
| 83 /// At most `max_steps` refinement steps are taken. |
79 /// At most `max_steps` refinement steps are taken. |
| 84 /// Returns the approximate minimiser and the corresponding function value. |
80 /// Returns the approximate minimiser and the corresponding function value. |
| 85 fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Loc<N, F>, F); |
81 fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Domain, F); |
| 86 |
82 |
| 87 /// Minimise the mapping within stated value `tolerance` subject to a lower bound. |
83 /// Minimise the mapping within stated value `tolerance` subject to a lower bound. |
| 88 /// |
84 /// |
| 89 /// At most `max_steps` refinement steps are taken. |
85 /// At most `max_steps` refinement steps are taken. |
| 90 /// Returns the approximate minimiser and the corresponding function value when one is found |
86 /// Returns the approximate minimiser and the corresponding function value when one is found |
| 91 /// above the `bound` threshold, otherwise `None`. |
87 /// above the `bound` threshold, otherwise `None`. |
| 92 fn minimise_below( |
88 fn minimise_below(&mut self, bound: F, tolerance: F, max_steps: usize) -> Option<(Domain, F)>; |
| 93 &mut self, |
|
| 94 bound: F, |
|
| 95 tolerance: F, |
|
| 96 max_steps: usize, |
|
| 97 ) -> Option<(Loc<N, F>, F)>; |
|
| 98 |
89 |
| 99 /// Verify that the mapping has a given upper `bound` within indicated `tolerance`. |
90 /// Verify that the mapping has a given upper `bound` within indicated `tolerance`. |
| 100 /// |
91 /// |
| 101 /// At most `max_steps` refinement steps are taken. |
92 /// At most `max_steps` refinement steps are taken. |
| 102 fn has_upper_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool; |
93 fn has_upper_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool; |