Skip to main content

PANOCCache

Struct PANOCCache 

Source
pub struct PANOCCache<T = f64>
where T: Float + LbfgsPrecision + Sum<T>,
{ /* 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>
where T: Float + LbfgsPrecision + Sum<T>,

Source

pub fn new( problem_size: usize, tolerance: T, lbfgs_memory_size: usize, ) -> PANOCCache<T>

Construct a new instance of PANOCCache

§Arguments
  • problem_size dimension of the decision variables of the optimization problem
  • tolerance specified tolerance
  • lbfgs_memory_size memory of the LBFGS buffer
§Panics

The method will panic if

  • the specified tolerance is 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

Source

pub fn set_akkt_tolerance(&mut self, akkt_tolerance: T)

Sets the AKKT-specific tolerance and activates the corresponding termination criterion

§Arguments
  • akkt_tolerance: Tolerance for the AKKT-specific termination condition
§Panics

The method panics if akkt_tolerance is nonpositive

Source

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

Source

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_akkt are satisfied.
Source

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_value and gamma to 0.0
Source

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.

Trait Implementations§

Source§

impl<T> Debug for PANOCCache<T>
where T: Float + LbfgsPrecision + Sum<T> + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for PANOCCache<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for PANOCCache<T>
where T: RefUnwindSafe,

§

impl<T> Send for PANOCCache<T>
where T: Send,

§

impl<T> Sync for PANOCCache<T>
where T: Sync,

§

impl<T> Unpin for PANOCCache<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for PANOCCache<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for PANOCCache<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.