akreon-convex
Typed convex modeling, conic canonicalization, and primal-dual optimization in C++26.
Loading...
Searching...
No Matches
convex::Huber< Meta, Child > Struct Template Reference

forward declaration - huber More...

#include <huber.hpp>

Inheritance diagram for convex::Huber< Meta, Child >:
[legend]

Public Types

using ConvexBase = Atom< Meta, Huber< Meta, Child >, Child >
 bring into scope the convex fn alias / helpers
 
- Public Types inherited from convex::Atom< Meta, Huber< Meta, Child >, Child >
using Domain = meta_dom_t< Meta >
 Atom input domain.
 
using Codomain = meta_codom_t< Meta >
 Atom output codomain.
 
using ChildrenT = std::tuple< atom_decay_t< Cs >... >
 Tuple of decayed child atom types.
 
using T = dom_type_t< Domain >
 Scalar field for the atom domain.
 
using PointT = dom_point_t< Domain >
 Point type accepted by the atom domain.
 

Public Member Functions

constexpr Huber (T delta_in, const Child &child_in)
 CTOR.
 
constexpr Huber (T delta_in, const Child &child_in, const affine::AffineMap< LiftedVarMat< T > > &map_in)
 CTOR.
 
constexpr MonotonicityType monotonicity () const
 mono
 
constexpr T operator() (const PointT &x) const
 eval via operator overload
 
constexpr T eval (const PointT &x) const
 eval impl
 
template<T Scalar>
constexpr auto mul () const
 mul
 
constexpr auto add (T beta) const
 add
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto canonicalize_impl (const Builder &builder) const
 canonicalize impl
 
- Public Member Functions inherited from convex::Atom< Meta, Huber< Meta, Child >, Child >
constexpr Atom ()
 Construct a leaf atom with no children.
 
constexpr Atom (ChildrenT child_in)
 Construct an atom with normalized children.
 
constexpr void validate_fn_domain (const auto &child) const
 Validate DCP composition for a function child.
 
constexpr void validate_domain () const
 Validate child domains, signs, curvature, and composition rules.
 
constexpr auto canonicalize (const Builder &builder) const
 Dispatch canonicalization to the derived atom.
 
constexpr const Huber< Meta, Child > & self () const
 Return this object as the CRTP-derived atom type.
 

Public Attributes

T delta
 member vars
 
affine::AffineMap< LiftedVarMat< T > > lift_map
 
const int idx {-1}
 
- Public Attributes inherited from convex::Atom< Meta, Huber< Meta, Child >, Child >
ChildrenT children
 Tuple of normalized child atoms.
 

Static Public Attributes

static constexpr CurvatureType Tag = meta_curv_v<Meta>
 curvature tag
 
- Static Public Attributes inherited from convex::Atom< Meta, Huber< Meta, Child >, Child >
static constexpr std::size_t N
 Domain dimension.
 
static constexpr std::size_t M
 Codomain dimension.
 
static constexpr CurvatureType Curvature
 Curvature declared by atom metadata.
 
static constexpr VarType DomSign
 Domain sign declared by atom metadata.
 
static constexpr VarType CodomSign
 Codomain sign declared by atom metadata.
 

Detailed Description

template<typename Meta, typename Child>
struct convex::Huber< Meta, Child >

forward declaration - huber

huber loss convex atom

Definition at line 45 of file huber.hpp.

Member Typedef Documentation

◆ ConvexBase

template<typename Meta , typename Child >
using convex::Huber< Meta, Child >::ConvexBase = Atom<Meta, Huber<Meta, Child>, Child>

bring into scope the convex fn alias / helpers

Definition at line 47 of file huber.hpp.

Constructor & Destructor Documentation

◆ Huber() [1/2]

template<typename Meta , typename Child >
constexpr convex::Huber< Meta, Child >::Huber ( T  delta_in,
const Child &  child_in 
)
inlineexplicitconstexpr

CTOR.

Parameters
child

Definition at line 60 of file huber.hpp.

References convex::dom_size_v.

◆ Huber() [2/2]

template<typename Meta , typename Child >
constexpr convex::Huber< Meta, Child >::Huber ( T  delta_in,
const Child &  child_in,
const affine::AffineMap< LiftedVarMat< T > > &  map_in 
)
inlineexplicitconstexpr

CTOR.

Parameters
child
map

Definition at line 72 of file huber.hpp.

References convex::dom_size_v.

Member Function Documentation

◆ add()

template<typename Meta , typename Child >
constexpr auto convex::Huber< Meta, Child >::add ( T  beta) const
inlineconstexpr

◆ canonicalize_impl()

template<typename Meta , typename Child >
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto convex::Huber< Meta, Child >::canonicalize_impl ( const Builder &  builder) const
inlineconstexpr

canonicalize impl

L_delta(a) = piecewise{ 0.5 a^2, for |a| <= delta, delta(|a| - 0.5 delta) otherwise }

Variational Form h(x, delta) = min_{u, v, gamma, q, t} t s.t. x = u + v, gamma >= |v|, q >= u^2, t >= q + delta gamma

Convex [ a -1 -1 0 0 0 ] hat{x} + [ b ] [ -a 1 1 0 0 0 ] [ -b ] [ 0 1 0 1 0 0 ] [ 0 ] [ 0 -1 0 1 0 0 ] [ 0 ] [ 0 0 0 1 0 0 ] [ 0 ] [ 0 0 0 -delta -1 1 ] [ 0 ] [ 0 0 1 0 0 0 ] [ 0 ] [ 0 0 0 0 0 0 ] [ 1/2 ] [ 0 0 0 0 1 0 ] [ 0 ]

Concave row 5 becomes [ 0 0 0 -delta -1 -1 ] so t <= -(q + delta gamma)

hat{x} = [ x; v; u; gamma; q; t ]

Parameters
builder
Returns
new builder

Definition at line 211 of file huber.hpp.

References convex::Atom< Meta, Huber< Meta, Child >, Child >::children, convex::CONVEX, convex::Huber< Meta, Child >::delta, convex::dom_size_v, convex::Huber< Meta, Child >::idx, convex::Huber< Meta, Child >::lift_map, and convex::Huber< Meta, Child >::Tag.

◆ eval()

template<typename Meta , typename Child >
constexpr T convex::Huber< Meta, Child >::eval ( const PointT &  x) const
inlineconstexpr

eval impl

Parameters
pointx in domain
Returns
y (scalar in R)

Definition at line 121 of file huber.hpp.

References convex::CONVEX, convex::Huber< Meta, Child >::delta, convex::dom_size_v, convex::Huber< Meta, Child >::lift_map, and convex::Huber< Meta, Child >::Tag.

Referenced by convex::Huber< Meta, Child >::operator()().

◆ monotonicity()

template<typename Meta , typename Child >
constexpr MonotonicityType convex::Huber< Meta, Child >::monotonicity ( ) const
inlineconstexpr

◆ mul()

◆ operator()()

template<typename Meta , typename Child >
constexpr T convex::Huber< Meta, Child >::operator() ( const PointT &  x) const
inlineconstexpr

eval via operator overload

Parameters
pointx
Returns
result

Definition at line 112 of file huber.hpp.

References convex::Huber< Meta, Child >::eval().

Member Data Documentation

◆ delta

◆ idx

template<typename Meta , typename Child >
const int convex::Huber< Meta, Child >::idx {-1}

Definition at line 275 of file huber.hpp.

Referenced by convex::Huber< Meta, Child >::canonicalize_impl().

◆ lift_map

◆ Tag


The documentation for this struct was generated from the following files: