alpaqa 1.0.0a13
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
alpaqa::params Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  dict_to_struct_table
 Specialize this type to define the attribute name to attribute setters dictionaries for a struct type T. More...
 
struct  dict_to_struct_table< ALMParams< config_t > >
 
struct  dict_to_struct_table< AndersonAccelParams< config_t > >
 
struct  dict_to_struct_table< AndersonDirectionParams< config_t > >
 
struct  dict_to_struct_table< CBFGSParams< config_t > >
 
struct  dict_to_struct_table< lbfgsb::LBFGSBSolver::Params >
 
struct  dict_to_struct_table< LBFGSDirectionParams< config_t > >
 
struct  dict_to_struct_table< LBFGSParams< config_t > >
 
struct  dict_to_struct_table< LipschitzEstimateParams< config_t > >
 
struct  dict_to_struct_table< NewtonTRDirectionParams< config_t > >
 
struct  dict_to_struct_table< PANOCOCPParams< config_t > >
 
struct  dict_to_struct_table< PANOCParams< config_t > >
 
struct  dict_to_struct_table< PANTRParams< config_t > >
 
struct  dict_to_struct_table< qpalm::Settings >
 
struct  dict_to_struct_table< SteihaugCGParams< config_t > >
 
struct  dict_to_struct_table< StructuredLBFGSDirectionParams< config_t > >
 
struct  dict_to_struct_table< StructuredNewtonDirectionParams< config_t > >
 
struct  dict_to_struct_table< StructuredNewtonRegularizationParams< config_t > >
 
struct  dict_to_struct_table< ZeroFPRParams< config_t > >
 
struct  invalid_param
 Custom parameter parsing exception. More...
 
struct  param_setter_fun_t
 Function wrapper to set attributes of a struct, type-erasing the type of the attribute. More...
 
struct  ParamString
 Represents a parameter value encoded as a string in the format abc.def.key=value. More...
 
struct  vec_from_file
 

Typedefs

using config_t = DefaultConfig
 
template<class T >
using dict_to_struct_table_t = std::map< std::string_view, param_setter_fun_t< T > >
 Dictionary that maps struct attribute names to type-erased functions that set those attributes.
 

Functions

template<class T >
void assert_key_empty (ParamString s)
 Throw a meaningful error when s.key is not empty, to indicate that the given type T is not of struct type and cannot be indexed into.
 
template<class T >
void unsupported_type (T &, ParamString s)
 Throw a meaningful error to indicate that parameters of type T are not supported or implemented.
 
template<>
void set_param (bool &b, ParamString s)
 
template<>
void set_param (std::string_view &v, ParamString s)
 
template<>
void set_param (std::string &v, ParamString s)
 
template<class T >
requires ((std::floating_point<T> || std::integral<T>) && !std::is_enum_v<T>)
void set_param (T &f, ParamString s)
 Update/overwrite the first argument based on the option in s.
 
template<>
void set_param (vec< config_t > &v, ParamString s)
 
template<>
void set_param (vec_from_file< config_t > &v, ParamString s)
 
template<class Rep , class Period >
void set_param (std::chrono::duration< Rep, Period > &t, ParamString s)
 
template<class T , class T_actual , class A >
auto param_setter (A T_actual::*attr)
 Return a function that applies set_param to the given attribute of a value of type T.
 
template<class T >
auto possible_keys ()
 Return a string enumerating the possible attribute names for the struct type T.
 
template<class T >
requires requires { dict_to_struct_table<T>::table; }
void set_param (T &t, ParamString s)
 Use s to index into the struct type T and overwrite the attribute given by s.key.
 
auto split_key (std::string_view full, char tok='.')
 Split the string full on the first occurrence of tok.
 
template<class T >
void set_param (T &, ParamString)
 Update/overwrite the first argument based on the option in s.
 
template<class T >
void set_params (T &t, std::string_view prefix, std::span< const std::string_view > options, std::optional< std::span< unsigned > > used=std::nullopt)
 Overwrites t based on the options that start with prefix.
 
template<>
void set_param (bool &b, ParamString s)
 
template<>
void set_param (std::string_view &v, ParamString s)
 
template<>
void set_param (std::string &v, ParamString s)
 
template<>
void set_param (alpaqa::vec< config_t > &v, ParamString s)
 
template<>
void set_param (vec_from_file< config_t > &v, ParamString s)
 
template<>
void set_param (LBFGSStepSize &t, ParamString s)
 
template<>
void set_param (PANOCStopCrit &t, ParamString s)
 
template<class... Ts>
void set_param (detail::_dummy< Ts... > &, ParamString)
 
template void set_param (detail::possible_alias_t< float > &, ParamString)
 
template void set_param (detail::possible_alias_t< double, float > &, ParamString)
 
template void set_param (detail::possible_alias_t< long double, double, float > &, ParamString)
 
template void set_param (detail::possible_alias_t< int8_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< uint8_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< int16_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< uint16_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< int32_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< int64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< uint32_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< int, short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< long, int, short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< long long, long, int, short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< ptrdiff_t, long long, long, int, short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< unsigned short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< unsigned int, unsigned short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< unsigned long, unsigned int, unsigned short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< unsigned long long, unsigned long, unsigned int, unsigned short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< size_t, unsigned long long, unsigned long, unsigned int, unsigned short, int8_t, uint8_t, int16_t, uint16_t, int32_t, int64_t, uint32_t, uint64_t > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::nanoseconds > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::microseconds > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::milliseconds > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::seconds > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::minutes > &, ParamString)
 
template void set_param (detail::possible_alias_t< std::chrono::hours > &, ParamString)
 
template void set_param (detail::possible_alias_t< PANOCParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< ZeroFPRParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< PANTRParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< LBFGSParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< AndersonAccelParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< LBFGSDirectionParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< AndersonDirectionParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< StructuredLBFGSDirectionParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< NewtonTRDirectionParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< SteihaugCGParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< StructuredNewtonRegularizationParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< StructuredNewtonDirectionParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< ALMParams< config_t > > &, ParamString)
 
template void set_param (detail::possible_alias_t< PANOCOCPParams< config_t > > &, ParamString)
 
template<class T >
static auto possible_keys (const T &tbl)
 
template<>
void set_param (Ipopt::IpoptApplication &app, ParamString s)
 
template void set_param (lbfgsb::LBFGSBSolver::Params &, ParamString)
 
template void set_param (qpalm::Settings &, ParamString)
 

Class Documentation

◆ alpaqa::params::dict_to_struct_table

struct alpaqa::params::dict_to_struct_table
+ Collaboration diagram for dict_to_struct_table< T >:

◆ alpaqa::params::ParamString

struct alpaqa::params::ParamString
+ Collaboration diagram for ParamString:
Class Members
string_view full_key Full key string, used for diagnostics.
string_view key The subkey to resolve next.
string_view value The value of the parameter to store.

◆ alpaqa::params::vec_from_file

struct alpaqa::params::vec_from_file
+ Collaboration diagram for vec_from_file< Conf >:
Class Members
length_t expected_size
optional< vec > value = std::nullopt

Typedef Documentation

◆ config_t

Definition at line 19 of file params.tpp.

◆ dict_to_struct_table_t

template<class T >
using dict_to_struct_table_t = std::map<std::string_view, param_setter_fun_t<T> >

Dictionary that maps struct attribute names to type-erased functions that set those attributes.

Definition at line 87 of file params.tpp.

Function Documentation

◆ assert_key_empty()

template<class T >
void assert_key_empty ( ParamString  s)

Throw a meaningful error when s.key is not empty, to indicate that the given type T is not of struct type and cannot be indexed into.

Definition at line 24 of file params.tpp.

+ Here is the call graph for this function:

◆ unsupported_type()

template<class T >
void unsupported_type ( T ,
ParamString  s 
)

Throw a meaningful error to indicate that parameters of type T are not supported or implemented.

Definition at line 34 of file params.tpp.

+ Here is the call graph for this function:

◆ set_param() [1/61]

template<>
void set_param ( bool b,
ParamString  s 
)

Definition at line 26 of file params.cpp.

+ Here is the caller graph for this function:

◆ set_param() [2/61]

template<>
void set_param ( std::string_view &  v,
ParamString  s 
)

Definition at line 41 of file params.cpp.

◆ set_param() [3/61]

template<>
void set_param ( std::string &  v,
ParamString  s 
)

Definition at line 47 of file params.cpp.

◆ set_param() [4/61]

template<class T >
requires ((std::floating_point<T> || std::integral<T>) && !std::is_enum_v<T>)
void set_param ( T f,
ParamString  s 
)

Update/overwrite the first argument based on the option in s.

Definition at line 54 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [5/61]

template<>
void set_param ( vec< config_t > &  v,
ParamString  s 
)

Definition at line 75 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [6/61]

template<>
void set_param ( vec_from_file< config_t > &  v,
ParamString  s 
)

Definition at line 85 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [7/61]

template<class Rep , class Period >
void set_param ( std::chrono::duration< Rep, Period > &  t,
ParamString  s 
)

Definition at line 120 of file params.cpp.

+ Here is the call graph for this function:

◆ param_setter()

template<class T , class T_actual , class A >
auto param_setter ( A T_actual::*  attr)

Return a function that applies set_param to the given attribute of a value of type T.

Definition at line 70 of file params.tpp.

+ Here is the call graph for this function:

◆ possible_keys() [1/2]

template<class T >
auto possible_keys ( )

Return a string enumerating the possible attribute names for the struct type T.

Definition at line 98 of file params.tpp.

+ Here is the caller graph for this function:

◆ set_param() [8/61]

template<class T >
requires requires { dict_to_struct_table<T>::table; }
void set_param ( T t,
ParamString  s 
)

Use s to index into the struct type T and overwrite the attribute given by s.key.

Update/overwrite the first argument based on the option in s.

Definition at line 114 of file params.tpp.

+ Here is the call graph for this function:

◆ split_key()

auto split_key ( std::string_view  full,
char  tok = '.' 
)
inline

Split the string full on the first occurrence of tok.

Returns (s, "") if tok was not found.

Definition at line 32 of file params.hpp.

+ Here is the caller graph for this function:

◆ set_param() [9/61]

template<class T >
void set_param ( T t,
ParamString  s 
)

Update/overwrite the first argument based on the option in s.

Update/overwrite the first argument based on the option in s.

Definition at line 54 of file params.cpp.

+ Here is the call graph for this function:

◆ set_params()

template<class T >
void set_params ( T t,
std::string_view  prefix,
std::span< const std::string_view >  options,
std::optional< std::span< unsigned > >  used = std::nullopt 
)

Overwrites t based on the options that start with prefix.

If used is not nullopt, sets corresponding flag of the options that were used.

Examples
problems/sparse-logistic-regression.cpp.

Definition at line 49 of file params.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_param() [10/61]

template<>
void set_param ( bool b,
ParamString  s 
)

Definition at line 26 of file params.cpp.

+ Here is the caller graph for this function:

◆ set_param() [11/61]

template<>
void set_param ( std::string_view &  v,
ParamString  s 
)

Definition at line 41 of file params.cpp.

◆ set_param() [12/61]

template<>
void set_param ( std::string &  v,
ParamString  s 
)

Definition at line 47 of file params.cpp.

◆ set_param() [13/61]

template<>
void set_param ( alpaqa::vec< config_t > &  v,
ParamString  s 
)

Definition at line 75 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [14/61]

template<>
void set_param ( vec_from_file< config_t > &  v,
ParamString  s 
)

Definition at line 85 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [15/61]

template<>
void set_param ( LBFGSStepSize t,
ParamString  s 
)

Definition at line 164 of file params.cpp.

◆ set_param() [16/61]

template<>
void set_param ( PANOCStopCrit t,
ParamString  s 
)

Definition at line 176 of file params.cpp.

◆ set_param() [17/61]

template<class... Ts>
void set_param ( detail::_dummy< Ts... > &  ,
ParamString   
)

Definition at line 400 of file params.cpp.

◆ set_param() [18/61]

◆ set_param() [19/61]

◆ set_param() [20/61]

◆ set_param() [21/61]

◆ set_param() [22/61]

◆ set_param() [23/61]

◆ set_param() [24/61]

◆ set_param() [25/61]

◆ set_param() [26/61]

◆ set_param() [27/61]

◆ set_param() [28/61]

◆ set_param() [29/61]

◆ set_param() [30/61]

◆ set_param() [31/61]

◆ set_param() [32/61]

◆ set_param() [33/61]

◆ set_param() [34/61]

◆ set_param() [35/61]

◆ set_param() [36/61]

◆ set_param() [37/61]

◆ set_param() [38/61]

◆ set_param() [39/61]

template void set_param ( detail::possible_alias_t< std::chrono::nanoseconds > &  ,
ParamString   
)

◆ set_param() [40/61]

template void set_param ( detail::possible_alias_t< std::chrono::microseconds > &  ,
ParamString   
)

◆ set_param() [41/61]

template void set_param ( detail::possible_alias_t< std::chrono::milliseconds > &  ,
ParamString   
)

◆ set_param() [42/61]

template void set_param ( detail::possible_alias_t< std::chrono::seconds > &  ,
ParamString   
)

◆ set_param() [43/61]

template void set_param ( detail::possible_alias_t< std::chrono::minutes > &  ,
ParamString   
)

◆ set_param() [44/61]

template void set_param ( detail::possible_alias_t< std::chrono::hours > &  ,
ParamString   
)

◆ set_param() [45/61]

◆ set_param() [46/61]

◆ set_param() [47/61]

◆ set_param() [48/61]

◆ set_param() [49/61]

◆ set_param() [50/61]

◆ set_param() [51/61]

◆ set_param() [52/61]

◆ set_param() [53/61]

◆ set_param() [54/61]

◆ set_param() [55/61]

◆ set_param() [56/61]

◆ set_param() [57/61]

◆ set_param() [58/61]

◆ possible_keys() [2/2]

template<class T >
static auto possible_keys ( const T tbl)
static

Definition at line 11 of file ipopt-params.cpp.

◆ set_param() [59/61]

template<>
void set_param ( Ipopt::IpoptApplication &  app,
ParamString  s 
)

Definition at line 23 of file ipopt-params.cpp.

+ Here is the call graph for this function:

◆ set_param() [60/61]

◆ set_param() [61/61]

template void set_param ( qpalm::Settings &  ,
ParamString   
)