pinocchio
4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Toggle main menu visibility
Loading...
Searching...
No Matches
proximal.hpp
1
//
2
// Copyright (c) 2019-2022 INRIA
3
//
4
5
#pragma once
6
7
#include "pinocchio/algorithm/proximal.hpp"
8
9
#include <sstream>
10
11
namespace
pinocchio
12
{
13
namespace
python
14
{
15
namespace
bp = boost::python;
16
17
template
<
typename
ProximalSettings>
18
struct
ProximalSettingsPythonVisitor
19
:
public
boost::python::def_visitor<ProximalSettingsPythonVisitor<ProximalSettings>>
20
{
21
typedef
typename
ProximalSettings::Scalar Scalar;
22
23
public
:
24
template
<
class
PyClass>
25
void
visit(PyClass & cl)
const
26
{
27
cl.def(bp::init<>(
"Default constructor."
, bp::arg(
"self"
)))
28
.def(
29
bp::init<const Scalar, const Scalar, int>(
30
(bp::arg(
"self"
), bp::arg(
"accuracy"
), bp::arg(
"mu"
), bp::arg(
"max_iter"
)),
31
"Structure containing all the settings parameters for the proximal algorithms."
))
32
.def(
33
bp::init<const Scalar, const Scalar, const Scalar, int>(
34
(bp::arg(
"self"
), bp::arg(
"absolute_accuracy"
), bp::arg(
"relative_accuracy"
),
35
bp::arg(
"mu"
), bp::arg(
"max_iter"
)),
36
"Structure containing all the settings parameters for the proximal algorithms."
))
37
38
.add_property(
39
"absolute_accuracy"
, &ProximalSettings::absolute_accuracy,
40
"Absolute proximal accuracy."
)
41
.add_property(
42
"relative_accuracy"
, &ProximalSettings::relative_accuracy,
43
"Relative proximal accuracy between two iterates."
)
44
.add_property(
45
"mu"
, &ProximalSettings::mu,
"Regularization parameter of the Proximal algorithms."
)
46
.add_property(
"max_iter"
, &ProximalSettings::max_iter,
"Maximal number of iterations."
)
47
48
.add_property(
49
"absolute_residual"
, &ProximalSettings::absolute_residual,
"Absolute residual."
)
50
.add_property(
51
"relative_residual"
, &ProximalSettings::relative_residual,
52
"Relatice residual between two iterates."
)
53
54
.add_property(
55
"iter"
, &ProximalSettings::iter,
56
"Final number of iteration of the algorithm when it has converged or "
57
"reached the maximal number of allowed iterations."
)
58
.def(
"__repr__"
, &repr);
59
}
60
61
static
void
expose()
62
{
63
bp::class_<ProximalSettings>(
64
"ProximalSettings"
,
65
"Structure containing all the settings parameters for proximal algorithms."
, bp::no_init)
66
.def(
ProximalSettingsPythonVisitor<ProximalSettings>
());
67
}
68
69
private
:
70
static
std::string repr(
const
ProximalSettings & self)
71
{
72
std::stringstream ss_repr;
73
74
ss_repr <<
"ProximalSettings("
;
75
ss_repr << self.absolute_accuracy <<
", "
;
76
ss_repr << self.relative_accuracy <<
", "
;
77
ss_repr << self.mu <<
", "
;
78
ss_repr << self.max_iter;
79
ss_repr <<
")"
;
80
81
return
ss_repr.str();
82
}
83
};
84
85
}
// namespace python
86
}
// namespace pinocchio
pinocchio
Main pinocchio namespace.
Definition
treeview.dox:11
pinocchio::python::ProximalSettingsPythonVisitor
Definition
proximal.hpp:20
include
pinocchio
bindings
python
algorithm
proximal.hpp
Generated by
1.17.0