GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/core/activations/weighted-quadratic-barrier-double.cpp
Date: 2025-04-18 16:41:15
Exec Total Coverage
Lines: 0 10 0.0%
Branches: 0 34 0.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2025, University of Edinburgh, Heriot-Watt University
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
7 ///////////////////////////////////////////////////////////////////////////////
8
9 // Auto-generated file for double
10 #include "crocoddyl/core/activations/weighted-quadratic-barrier.hpp"
11
12 #include "python/crocoddyl/core/activation-base.hpp"
13 #include "python/crocoddyl/core/core.hpp"
14
15 namespace crocoddyl {
16 namespace python {
17
18 template <typename Model>
19 struct ActivationModelWeightedQuadraticBarrierVisitor
20 : public bp::def_visitor<
21 ActivationModelWeightedQuadraticBarrierVisitor<Model>> {
22 typedef typename Model::Scalar Scalar;
23 template <class PyClass>
24 void visit(PyClass& cl) const {
25 cl.def("calc", &Model::calc, bp::args("self", "data", "r"),
26 "Compute the inequality activation.\n\n"
27 ":param data: activation data\n"
28 ":param r: residual vector")
29 .def("calcDiff", &Model::calcDiff, bp::args("self", "data", "r"),
30 "Compute the derivatives of inequality activation.\n\n"
31 "Note that the Hessian is constant, so we don't write again this "
32 "value. It assumes that calc has been run first.\n"
33 ":param data: activation data\n"
34 ":param r: residual vector \n")
35 .def("createData", &Model::createData, bp::args("self"),
36 "Create the weighted quadratic activation data.")
37 .add_property(
38 "bounds",
39 bp::make_function(&Model::get_bounds,
40 bp::return_value_policy<bp::return_by_value>()),
41 bp::make_function(&Model::set_bounds),
42 "bounds (beta, lower and upper bounds)")
43 .add_property("weights",
44 bp::make_function(&Model::get_weights,
45 bp::return_internal_reference<>()),
46 bp::make_function(&Model::set_weights),
47 "vector of weights");
48 }
49 };
50
51 #define CROCODDYL_ACTIVATION_MODEL_WEIGHTEDQUADRATICBARRIER_PYTHON_BINDINGS( \
52 Scalar) \
53 typedef ActivationModelWeightedQuadraticBarrierTpl<Scalar> Model; \
54 typedef ActivationModelAbstractTpl<Scalar> ModelBase; \
55 typedef ActivationBoundsTpl<Scalar> Bounds; \
56 typedef typename Model::VectorXs VectorXs; \
57 bp::register_ptr_to_python<std::shared_ptr<Model>>(); \
58 bp::class_<Model, bp::bases<ModelBase>>( \
59 "ActivationModelWeightedQuadraticBarrier", \
60 "Inequality activation model.\n\n" \
61 "The activation is zero when r is between the lower (lb) and upper " \
62 "(ub) bounds, beta determines how much of the total range is not " \
63 "activated. This is the activation equations:\n" \
64 "a(r) = 0.5 * ||r||_w^2 for lb < r < ub\n" \
65 "a(r) = 0. for lb >= r >= ub,\n" \
66 "where w is the vector of weights", \
67 bp::init<Bounds, VectorXs>(bp::args("self", "bounds", "weights"), \
68 "Initialize the activation model.\n\n" \
69 ":param bounds: activation bounds\n" \
70 ":param weights: weights")) \
71 .def(ActivationModelWeightedQuadraticBarrierVisitor<Model>()) \
72 .def(CastVisitor<Model>()) \
73 .def(PrintableVisitor<Model>()) \
74 .def(CopyableVisitor<Model>());
75
76 void exposeActivationWeightedQuadraticBarrier() {
77 CROCODDYL_ACTIVATION_MODEL_WEIGHTEDQUADRATICBARRIER_PYTHON_BINDINGS(double)
78 }
79
80 } // namespace python
81 } // namespace crocoddyl
82