lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::Parametrizable Class Reference

Interface for objects that allow setting and getting parameters dynamically. More...

#include <Parametrizable.h>

Inheritance diagram for lucid::Parametrizable:
lucid::Estimator lucid::Kernel lucid::GradientOptimizable lucid::ModelEstimator lucid::GaussianKernel lucid::ValleePoussinKernel lucid::KernelRidgeRegressor

Public Member Functions

template<IsAnyOf< int, double, const Vector & > T>
get (Parameter parameter) const
 Get the value of the specified parameter.
 
template<Parameter P>
internal::ParameterType< P >::ref_type get () const
 Get the value of the specified parameter.
 
std::variant< int, double, Vector > get (Parameter parameter) const
 Get the value of the specified parameter.
 
void set (Parameter parameter, const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (const std::variant< int, double, Vector > &value)
 Set the parameter to the indicated value.
 
void set (Parameter parameter, std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
template<Parameter P>
void set (std::size_t idx, const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > &values)
 Set the parameter to the index-th value among the indicated values.
 
virtual void set (Parameter parameter, int value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, double value)
 Set the parameter to the indicated value.
 
virtual void set (Parameter parameter, const Vector &value)
 Set the parameter to the indicated value.
 
template<Parameter P>
void set (typename internal::ParameterType< P >::ref_type value)
 Set the parameter to the indicated value.
 
bool has (const Parameter parameter) const
 Check whether the parameter is present in this object.
 
Parameters parameters () const
 Get read-only access to the parameters of the parametrizable object.
 
std::vector< Parameterparameters_list () const
 Get read-only access to the list of parameters of the parametrizable object.
 
Parametrizableload (const Parametrizable &o)
 Load parameters from another Parametrizable object.
 

Protected Member Functions

virtual int get_i (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual double get_d (Parameter parameter) const
 Get the value of the specified parameter.
 
virtual const Vector & get_v (Parameter parameter) const
 Get the value of the specified parameter.
 

Protected Attributes

Parameters parameters_
 Parameters supported by this object.
 

Detailed Description

Interface for objects that allow setting and getting parameters dynamically.

Parametrizable objects can have parameters of different types, i.e., int, double, and eigen Vectors.

std::unique_ptr<Parametrizable> obj{make_unique<...>(...)};
obj->has(Parameter::SIGMA_L); // true if the parameter is present, false otherwise
obj->set(Parameter::SIGMA_L, 1.0); // set the parameter to 1.0
obj->get<double>(Parameter::SIGMA_L); // get the value of the parameter
@ SIGMA_L
Sigma_l parameter.
Definition Parameter.h:40

Member Function Documentation

◆ get() [1/3]

template<Parameter P>
internal::ParameterType< P >::ref_type lucid::Parametrizable::get ( ) const
inlinenodiscard

Get the value of the specified parameter.

Template Parameters
Pparameter to retrieve
Returns
value of the parameter
Precondition
The parameter must be present.

◆ get() [2/3]

template<IsAnyOf< int, double, const Vector & > T>
T lucid::Parametrizable::get ( Parameter parameter) const
nodiscard

Get the value of the specified parameter.

Template Parameters
Ttype of the value to retrieve
Parameters
parameterparameter to retrieve
Returns
value of the parameter
Precondition
The parameter must be present and be associated with a value of type T.

◆ get() [3/3]

template const Vector & lucid::Parametrizable::get< const Vector & > ( Parameter parameter) const
nodiscard

Get the value of the specified parameter.

Parameters
parameterparameter to retrieve
Returns
value of the parameter

◆ get_d()

double lucid::Parametrizable::get_d ( Parameter parameter) const
nodiscardprotectedvirtual

Get the value of the specified parameter.

Parameters
parameterparameter to retrieve
Returns
value of the parameter
Precondition
The parameter must be present and be associated with a value of type double.

Reimplemented in lucid::GaussianKernel, lucid::KernelRidgeRegressor, and lucid::ValleePoussinKernel.

◆ get_i()

int lucid::Parametrizable::get_i ( Parameter parameter) const
nodiscardprotectedvirtual

Get the value of the specified parameter.

Parameters
parameterparameter to retrieve
Returns
value of the parameter
Precondition
The parameter must be present and be associated with a value of type int.

Reimplemented in lucid::KernelRidgeRegressor.

◆ get_v()

const Vector & lucid::Parametrizable::get_v ( Parameter parameter) const
nodiscardprotectedvirtual

Get the value of the specified parameter.

Parameters
parameterparameter to retrieve
Returns
value of the parameter
Precondition
The parameter must be present and be associated with a value of type Vector.

Reimplemented in lucid::GaussianKernel, and lucid::KernelRidgeRegressor.

◆ has()

bool lucid::Parametrizable::has ( const Parameter parameter) const
inlinenodiscard

Check whether the parameter is present in this object.

Parameters
parameterparameter to check
Returns
true if the parameter is present
false if the parameter is not present

◆ load()

Parametrizable & lucid::Parametrizable::load ( const Parametrizable & o)

Load parameters from another Parametrizable object.

Only parameters that are present in both objects will be copied.

Parameters
oobject to copy parameters from
Returns
reference to this object

◆ parameters()

Parameters lucid::Parametrizable::parameters ( ) const
inlinenodiscard

Get read-only access to the parameters of the parametrizable object.

The parameters are stored in compressed form, needing bitwise operation to be accessed.

Returns
parameters of the parametrizable object

◆ parameters_list()

std::vector< Parameter > lucid::Parametrizable::parameters_list ( ) const
nodiscard

Get read-only access to the list of parameters of the parametrizable object.

Returns
list of parameters of the parametrizable object

◆ set() [1/8]

template<Parameter P>
void lucid::Parametrizable::set ( const std::variant< int, double, Vector > & value)
inline

Set the parameter to the indicated value.

Template Parameters
Pparameter to set
Parameters
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value matching the variant.

◆ set() [2/8]

void lucid::Parametrizable::set ( Parameter parameter,
const std::variant< int, double, Vector > & value )

Set the parameter to the indicated value.

Parameters
parameterparameter to set
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value matching the variant.

◆ set() [3/8]

void lucid::Parametrizable::set ( Parameter parameter,
const Vector & value )
virtual

Set the parameter to the indicated value.

Parameters
parameterparameter to set
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value of type Vector.

Reimplemented in lucid::GaussianKernel, and lucid::KernelRidgeRegressor.

◆ set() [4/8]

void lucid::Parametrizable::set ( Parameter parameter,
double value )
virtual

Set the parameter to the indicated value.

Parameters
parameterparameter to set
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value of type double.

Reimplemented in lucid::GaussianKernel, lucid::KernelRidgeRegressor, and lucid::ValleePoussinKernel.

◆ set() [5/8]

void lucid::Parametrizable::set ( Parameter parameter,
int value )
virtual

Set the parameter to the indicated value.

Parameters
parameterparameter to set
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value of type int.

Reimplemented in lucid::KernelRidgeRegressor.

◆ set() [6/8]

void lucid::Parametrizable::set ( Parameter parameter,
std::size_t idx,
const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > & values )

Set the parameter to the index-th value among the indicated values.

Parameters
parameterparameter to set
idxindex of the value to assign
valuesvalues to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value matching the variant.

◆ set() [7/8]

template<Parameter P>
void lucid::Parametrizable::set ( std::size_t idx,
const std::variant< std::vector< int >, std::vector< double >, std::vector< Vector > > & values )
inline

Set the parameter to the index-th value among the indicated values.

Template Parameters
Pparameter to set
Parameters
idxindex of the value to assign
valuesvalues to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value matching the variant.

◆ set() [8/8]

template<Parameter P>
void lucid::Parametrizable::set ( typename internal::ParameterType< P >::ref_type value)
inline

Set the parameter to the indicated value.

Template Parameters
Pparameter to set
Parameters
valuevalue to assign to the specified parameter
Precondition
The parameter must be present and be associated with a value of type Vector.

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