EllAlgo 1.6.13
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EllBase< Arr, Stable > Class Template Reference

Ellipsoid Search Space (shared base) More...

#include <ell_base.hpp>

Collaboration diagram for EllBase< Arr, Stable >:
[legend]

Public Types

using Vec = std::valarray< double >
 
using ArrayType = Arr
 

Public Member Functions

 EllBase (const Vec &val, Arr x)
 Construct a new EllBase object from a vector and an array.
 
 EllBase (const double alpha, Arr x)
 Construct a new EllBase object from an alpha value and an array.
 
 EllBase (EllBase &&E) noexcept=default
 Construct a new EllBase object (move constructor)
 
auto operator= (EllBase &&E) noexcept -> EllBase &=default
 Move assignment operator.
 
 ~EllBase ()=default
 Destroy the EllBase object.
 
 EllBase (const EllBase &E)=default
 Construct a new EllBase object (explicit copy)
 
auto xc () const -> Arr
 Get the center of the ellipsoid.
 
void set_xc (const Arr &xc)
 Set the center of the ellipsoid.
 
constexpr auto tsq () const -> double
 Get the squared radius of the ellipsoid.
 
void set_use_parallel_cut (bool value)
 Set whether to use parallel cut.
 
template<typename T >
auto update_bias_cut (const std::pair< Arr, T > &cut) -> CutStatus
 Update ellipsoid using a deep cut.
 
template<typename T >
auto update_central_cut (const std::pair< Arr, T > &cut) -> CutStatus
 Update ellipsoid using a central cut.
 
template<typename T >
auto update_q (const std::pair< Arr, T > &cut) -> CutStatus
 Update ellipsoid using a cut with a specific Q matrix.
 

Protected Member Functions

auto operator= (const EllBase &E) -> EllBase &=delete
 Deleted copy assignment operator (non-copyable).
 
template<typename T , typename Fn >
auto _update_core (const std::pair< Arr, T > &cut, Fn &&cut_strategy) -> CutStatus
 Update ellipsoid core function using the cut(s).
 

Protected Attributes

size_t _n
 
Arr _xc
 
EllCore _mgr
 

Detailed Description

template<typename Arr, bool Stable>
class EllBase< Arr, Stable >

Ellipsoid Search Space (shared base)

The EllBase class represents an ellipsoid search space:

\[ \mathcal{E} = \{x \mid (x - x_c)^T Q^{-1} (x - x_c) \le \kappa\} \]

This version keeps $Q$ symmetric but no promise of positive definite.

Note
Strategy pattern: the non-type template parameter Stable selects the ellipsoid-update strategy at compile time. When Stable == true the numerically-stable LDL^T update path is used (EllCore::update_stable_*); otherwise the classic direct Q-update is used (EllCore::update_*). Ell and EllStable are thin subclasses pinning this strategy while exposing identical public APIs.
   n-dimensional space
        ┌─┐
      ┌─┘ └─┐
    ┌─┘     └─┐
  ┌─┘         └─┐  ←─ ellipsoid boundary
  │   ● xc      │      center point
  └─┐         ┌─┘
    └─┐     ┌─┘
      └─┐ ┌─┘
        └─┘
Template Parameters
ArrArray type of the center point
StableCompile-time strategy selector (true = LDL^T stable updates)

Member Typedef Documentation

◆ ArrayType

template<typename Arr , bool Stable>
using EllBase< Arr, Stable >::ArrayType = Arr

◆ Vec

template<typename Arr , bool Stable>
using EllBase< Arr, Stable >::Vec = std::valarray<double>

Constructor & Destructor Documentation

◆ EllBase() [1/4]

template<typename Arr , bool Stable>
EllBase< Arr, Stable >::EllBase ( const Vec val,
Arr  x 
)
inline

Construct a new EllBase object from a vector and an array.

Parameters
[in]valA vector of double values.
[in]xAn array of type Arr. This parameter is moved.

◆ EllBase() [2/4]

template<typename Arr , bool Stable>
EllBase< Arr, Stable >::EllBase ( const double  alpha,
Arr  x 
)
inline

Construct a new EllBase object from an alpha value and an array.

Parameters
[in]alphaA double value representing the scaling factor.
[in]xAn array of type Arr. This parameter is moved.

◆ EllBase() [3/4]

template<typename Arr , bool Stable>
EllBase< Arr, Stable >::EllBase ( EllBase< Arr, Stable > &&  E)
defaultnoexcept

Construct a new EllBase object (move constructor)

Parameters
[in]EThe parameter "E" is an rvalue reference to an object of type "EllBase".

