pub struct PANOCCache<T = f64>{ /* private fields */ }Expand description
Cache for PANOC
This struct carries all the information needed at every step of the algorithm.
An instance of PANOCCache needs to be allocated once and a (mutable) reference to it should
be passed to instances of PANOCOPtimizer
Subsequently, a PANOCEngine is used to construct an instance of PANOCAlgorithm
Implementations§
Source§impl<T> PANOCCache<T>
impl<T> PANOCCache<T>
Sourcepub fn new(
problem_size: usize,
tolerance: T,
lbfgs_memory_size: usize,
) -> PANOCCache<T>
pub fn new( problem_size: usize, tolerance: T, lbfgs_memory_size: usize, ) -> PANOCCache<T>
Construct a new instance of PANOCCache
§Arguments
problem_sizedimension of the decision variables of the optimization problemtolerancespecified tolerancelbfgs_memory_sizememory of the LBFGS buffer
§Panics
The method will panic if
- the specified
toleranceis not positive - memory allocation fails (memory capacity overflow)
§Memory allocation
This constructor allocated memory using vec!.
It allocates a total of 8*problem_size + 2*lbfgs_memory_size*problem_size + 2*lbfgs_memory_size + 11 floats of type T
Sourcepub fn set_akkt_tolerance(&mut self, akkt_tolerance: T)
pub fn set_akkt_tolerance(&mut self, akkt_tolerance: T)
Sourcepub fn cache_previous_gradient(&mut self)
pub fn cache_previous_gradient(&mut self)
Copies the value of the current cost gradient to gradient_u_previous,
which stores the previous gradient vector
Sourcepub fn exit_condition(&self) -> bool
pub fn exit_condition(&self) -> bool
Returns true iff all termination conditions are satisfied
It checks whether:
- the FPR condition,
gamma*||fpr|| < epsilon, - (if activated) the AKKT condition
||gamma*fpr + (df - df_prev)|| < eps_akktare satisfied.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the cache to its initial virgin state.
In particular,
- Resets/empties the LBFGS buffer
- Sets tau = 1.0
- Sets the iteration count to 0
- Sets the internal variables
lhs_ls,rhs_ls,lipschitz_constant,sigma,cost_valueandgammato 0.0
Sourcepub fn with_cbfgs_parameters(self, alpha: T, epsilon: T, sy_epsilon: T) -> Self
pub fn with_cbfgs_parameters(self, alpha: T, epsilon: T, sy_epsilon: T) -> Self
Sets the CBFGS parameters alpha and epsilon
Read more in: D.-H. Li and M. Fukushima, “On the global convergence of the BFGS method for nonconvex unconstrained optimization problems,” vol. 11, no. 4, pp. 1054–1064, jan 2001.
§Arguments
- alpha
- epsilon
- sy_epsilon
§Panics
The method panics if alpha or epsilon are nonpositive and if sy_epsilon is negative.