Trait argmin::core::Solver [−][src]
pub trait Solver<O: ArgminOp>: Serialize { const NAME: &'static str; fn next_iter(
&mut self,
op: &mut OpWrapper<O>,
state: &IterState<O>
) -> Result<ArgminIterData<O>, Error>; fn init(
&mut self,
_op: &mut OpWrapper<O>,
_state: &IterState<O>
) -> Result<Option<ArgminIterData<O>>, Error> { ... } fn terminate_internal(&mut self, state: &IterState<O>) -> TerminationReason { ... } fn terminate(&mut self, _state: &IterState<O>) -> TerminationReason { ... } }
Expand description
Solver
Every solver needs to implement this trait.
Associated Constants
Required methods
Provided methods
Initializes the algorithm
This is executed before any iterations are performed. It can be used to perform precomputations. The default implementation corresponds to doing nothing.
fn terminate_internal(&mut self, state: &IterState<O>) -> TerminationReason
fn terminate_internal(&mut self, state: &IterState<O>) -> TerminationReason
Checks whether basic termination reasons apply.
Terminate if
- algorithm was terminated somewhere else in the Executor
- iteration count exceeds maximum number of iterations
- cost is lower than target cost
This can be overwritten in a Solver
implementation; however it is not advised.
fn terminate(&mut self, _state: &IterState<O>) -> TerminationReason
fn terminate(&mut self, _state: &IterState<O>) -> TerminationReason
Checks whether the algorithm must be terminated