Skip to main content

AlgorithmEngine

Trait AlgorithmEngine 

Source
pub trait AlgorithmEngine<T = f64> {
    // Required methods
    fn step(&mut self, u: &mut [T]) -> Result<bool, SolverError>;
    fn init(&mut self, u: &mut [T]) -> FunctionCallResult;
}
Expand description

Engine supporting an algorithm

An engine is responsible for the allocation of memory for an algorithm, especially memory that is reuasble is multiple instances of the same algorithm (as in model predictive control).

It defines what the algorithm does at every step (see step) and whether the specified termination criterion is satisfied

Required Methods§

Source

fn step(&mut self, u: &mut [T]) -> Result<bool, SolverError>

Take a step of the algorithm and return Ok(true) only if the iterations should continue.

Returns Err(SolverError) if a callback or projection fails, if a non-finite value is produced, or if the engine detects an invalid numerical state.

Source

fn init(&mut self, u: &mut [T]) -> FunctionCallResult

Initializes the algorithm.

Returns Err(SolverError) if initialization requires evaluating a callback/projection and that operation fails.

Implementors§