misc_edges.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_EDGES_MISC_EDGES_H_
26 #define SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_EDGES_MISC_EDGES_H_
27 
29 
34 
35 #include <functional>
36 #include <memory>
37 
38 namespace corbo {
39 
40 class TwoScalarEqualEdge : public Edge<ScalarVertex, ScalarVertex>
41 {
42  public:
43  using Ptr = std::shared_ptr<TwoScalarEqualEdge>;
44  using UPtr = std::unique_ptr<TwoScalarEqualEdge>;
45 
47 
48  // implements interface method
49  int getDimension() const override { return 1; }
50  // implement in child class:
51  bool isLinear() const override { return true; }
52 
53  // bool providesJacobian() const override { return false; }
54 
55  bool isLeastSquaresForm() const override { return false; }
56 
58  {
59  const ScalarVertex* s1 = static_cast<const ScalarVertex*>(_vertices[0]);
60  const ScalarVertex* s2 = static_cast<const ScalarVertex*>(_vertices[1]);
61 
62  values.coeffRef(0) = s2->value() - s1->value();
63  }
64 
65  public:
67 };
68 
69 } // namespace corbo
70 
71 #endif // SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_EDGES_MISC_EDGES_H_
bool isLinear() const override
Return true if the edge is linear (and hence its Hessian is always zero)
Definition: misc_edges.h:51
std::shared_ptr< TwoScalarEqualEdge > Ptr
Definition: misc_edges.h:43
TwoScalarEqualEdge(ScalarVertex &s1, ScalarVertex &s2)
Definition: misc_edges.h:46
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition: Memory.h:690
Vertex implementation for scalar values.
Definition: scalar_vertex.h:50
std::unique_ptr< TwoScalarEqualEdge > UPtr
Definition: misc_edges.h:44
void computeValues(Eigen::Ref< Eigen::VectorXd > values) override
Compute function values.
Definition: misc_edges.h:57
int getDimension() const override
Get dimension of the edge (dimension of the cost-function/constraint value vector) ...
Definition: misc_edges.h:49
bool isLeastSquaresForm() const override
Defines if the edge is formulated as Least-Squares form.
Definition: misc_edges.h:55
const double & value() const
Get underlying value.
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:192
Templated base edge class that stores an arbitary number of value.
Definition: edge.h:148
const VertexContainer _vertices
Vertex container.
Definition: edge.h:214


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:07:05