hpp-constraints: include/hpp/constraints/active-set-differentiable-function.hh Source File

hpp-constraints 9.0.2 Definition of basic geometric constraints for motion planning

Loading...
Searching...
No Matches
active-set-differentiable-function.hh
Go to the documentation of this file.
1// Copyright (c) 2017, Joseph Mirabel
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3//
4
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// 1. Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27// DAMAGE.
28
29#ifndef HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
30#define HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
31
32#include <hpp/constraints/config.hh>
33#include <hpp/constraints/differentiable-function.hh>
34#include <hpp/constraints/fwd.hh>
35
36 namespace hpp {
37 namespace constraints {
38
47 class HPP_CONSTRAINTS_DLLAPI ActiveSetDifferentiableFunction
48 : public DifferentiableFunction {
49 public:
54 ActiveSetDifferentiableFunction(const DifferentiableFunctionPtr_t& f,
55 segments_t intervals)
56 : DifferentiableFunction(f->inputSize(), f->inputDerivativeSize(),
57 f->outputSpace(), "ActiveSet_on_" + f->name()),
58 function_(f),
59 intervals_(intervals) {
60 context(f->context());
61 }
62
64 const DifferentiableFunction& function() const { return *function_; }
65
67 const DifferentiableFunctionPtr_t& functionPtr() const { return function_; }
68
69 protected:
70 typedef std::vector<segments_t> intervalss_t;
71
73 virtual void impl_compute(LiegroupElementRef result,
74 vectorIn_t argument) const {
75 function_->value(result, argument);
76 }
77
78 virtual void impl_jacobian(matrixOut_t jacobian, vectorIn_t arg) const {
79 function_->jacobian(jacobian, arg);
80 for (segments_t::const_iterator _int = intervals_.begin();
81 _int != intervals_.end(); ++_int)
82 jacobian.middleCols(_int->first, _int->second).setZero();
83 }
84
85 bool isEqual(const DifferentiableFunction& other) const {
86 const ActiveSetDifferentiableFunction& castother =
87 dynamic_cast<const ActiveSetDifferentiableFunction&>(other);
88 if (!DifferentiableFunction::isEqual(other)) return false;
89
90 if (function_ != castother.function_) return false;
91 if (intervals_ != castother.intervals_) return false;
92
93 return true;
94 }
95
96 DifferentiableFunctionPtr_t function_;
97 segments_t intervals_;
98}; // class ActiveSetDifferentiableFunction
99} // namespace constraints
100} // namespace hpp
101
102#endif // HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
hpp::constraints::ActiveSetDifferentiableFunction
Definition active-set-differentiable-function.hh:48
hpp::constraints::ActiveSetDifferentiableFunction::isEqual
bool isEqual(const DifferentiableFunction &other) const
Definition active-set-differentiable-function.hh:85
hpp::constraints::ActiveSetDifferentiableFunction::intervals_
segments_t intervals_
Definition active-set-differentiable-function.hh:97
hpp::constraints::ActiveSetDifferentiableFunction::functionPtr
const DifferentiableFunctionPtr_t & functionPtr() const
Get the original function.
Definition active-set-differentiable-function.hh:67
hpp::constraints::ActiveSetDifferentiableFunction::function
const DifferentiableFunction & function() const
Get the original function.
Definition active-set-differentiable-function.hh:64
hpp::constraints::ActiveSetDifferentiableFunction::impl_compute
virtual void impl_compute(LiegroupElementRef result, vectorIn_t argument) const
User implementation of function evaluation.
Definition active-set-differentiable-function.hh:73
hpp::constraints::ActiveSetDifferentiableFunction::impl_jacobian
virtual void impl_jacobian(matrixOut_t jacobian, vectorIn_t arg) const
Definition active-set-differentiable-function.hh:78
hpp::constraints::ActiveSetDifferentiableFunction::function_
DifferentiableFunctionPtr_t function_
Definition active-set-differentiable-function.hh:96
hpp::constraints::ActiveSetDifferentiableFunction::ActiveSetDifferentiableFunction
ActiveSetDifferentiableFunction(const DifferentiableFunctionPtr_t &f, segments_t intervals)
Definition active-set-differentiable-function.hh:54
hpp::constraints::ActiveSetDifferentiableFunction::intervalss_t
std::vector< segments_t > intervalss_t
Definition active-set-differentiable-function.hh:70
hpp::constraints::DifferentiableFunction
Definition differentiable-function.hh:63
hpp::pinocchio::LiegroupElementBase
config.hh
HPP_CONSTRAINTS_DLLAPI
#define HPP_CONSTRAINTS_DLLAPI
Definition config.hh:88
differentiable-function.hh
fwd.hh
hpp::constraints::DifferentiableFunctionPtr_t
shared_ptr< DifferentiableFunction > DifferentiableFunctionPtr_t
Definition fwd.hh:115
hpp::constraints::vectorIn_t
pinocchio::vectorIn_t vectorIn_t
Definition fwd.hh:61
hpp::constraints::matrixOut_t
Eigen::Ref< matrix_t > matrixOut_t
Definition fwd.hh:59
hpp::constraints::segments_t
std::vector< segment_t > segments_t
Definition fwd.hh:86
hpp