Struct optimization_engine::core::fbs::FBSOptimizer
source · pub struct FBSOptimizer<'a, GradientType, ConstraintType, CostType>where
GradientType: Fn(&[f64], &mut [f64]) -> FunctionCallResult,
CostType: Fn(&[f64], &mut f64) -> FunctionCallResult,
ConstraintType: Constraint,{ /* private fields */ }
Expand description
Optimiser using forward-backward splitting iterations (projected gradient)
Note that an FBSOptimizer
holds a reference to an instance of FBSEngine
which needs to be created externally. A mutable reference to that FBSEgnine
is provided to the optimizer.
The FBSEngine
is supposed to be updated whenever you need to solve
a different optimization problem.
Implementations§
source§impl<'a, GradientType, ConstraintType, CostType> FBSOptimizer<'a, GradientType, ConstraintType, CostType>where
GradientType: Fn(&[f64], &mut [f64]) -> FunctionCallResult,
CostType: Fn(&[f64], &mut f64) -> FunctionCallResult,
ConstraintType: Constraint,
impl<'a, GradientType, ConstraintType, CostType> FBSOptimizer<'a, GradientType, ConstraintType, CostType>where
GradientType: Fn(&[f64], &mut [f64]) -> FunctionCallResult,
CostType: Fn(&[f64], &mut f64) -> FunctionCallResult,
ConstraintType: Constraint,
sourcepub fn new(
problem: Problem<'a, GradientType, ConstraintType, CostType>,
cache: &'a mut FBSCache
) -> Self
pub fn new( problem: Problem<'a, GradientType, ConstraintType, CostType>, cache: &'a mut FBSCache ) -> Self
Constructs a new instance of FBSOptimizer
§Arguments
problem
: problem definitioncache
: instance ofFBSCache
sourcepub fn with_tolerance(
self,
tolerance: f64
) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
pub fn with_tolerance( self, tolerance: f64 ) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
sourcepub fn with_max_iter(
self,
max_iter: usize
) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
pub fn with_max_iter( self, max_iter: usize ) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
Sets the maximum number of iterations
sourcepub fn with_max_duration(
self,
max_duration: Duration
) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
pub fn with_max_duration( self, max_duration: Duration ) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType>
Sets the maximum number of iterations
Trait Implementations§
source§impl<'life, GradientType, ConstraintType, CostType> Optimizer for FBSOptimizer<'life, GradientType, ConstraintType, CostType>where
GradientType: Fn(&[f64], &mut [f64]) -> FunctionCallResult + 'life,
CostType: Fn(&[f64], &mut f64) -> FunctionCallResult + 'life,
ConstraintType: Constraint + 'life,
impl<'life, GradientType, ConstraintType, CostType> Optimizer for FBSOptimizer<'life, GradientType, ConstraintType, CostType>where
GradientType: Fn(&[f64], &mut [f64]) -> FunctionCallResult + 'life,
CostType: Fn(&[f64], &mut f64) -> FunctionCallResult + 'life,
ConstraintType: Constraint + 'life,
source§fn solve(&mut self, u: &mut [f64]) -> Result<SolverStatus, SolverError>
fn solve(&mut self, u: &mut [f64]) -> Result<SolverStatus, SolverError>
solves a given problem and updates the initial estimate
u
with the solution Read moreAuto Trait Implementations§
impl<'a, GradientType, ConstraintType, CostType> Freeze for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
impl<'a, GradientType, ConstraintType, CostType> RefUnwindSafe for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
impl<'a, GradientType, ConstraintType, CostType> Send for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
impl<'a, GradientType, ConstraintType, CostType> Sync for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
impl<'a, GradientType, ConstraintType, CostType> Unpin for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
impl<'a, GradientType, ConstraintType, CostType> !UnwindSafe for FBSOptimizer<'a, GradientType, ConstraintType, CostType>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more