Loading...
Searching...
No Matches
constraint-base.hpp
Go to the documentation of this file.
1//
2// Copyright (c) 2017 CNRS
3//
4// This file is part of tsid
5// tsid is free software: you can redistribute it
6// and/or modify it under the terms of the GNU Lesser General Public
7// License as published by the Free Software Foundation, either version
8// 3 of the License, or (at your option) any later version.
9// tsid is distributed in the hope that it will be
10// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Lesser Public License for more details. You should have
13// received a copy of the GNU Lesser General Public License along with
14// tsid If not, see
15// <http://www.gnu.org/licenses/>.
16//
17
18#ifndef __invdyn_math_constraint_base_hpp__
19#define __invdyn_math_constraint_base_hpp__
20
21#include "tsid/math/fwd.hpp"
22#include <string>
23
24namespace tsid
25{
26 namespace math
27 {
28
37 {
38 public:
39 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
40
41 ConstraintBase(const std::string & name);
42
43 ConstraintBase(const std::string & name,
44 const unsigned int rows,
45 const unsigned int cols);
46
47 ConstraintBase(const std::string & name,
49 virtual ~ConstraintBase() {}
50
51 virtual const std::string & name() const;
52 virtual unsigned int rows() const = 0;
53 virtual unsigned int cols() const = 0;
54 virtual void resize(const unsigned int r, const unsigned int c) = 0;
55
56 virtual bool isEquality() const = 0;
57 virtual bool isInequality() const = 0;
58 virtual bool isBound() const = 0;
59
60 virtual const Matrix & matrix() const;
61 virtual const Vector & vector() const = 0;
62 virtual const Vector & lowerBound() const = 0;
63 virtual const Vector & upperBound() const = 0;
64
65 virtual Matrix & matrix();
66 virtual Vector & vector() = 0;
67 virtual Vector & lowerBound() = 0;
68 virtual Vector & upperBound() = 0;
69
70 virtual bool setMatrix(ConstRefMatrix A);
71 virtual bool setVector(ConstRefVector b) = 0;
72 virtual bool setLowerBound(ConstRefVector lb) = 0;
73 virtual bool setUpperBound(ConstRefVector ub) = 0;
74
75 virtual bool checkConstraint(ConstRefVector x, double tol=1e-6) const = 0;
76
77 protected:
78
79 std::string m_name;
81 };
82
83 }
84}
85
86#endif // ifndef __invdyn_math_constraint_base_hpp__
Abstract class representing a linear equality/inequality constraint. Equality constraints are represe...
Definition: constraint-base.hpp:37
Matrix m_A
Definition: constraint-base.hpp:80
virtual void resize(const unsigned int r, const unsigned int c)=0
virtual bool setUpperBound(ConstRefVector ub)=0
virtual unsigned int cols() const =0
virtual unsigned int rows() const =0
virtual ~ConstraintBase()
Definition: constraint-base.hpp:49
virtual Vector & vector()=0
virtual bool isBound() const =0
virtual const Matrix & matrix() const
Definition: constraint-base.cpp:44
virtual const Vector & upperBound() const =0
std::string m_name
Definition: constraint-base.hpp:79
virtual bool setVector(ConstRefVector b)=0
virtual bool checkConstraint(ConstRefVector x, double tol=1e-6) const =0
virtual bool isInequality() const =0
virtual const std::string & name() const
Definition: constraint-base.cpp:39
virtual Vector & upperBound()=0
virtual Vector & lowerBound()=0
virtual const Vector & lowerBound() const =0
virtual const Vector & vector() const =0
virtual bool isEquality() const =0
virtual bool setMatrix(ConstRefMatrix A)
Definition: constraint-base.cpp:54
virtual bool setLowerBound(ConstRefVector lb)=0
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: fwd.hpp:37
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition: fwd.hpp:38
const Eigen::Ref< const Matrix > ConstRefMatrix
Definition: fwd.hpp:53
const Eigen::Ref< const Vector > ConstRefVector
Definition: fwd.hpp:50
Definition: constraint-bound.hpp:27