aligator
0.19.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Toggle main menu visibility
Loading...
Searching...
No Matches
box-constraint.hpp
Go to the documentation of this file.
1
3
#pragma once
4
5
#include "
aligator/core/constraint-set.hpp
"
6
7
namespace
aligator
{
8
10
template
<
typename
Scalar>
struct
BoxConstraintTpl
:
ConstraintSetTpl
<Scalar> {
11
ALIGATOR_DYNAMIC_TYPEDEFS
(
Scalar
);
12
using
Base
=
ConstraintSetTpl<Scalar>
;
13
using
ActiveType
=
typename
Base::ActiveType
;
14
15
VectorXs
lower_limit
;
16
VectorXs
upper_limit
;
17
18
BoxConstraintTpl
(
const
ConstVectorRef lower,
const
ConstVectorRef upper)
19
:
Base
()
20
,
lower_limit
(lower)
21
,
upper_limit
(upper) {}
22
BoxConstraintTpl
(
const
BoxConstraintTpl
&) =
default
;
23
BoxConstraintTpl
&
operator=
(
const
BoxConstraintTpl
&) =
default
;
24
BoxConstraintTpl
(
BoxConstraintTpl
&&) =
default
;
25
BoxConstraintTpl
&
operator=
(
BoxConstraintTpl
&&) =
default
;
26
27
decltype
(
auto
)
projection_impl
(
const
ConstVectorRef &z)
const
{
28
return
z.cwiseMin(
upper_limit
).cwiseMax(
lower_limit
);
29
}
30
31
void
projection
(
const
ConstVectorRef &z, VectorRef zout)
const
{
32
zout =
projection_impl
(z);
33
}
34
35
void
normalConeProjection
(
const
ConstVectorRef &z, VectorRef zout)
const
{
36
zout = z -
projection_impl
(z);
37
}
38
39
void
computeActiveSet
(
const
ConstVectorRef &z,
40
Eigen::Ref<ActiveType> out)
const
{
41
out.array() =
42
(z.array() >
upper_limit
.array()) || (z.array() <
lower_limit
.array());
43
}
44
};
45
46
}
// namespace aligator
constraint-set.hpp
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
aligator::BoxConstraintTpl::Base
ConstraintSetTpl< Scalar > Base
Definition
box-constraint.hpp:12
aligator::BoxConstraintTpl::lower_limit
VectorXs lower_limit
Definition
box-constraint.hpp:15
aligator::BoxConstraintTpl::projection_impl
decltype(auto) projection_impl(const ConstVectorRef &z) const
Definition
box-constraint.hpp:27
aligator::BoxConstraintTpl::projection
void projection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of variable z onto the constraint set.
Definition
box-constraint.hpp:31
aligator::BoxConstraintTpl::normalConeProjection
void normalConeProjection(const ConstVectorRef &z, VectorRef zout) const
Compute projection of z onto the normal cone to the set. The default implementation is just .
Definition
box-constraint.hpp:35
aligator::BoxConstraintTpl::BoxConstraintTpl
BoxConstraintTpl(const BoxConstraintTpl &)=default
aligator::BoxConstraintTpl::operator=
BoxConstraintTpl & operator=(BoxConstraintTpl &&)=default
aligator::BoxConstraintTpl::computeActiveSet
void computeActiveSet(const ConstVectorRef &z, Eigen::Ref< ActiveType > out) const
Definition
box-constraint.hpp:39
aligator::BoxConstraintTpl::BoxConstraintTpl
BoxConstraintTpl(BoxConstraintTpl &&)=default
aligator::BoxConstraintTpl::ActiveType
typename Base::ActiveType ActiveType
Definition
box-constraint.hpp:13
aligator::BoxConstraintTpl::upper_limit
VectorXs upper_limit
Definition
box-constraint.hpp:16
aligator::BoxConstraintTpl::operator=
BoxConstraintTpl & operator=(const BoxConstraintTpl &)=default
aligator::BoxConstraintTpl::BoxConstraintTpl
BoxConstraintTpl(const ConstVectorRef lower, const ConstVectorRef upper)
Definition
box-constraint.hpp:18
aligator::BoxConstraintTpl::ALIGATOR_DYNAMIC_TYPEDEFS
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
aligator::ConstraintSetTpl< Scalar >::ConstraintSetTpl
ConstraintSetTpl()=default
aligator::ConstraintSetTpl< Scalar >::ActiveType
Eigen::Matrix< bool, Eigen::Dynamic, 1 > ActiveType
Definition
constraint-set.hpp:20
aligator::ConstraintSetTpl< Scalar >::Scalar
Scalar Scalar
Definition
constraint-set.hpp:18
include
aligator
modelling
constraints
box-constraint.hpp
Generated by
1.17.0