[][src]Trait argmin_core::Solver

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 { ... } }

Associated Constants

const NAME: &'static str

Loading content...

Required methods

fn next_iter(
    &mut self,
    op: &mut OpWrapper<O>,
    state: &IterState<O>
) -> Result<ArgminIterData<O>, Error>

Computes one iteration of the algorithm.

Loading content...

Provided methods

fn init(
    &mut self,
    _op: &mut OpWrapper<O>,
    _state: &IterState<O>
) -> Result<Option<ArgminIterData<O>>, Error>

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

Checks whether basic termination reasons apply.

Terminate if

  1. algorithm was terminated somewhere else in the Executor
  2. iteration count exceeds maximum number of iterations
  3. 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

Checks whether the algorithm must be terminated

Loading content...

Implementors

Loading content...