◆ ~EllBase()

template<typename Arr , bool Stable>
EllBase< Arr, Stable >::~EllBase ( )
default

Destroy the EllBase object.

◆ EllBase() [4/4]

template<typename Arr , bool Stable>
EllBase< Arr, Stable >::EllBase ( const EllBase< Arr, Stable > &  E)
explicitdefault

Construct a new EllBase object (explicit copy)

Parameters
[in]EThe parameter "E" is a reference to an object of type "EllBase".

Member Function Documentation

◆ _update_core()

template<typename Arr , bool Stable>
template<typename T , typename Fn >
auto EllBase< Arr, Stable >::_update_core ( const std::pair< Arr, T > &  cut,
Fn &&  cut_strategy 
) -> CutStatus
inlineprotected

Update ellipsoid core function using the cut(s).

Template Parameters
TType of the beta parameter.
FnType of the cut strategy function.
Parameters
[in]cutA pair containing the gradient and beta value.
[in]cut_strategyThe strategy function to apply the cut.
Returns
CutStatus The status of the cut.

◆ operator=() [1/2]

template<typename Arr , bool Stable>
auto EllBase< Arr, Stable >::operator= ( const EllBase< Arr, Stable > &  E) -> EllBase &=delete
protecteddelete

Deleted copy assignment operator (non-copyable).

◆ operator=() [2/2]

template<typename Arr , bool Stable>
auto EllBase< Arr, Stable >::operator= ( EllBase< Arr, Stable > &&  E) -> EllBase &=default
defaultnoexcept

Move assignment operator.

Parameters
[in]EThe parameter "E" is an rvalue reference to an object of type "EllBase".
Returns
EllBase& Reference to this object.

◆ set_use_parallel_cut()

template<typename Arr , bool Stable>
void EllBase< Arr, Stable >::set_use_parallel_cut ( bool  value)
inline

Set whether to use parallel cut.

Parameters
[in]valueTrue to use parallel cut, false otherwise.

◆ set_xc()

template<typename Arr , bool Stable>
void EllBase< Arr, Stable >::set_xc ( const Arr xc)
inline

Set the center of the ellipsoid.

Parameters
[in]xcThe new center of the ellipsoid.

◆ tsq()

template<typename Arr , bool Stable>
constexpr auto EllBase< Arr, Stable >::tsq ( ) const -> double
inlineconstexpr

Get the squared radius of the ellipsoid.

Returns
double The squared radius.

◆ update_bias_cut()

template<typename Arr , bool Stable>
template<typename T >
auto EllBase< Arr, Stable >::update_bias_cut ( const std::pair< Arr, T > &  cut) -> CutStatus
inline

Update ellipsoid using a deep cut.

\[ g^T (x - x_c) + \beta \le 0 \]

Template Parameters
TType of the beta parameter.
Parameters
[in]cutA pair containing the gradient and beta value.
Returns
CutStatus The status of the cut.

◆ update_central_cut()

template<typename Arr , bool Stable>
template<typename T >
auto EllBase< Arr, Stable >::update_central_cut ( const std::pair< Arr, T > &  cut) -> CutStatus
inline

Update ellipsoid using a central cut.

\[ g^T (x - x_c) \le 0 \]

Template Parameters
TType of the beta parameter.
Parameters
[in]cutA pair containing the gradient and beta value.
Returns
CutStatus The status of the cut.

◆ update_q()

template<typename Arr , bool Stable>
template<typename T >
auto EllBase< Arr, Stable >::update_q ( const std::pair< Arr, T > &  cut) -> CutStatus
inline

Update ellipsoid using a cut with a specific Q matrix.

\[ Q^+ = Q - \frac{\sigma}{\omega} Q g g^T Q, \qquad \kappa^+ = \kappa \cdot \delta \]

Template Parameters
TType of the beta parameter.
Parameters
[in]cutA pair containing the gradient and beta value.
Returns
CutStatus The status of the cut.

◆ xc()

template<typename Arr , bool Stable>
auto EllBase< Arr, Stable >::xc ( ) const -> Arr
inline

Get the center of the ellipsoid.

Returns
Arr The center of the ellipsoid.

Member Data Documentation

◆ _mgr

template<typename Arr , bool Stable>
EllCore EllBase< Arr, Stable >::_mgr
protected

◆ _n

template<typename Arr , bool Stable>
size_t EllBase< Arr, Stable >::_n
protected

◆ _xc

template<typename Arr , bool Stable>
Arr EllBase< Arr, Stable >::_xc
protected

The documentation for this class was generated from the following file: