alpaqa 1.0.0a8
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< 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 A >
auto param_setter (A T::*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< bool > > 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 IPOPT_ADAPTER_EXPORT set_param (Ipopt::IpoptApplication &app, ParamString s)
 
template void LBFGSB_ADAPTER_EXPORT set_param (lbfgsb::LBFGSBSolver::Params &, 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

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 82 of file params.tpp.

Function Documentation

◆ assert_key_empty()

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()

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/60]

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/60]

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

Definition at line 41 of file params.cpp.

◆ set_param() [3/60]

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

Definition at line 47 of file params.cpp.

◆ set_param() [4/60]

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/60]

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

Definition at line 66 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [6/60]

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

Definition at line 76 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [7/60]

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

Definition at line 111 of file params.cpp.

+ Here is the call graph for this function:

◆ param_setter()

auto param_setter ( A T::*  attr)

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

Definition at line 65 of file params.tpp.

+ Here is the call graph for this function:

◆ possible_keys() [1/2]

auto possible_keys ( )

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

Definition at line 93 of file params.tpp.

+ Here is the caller graph for this function:

◆ set_param() [8/60]

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 109 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/60]

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()

void set_params ( T &  t,
std::string_view  prefix,
std::span< const std::string_view >  options,
std::optional< std::span< bool > >  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.

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/60]

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/60]

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

Definition at line 41 of file params.cpp.

◆ set_param() [12/60]

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

Definition at line 47 of file params.cpp.

◆ set_param() [13/60]

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

Definition at line 66 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [14/60]

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

Definition at line 76 of file params.cpp.

+ Here is the call graph for this function:

◆ set_param() [15/60]

void set_param ( LBFGSStepSize t,
ParamString  s 
)

Definition at line 156 of file params.cpp.

◆ set_param() [16/60]

void set_param ( PANOCStopCrit t,
ParamString  s 
)

Definition at line 168 of file params.cpp.

◆ set_param() [17/60]

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

Definition at line 401 of file params.cpp.

◆ set_param() [18/60]

template void set_param ( detail::possible_alias_t< float > &  ,
ParamString   
)

◆ set_param() [19/60]

template void set_param ( detail::possible_alias_t< double, float > &  ,
ParamString   
)

◆ set_param() [20/60]

template void set_param ( detail::possible_alias_t< long double, double, float > &  ,
ParamString   
)

◆ set_param() [21/60]

template void set_param ( detail::possible_alias_t< int8_t > &  ,
ParamString   
)

◆ set_param() [22/60]

template void set_param ( detail::possible_alias_t< uint8_t > &  ,
ParamString   
)

◆ set_param() [23/60]

template void set_param ( detail::possible_alias_t< int16_t > &  ,
ParamString   
)

◆ set_param() [24/60]

template void set_param ( detail::possible_alias_t< uint16_t > &  ,
ParamString   
)

◆ set_param() [25/60]

template void set_param ( detail::possible_alias_t< int32_t > &  ,
ParamString   
)

◆ set_param() [26/60]

template void set_param ( detail::possible_alias_t< int64_t > &  ,
ParamString   
)

◆ set_param() [27/60]

template void set_param ( detail::possible_alias_t< uint32_t > &  ,
ParamString   
)

◆ set_param() [28/60]

template void set_param ( detail::possible_alias_t< uint64_t > &  ,
ParamString   
)

◆ set_param() [29/60]

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   
)

◆ set_param() [30/60]

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   
)

◆ set_param() [31/60]

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   
)

◆ set_param() [32/60]

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   
)

◆ set_param() [33/60]

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   
)

◆ set_param() [34/60]

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   
)

◆ set_param() [35/60]

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   
)

◆ set_param() [36/60]

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   
)

◆ set_param() [37/60]

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   
)

◆ set_param() [38/60]

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   
)

◆ set_param() [39/60]

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

◆ set_param() [40/60]

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

◆ set_param() [41/60]

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

◆ set_param() [42/60]

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

◆ set_param() [43/60]

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

◆ set_param() [44/60]

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

◆ set_param() [45/60]

template void set_param ( detail::possible_alias_t< PANOCParams< config_t > > &  ,
ParamString   
)

◆ set_param() [46/60]

template void set_param ( detail::possible_alias_t< ZeroFPRParams< config_t > > &  ,
ParamString   
)

◆ set_param() [47/60]

template void set_param ( detail::possible_alias_t< PANTRParams< config_t > > &  ,
ParamString   
)

◆ set_param() [48/60]

template void set_param ( detail::possible_alias_t< LBFGSParams< config_t > > &  ,
ParamString   
)

◆ set_param() [49/60]

template void set_param ( detail::possible_alias_t< AndersonAccelParams< config_t > > &  ,
ParamString   
)

◆ set_param() [50/60]

template void set_param ( detail::possible_alias_t< LBFGSDirectionParams< config_t > > &  ,
ParamString   
)

◆ set_param() [51/60]

template void set_param ( detail::possible_alias_t< AndersonDirectionParams< config_t > > &  ,
ParamString   
)

◆ set_param() [52/60]

template void set_param ( detail::possible_alias_t< StructuredLBFGSDirectionParams< config_t > > &  ,
ParamString   
)

◆ set_param() [53/60]

template void set_param ( detail::possible_alias_t< NewtonTRDirectionParams< config_t > > &  ,
ParamString   
)

◆ set_param() [54/60]

template void set_param ( detail::possible_alias_t< SteihaugCGParams< config_t > > &  ,
ParamString   
)

◆ set_param() [55/60]

◆ set_param() [56/60]

template void set_param ( detail::possible_alias_t< StructuredNewtonDirectionParams< config_t > > &  ,
ParamString   
)

◆ set_param() [57/60]

template void set_param ( detail::possible_alias_t< ALMParams< config_t > > &  ,
ParamString   
)

◆ set_param() [58/60]

template void set_param ( detail::possible_alias_t< PANOCOCPParams< config_t > > &  ,
ParamString   
)

◆ possible_keys() [2/2]

static auto possible_keys ( const T &  tbl)
static

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

◆ set_param() [59/60]

void IPOPT_ADAPTER_EXPORT 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/60]

template void LBFGSB_ADAPTER_EXPORT set_param ( lbfgsb::LBFGSBSolver::Params ,
ParamString   
)