algorithm/proximal.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019-2022 INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_proximal_hpp__
6 #define __pinocchio_algorithm_proximal_hpp__
7 
8 #include <Eigen/Core>
11 
12 namespace pinocchio
13 {
14 
23  template<typename _Scalar>
24  struct ProximalSettingsTpl
25  {
26  typedef _Scalar Scalar;
27 
30  : absolute_accuracy(Eigen::NumTraits<Scalar>::dummy_precision())
31  , relative_accuracy(Eigen::NumTraits<Scalar>::dummy_precision())
32  , mu(0)
33  , max_iter(1)
34  , absolute_residual(-1.)
35  , relative_residual(-1.)
36  , iter(0)
37  {
38  }
39 
43  ProximalSettingsTpl(const Scalar accuracy, const Scalar mu, const int max_iter)
44  : absolute_accuracy(accuracy)
45  , relative_accuracy(accuracy)
46  , mu(mu)
48  , absolute_residual(-1.)
49  , relative_residual(-1.)
50  , iter(0)
51  {
53  check_expression_if_real<Scalar>(accuracy >= 0.) && "Accuracy must be positive.");
55  check_expression_if_real<Scalar>(mu >= 0.) && "mu must be positive");
56  assert(max_iter >= 1 && "max_iter must be greater or equal to 1");
57  }
58 
65  const Scalar mu,
66  const int max_iter)
69  , mu(mu)
71  , absolute_residual(-1.)
72  , relative_residual(-1.)
73  , iter(0)
74  {
76  check_expression_if_real<Scalar>(absolute_accuracy >= 0.)
77  && "Absolute accuracy must be positive.");
79  check_expression_if_real<Scalar>(relative_accuracy >= 0.)
80  && "Relative accuracy must be positive.");
82  check_expression_if_real<Scalar>(mu >= 0.) && "mu must be positive");
83  assert(max_iter >= 1 && "max_iter must be greater or equal to 1");
84  }
85 
86  // data
87 
90 
93 
96 
98  int max_iter;
99 
100  // data that can be modified by the algorithm
101 
104 
107 
110  int iter;
111  };
112 
113 } // namespace pinocchio
114 
115 #if PINOCCHIO_ENABLE_TEMPLATE_INSTANTIATION
116  #include "pinocchio/algorithm/proximal.txx"
117 #endif // PINOCCHIO_ENABLE_TEMPLATE_INSTANTIATION
118 
119 #endif // ifndef __pinocchio_algorithm_proximal_hpp__
Eigen
pinocchio::ProximalSettingsTpl::ProximalSettingsTpl
ProximalSettingsTpl(const Scalar absolute_accuracy, const Scalar relative_accuracy, const Scalar mu, const int max_iter)
Constructor with all the setting parameters.
Definition: algorithm/proximal.hpp:62
PINOCCHIO_CHECK_INPUT_ARGUMENT
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
Definition: include/pinocchio/macros.hpp:192
pinocchio::ProximalSettingsTpl::mu
Scalar mu
Regularization parameter of the proximal algorithm.
Definition: algorithm/proximal.hpp:95
model.hpp
pinocchio::ProximalSettingsTpl::absolute_accuracy
Scalar absolute_accuracy
Absolute proximal accuracy.
Definition: algorithm/proximal.hpp:89
pinocchio::ProximalSettingsTpl::Scalar
_Scalar Scalar
Definition: algorithm/proximal.hpp:26
pinocchio::ProximalSettingsTpl::ProximalSettingsTpl
ProximalSettingsTpl(const Scalar accuracy, const Scalar mu, const int max_iter)
Constructor with all the setting parameters.
Definition: algorithm/proximal.hpp:43
data.hpp
pinocchio::ProximalSettingsTpl::relative_accuracy
Scalar relative_accuracy
Relative proximal accuracy between two iterates.
Definition: algorithm/proximal.hpp:92
pinocchio::ProximalSettingsTpl::absolute_residual
Scalar absolute_residual
Absolute residual.
Definition: algorithm/proximal.hpp:103
pinocchio::ProximalSettingsTpl::iter
int iter
Total number of iterations of the algorithm when it has converged or reached the maximal number of al...
Definition: algorithm/proximal.hpp:110
pinocchio::ProximalSettingsTpl::relative_residual
Scalar relative_residual
Relatice residual between two iterates.
Definition: algorithm/proximal.hpp:106
pinocchio::ProximalSettingsTpl::max_iter
int max_iter
Maximal number of iterations.
Definition: algorithm/proximal.hpp:98
pinocchio::ProximalSettingsTpl::ProximalSettingsTpl
ProximalSettingsTpl()
Default constructor.
Definition: algorithm/proximal.hpp:29
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:47