--- a/src/bisection_tree/btfn.rs Sun Apr 27 15:45:40 2025 -0500 +++ b/src/bisection_tree/btfn.rs Sun Apr 27 15:56:43 2025 -0500 @@ -12,6 +12,7 @@ use super::either::*; use super::refine::*; use super::support::*; +use crate::bounds::MinMaxMapping; use crate::fe_model::base::RealLocalModel; use crate::fe_model::p2_local_model::*; use crate::loc::Loc; @@ -837,18 +838,14 @@ // there should be a result, or new nodes above the `glb` inserted into the queue. Then the waiting // threads can also continue processing. If, however, numerical inaccuracy destroyes the `glb`, // the queue may run out, and we get “Refiner failure”. -impl<F: Float, G, BT, const N: usize> BTFN<F, G, BT, N> +impl<F: Float, G, BT, const N: usize> MinMaxMapping<F, N> for BTFN<F, G, BT, N> where BT: BTSearch<F, N, Agg = Bounds<F>>, G: SupportGenerator<F, N, Id = BT::Data>, G::SupportType: Mapping<Loc<F, N>, Codomain = F> + LocalAnalysis<F, Bounds<F>, N>, Cube<F, N>: P2Minimise<Loc<F, N>, F>, { - /// Maximise the `BTFN` within stated value `tolerance`. - /// - /// At most `max_steps` refinement steps are taken. - /// Returns the approximate maximiser and the corresponding function value. - pub fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F) { + fn maximise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F) { let refiner = P2Refiner { tolerance, max_steps, @@ -861,12 +858,7 @@ .unwrap() } - /// Maximise the `BTFN` within stated value `tolerance` subject to a lower bound. - /// - /// At most `max_steps` refinement steps are taken. - /// Returns the approximate maximiser and the corresponding function value when one is found - /// above the `bound` threshold, otherwise `None`. - pub fn maximise_above( + fn maximise_above( &mut self, bound: F, tolerance: F, @@ -883,11 +875,7 @@ .expect("Refiner failure.") } - /// Minimise the `BTFN` within stated value `tolerance`. - /// - /// At most `max_steps` refinement steps are taken. - /// Returns the approximate minimiser and the corresponding function value. - pub fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F) { + fn minimise(&mut self, tolerance: F, max_steps: usize) -> (Loc<F, N>, F) { let refiner = P2Refiner { tolerance, max_steps, @@ -900,12 +888,7 @@ .unwrap() } - /// Minimise the `BTFN` within stated value `tolerance` subject to a lower bound. - /// - /// At most `max_steps` refinement steps are taken. - /// Returns the approximate minimiser and the corresponding function value when one is found - /// above the `bound` threshold, otherwise `None`. - pub fn minimise_below( + fn minimise_below( &mut self, bound: F, tolerance: F, @@ -922,10 +905,7 @@ .expect("Refiner failure.") } - /// Verify that the `BTFN` has a given upper `bound` within indicated `tolerance`. - /// - /// At most `max_steps` refinement steps are taken. - pub fn has_upper_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool { + fn has_upper_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool { let refiner = BoundRefiner { bound, tolerance, @@ -937,10 +917,7 @@ .expect("Refiner failure.") } - /// Verify that the `BTFN` has a given lower `bound` within indicated `tolerance`. - /// - /// At most `max_steps` refinement steps are taken. - pub fn has_lower_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool { + fn has_lower_bound(&mut self, bound: F, tolerance: F, max_steps: usize) -> bool { let refiner = BoundRefiner { bound, tolerance,