diff --git a/examples/rosenbrock.rs b/examples/rosenbrock.rs index 0ee8088..2246583 100644 --- a/examples/rosenbrock.rs +++ b/examples/rosenbrock.rs @@ -43,7 +43,7 @@ fn main() -> Result<(), String> { for i in 1..=100 { solver - .next(&f, &dom, &mut x, &mut fx) + .solve_next(&f, &dom, &mut x, &mut fx) .map_err(|err| format!("{}", err))?; println!( diff --git a/gomez-bench/benches/main.rs b/gomez-bench/benches/main.rs index 344fc20..ad90d21 100644 --- a/gomez-bench/benches/main.rs +++ b/gomez-bench/benches/main.rs @@ -184,7 +184,7 @@ where let mut fx = x.clone_owned(); let mut iter = 0; loop { - if solver.next(&f, &dom, &mut x, &mut fx).is_err() { + if solver.solve_next(&f, &dom, &mut x, &mut fx).is_err() { panic!("solver error"); } @@ -290,7 +290,7 @@ impl> Solver for GslSolverWrapper( + fn solve_next( &mut self, _f: &F, _dom: &Domain, diff --git a/src/core/optimizer.rs b/src/core/optimizer.rs index 116ac22..aaf8f25 100644 --- a/src/core/optimizer.rs +++ b/src/core/optimizer.rs @@ -5,7 +5,7 @@ use super::{domain::Domain, function::Function}; /// Common interface for all optimizers. /// /// All optimizers implement a common interface defined by the [`Optimizer`] -/// trait. The essential method is [`next`](Optimizer::next) which takes +/// trait. The essential method is [`opt_next`](Optimizer::opt_next) which takes /// variables *x* and computes the next step. Thus it represents one iteration /// in the process. Repeated call to this method should move *x* towards the /// minimum in successful cases. @@ -44,7 +44,7 @@ use super::{domain::Domain, function::Function}; /// const NAME: &'static str = "Random"; /// type Error = std::convert::Infallible; /// -/// fn next( +/// fn opt_next( /// &mut self, /// f: &F, /// dom: &Domain, @@ -82,7 +82,7 @@ pub trait Optimizer { /// The implementations *can* assume that subsequent calls to `next` pass /// the value of `x` as was outputted in the previous iteration by the same /// method. - fn next( + fn opt_next( &mut self, f: &F, dom: &Domain, diff --git a/src/core/solver.rs b/src/core/solver.rs index 2f795e6..a0bbc3f 100644 --- a/src/core/solver.rs +++ b/src/core/solver.rs @@ -5,10 +5,10 @@ use super::{domain::Domain, system::System}; /// Common interface for all solvers. /// /// All solvers implement a common interface defined by the [`Solver`] trait. -/// The essential method is [`next`](Solver::next) which takes variables *x* and -/// computes the next step. Thus it represents one iteration in the process. -/// Repeated call to this method should converge *x* to the solution in -/// successful cases. +/// The essential method is [`solve_next`](Solver::solve_next) which takes +/// variables *x* and computes the next step. Thus it represents one iteration +/// in the process. Repeated call to this method should converge *x* to the +/// solution in successful cases. /// /// If you implement a solver, please consider make it a contribution to this /// library. @@ -44,7 +44,7 @@ use super::{domain::Domain, system::System}; /// const NAME: &'static str = "Random"; /// type Error = std::convert::Infallible; /// -/// fn next( +/// fn solve_next( /// &mut self, /// f: &F, /// dom: &Domain, @@ -86,7 +86,7 @@ pub trait Solver { /// The implementations *can* assume that subsequent calls to `next` pass /// the value of `x` as was outputted in the previous iteration by the same /// method. - fn next( + fn solve_next( &mut self, f: &F, dom: &Domain, diff --git a/src/lib.rs b/src/lib.rs index 52e0a08..631f74a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,7 +192,7 @@ //! for i in 1.. { //! // Do one iteration in the solving process. //! solver -//! .next(&f, &dom, &mut x, &mut fx) +//! .solve_next(&f, &dom, &mut x, &mut fx) //! .expect("solver encountered an error"); //! //! println!( diff --git a/src/solver/lipo.rs b/src/solver/lipo.rs index 159f0ca..86184a5 100644 --- a/src/solver/lipo.rs +++ b/src/solver/lipo.rs @@ -350,7 +350,7 @@ where // Do not fail the optimization on an error from the local // optimization. - match local_optimizer.next(f, dom, x) { + match local_optimizer.opt_next(f, dom, x) { Ok(error) => error, Err(_) => f.apply(x), } @@ -387,7 +387,7 @@ where type Error = LipoError; - fn next( + fn opt_next( &mut self, f: &F, dom: &Domain<::Scalar>, @@ -409,7 +409,7 @@ where type Error = LipoError; - fn next( + fn solve_next( &mut self, f: &F, dom: &Domain<::Scalar>, diff --git a/src/solver/nelder_mead.rs b/src/solver/nelder_mead.rs index 51fbb03..6b5886a 100644 --- a/src/solver/nelder_mead.rs +++ b/src/solver/nelder_mead.rs @@ -457,7 +457,7 @@ impl Optimizer for NelderMead { type Error = NelderMeadError; - fn next( + fn opt_next( &mut self, f: &F, dom: &Domain, @@ -475,7 +475,7 @@ impl Solver for NelderMead { type Error = NelderMeadError; - fn next( + fn solve_next( &mut self, f: &F, dom: &Domain, diff --git a/src/solver/steffensen.rs b/src/solver/steffensen.rs index 0658259..8ab0627 100644 --- a/src/solver/steffensen.rs +++ b/src/solver/steffensen.rs @@ -84,7 +84,7 @@ impl Solver for Steffensen { type Error = SteffensenError; - fn next( + fn solve_next( &mut self, f: &F, dom: &Domain, diff --git a/src/solver/trust_region.rs b/src/solver/trust_region.rs index 57f1359..6116676 100644 --- a/src/solver/trust_region.rs +++ b/src/solver/trust_region.rs @@ -203,7 +203,7 @@ impl Solver for TrustRegion { type Error = TrustRegionError; - fn next( + fn solve_next( &mut self, f: &F, dom: &Domain, @@ -685,7 +685,7 @@ impl Optimizer for TrustRegion { type Error = TrustRegionError; - fn next( + fn opt_next( &mut self, f: &F, dom: &Domain<::Scalar>, diff --git a/src/testing.rs b/src/testing.rs index 5daaac9..2f85785 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -737,7 +737,7 @@ where let mut iter = 0; loop { - solver.next(f, dom, &mut x, &mut fx)?; + solver.solve_next(f, dom, &mut x, &mut fx)?; if fx.norm() <= tolerance { return Ok(x); @@ -767,7 +767,7 @@ where let mut iter = 0; loop { - let fx = optimizer.next(f, dom, &mut x)?; + let fx = optimizer.opt_next(f, dom, &mut x)?; if fx <= min + tolerance { // Converged. @@ -799,7 +799,7 @@ where let mut fx = x.clone_owned(); for iter in 0..iters { - solver.next(f, dom, &mut x, &mut fx)?; + solver.solve_next(f, dom, &mut x, &mut fx)?; inspect(&solver, &x, fx.norm(), iter); }