Skip to content

Commit 5d644d6

Browse files
committed
ran clang-format on ct_optcon
1 parent 723af06 commit 5d644d6

File tree

66 files changed

+427
-359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+427
-359
lines changed

ct_optcon/examples/ConstraintExampleOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void sparseBoxConstraintsExample()
143143
}
144144

145145

146-
int main(int argc, char **argv)
146+
int main(int argc, char** argv)
147147
{
148148
controlInputBoxConstraintExample();
149149
terminalConstraintExample();

ct_optcon/examples/DMS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Licensed under the BSD-2 license (see LICENSE file in main directory)
1313
*
1414
* \example DMS.cpp
1515
*/
16-
int main(int argc, char **argv)
16+
int main(int argc, char** argv)
1717
{
1818
using namespace ct::optcon;
1919
using namespace ct::core;

ct_optcon/examples/KalmanDisturbanceFiltering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class CustomController : public ct::core::Controller<state_dim, control_dim>
5656

5757
//! clone method, needs to be implemented, overrides ct::core::Controller::clone()
5858
CustomController* clone() const override { return new CustomController(*this); }
59-
6059
//! override the compute control method with a custom control law which includes a disturbance
6160
void computeControl(const ct::core::StateVector<state_dim>& state,
6261
const double& t,
@@ -248,7 +247,7 @@ int main(int argc, char** argv)
248247
}
249248

250249

251-
// plot if plotting library built.
250+
// plot if plotting library built.
252251
#ifdef PLOTTING_ENABLED
253252
// some temporary containers for plotting
254253
std::vector<double> time_plot;

ct_optcon/examples/NLOC_MPC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using namespace ct::optcon;
1313
*
1414
* \example NLOC_MPC.cpp
1515
*/
16-
int main(int argc, char **argv)
16+
int main(int argc, char** argv)
1717
{
1818
/* PRELIMINIARIES, see example NLOC.cpp */
1919

ct_optcon/examples/NLOC_boxConstrained.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace ct::core;
1414
using namespace ct::optcon;
1515

1616

17-
int main(int argc, char **argv)
17+
int main(int argc, char** argv)
1818
{
1919
/*get the state and control input dimension of the oscillator. Since we're dealing with a simple oscillator,
2020
the state and control dimensions will be state_dim = 2, and control_dim = 1. */

ct_optcon/examples/nlp/Nlp2D.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename SCALAR>
3333
class ExampleConstraints final : public tpl::DiscreteConstraintBase<SCALAR>
3434
{
3535
public:
36-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
3737
using VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>;
3838

3939
ExampleConstraints(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector)
@@ -98,7 +98,9 @@ class ExampleConstraints final : public tpl::DiscreteConstraintBase<SCALAR>
9898
*
9999
* \note this function implementation is only required for the exact-hessian solver case
100100
*/
101-
void sparseHessianValues(const Eigen::VectorXd& optVec, const Eigen::VectorXd& lambda, Eigen::VectorXd& sparseHes) override
101+
void sparseHessianValues(const Eigen::VectorXd& optVec,
102+
const Eigen::VectorXd& lambda,
103+
Eigen::VectorXd& sparseHes) override
102104
{
103105
sparseHes.resize(2);
104106
sparseHes.setConstant(lambda(2) * 2.0);
@@ -137,7 +139,7 @@ template <typename SCALAR>
137139
class ExampleCostEvaluator final : public tpl::DiscreteCostEvaluatorBase<SCALAR>
138140
{
139141
public:
140-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
142+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
141143
ExampleCostEvaluator(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector) {}
142144
~ExampleCostEvaluator() override = default;
143145

@@ -183,7 +185,7 @@ template <typename SCALAR>
183185
class ExampleConstraintsContainer final : public tpl::DiscreteConstraintContainerBase<SCALAR>
184186
{
185187
public:
186-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
188+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
187189
ExampleConstraintsContainer(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector)
188190
{
189191
auto exampleConstraints =
@@ -208,7 +210,7 @@ template <typename SCALAR>
208210
class ExampleProblem final : public tpl::Nlp<SCALAR>
209211
{
210212
public:
211-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
213+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
212214
ExampleProblem()
213215
{
214216
this->optVariables_ = std::shared_ptr<tpl::OptVector<SCALAR>>(new tpl::OptVector<SCALAR>(2));

ct_optcon/examples/nlp/Nlp3D.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ template <typename SCALAR>
3232
class ExampleConstraints final : public tpl::DiscreteConstraintBase<SCALAR>
3333
{
3434
public:
35-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
3636
using VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>;
3737

3838
static const size_t dimConstraints = 2;
3939
static const size_t nnzJac = 6;
40-
static const size_t nnzHes = 3; // (triangular view)
40+
static const size_t nnzHes = 3; // (triangular view)
4141

4242
ExampleConstraints(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector)
4343
{
@@ -126,7 +126,9 @@ class ExampleConstraints final : public tpl::DiscreteConstraintBase<SCALAR>
126126
/*!
127127
* \note this function implementation is only required for the exact-Hessian solver case
128128
*/
129-
void sparseHessianValues(const Eigen::VectorXd& optVec, const Eigen::VectorXd& lambda, Eigen::VectorXd& sparseHes) override
129+
void sparseHessianValues(const Eigen::VectorXd& optVec,
130+
const Eigen::VectorXd& lambda,
131+
Eigen::VectorXd& sparseHes) override
130132
{
131133
Eigen::VectorXd h1, h2;
132134
h1.resize(nnzHes);
@@ -156,8 +158,8 @@ template <typename SCALAR>
156158
class ExampleCostEvaluator final : public tpl::DiscreteCostEvaluatorBase<SCALAR>
157159
{
158160
public:
159-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
160-
static const size_t nnz_hessian = 2; //! number non-zero elements in the hessian (triangular view)
161+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
162+
static const size_t nnz_hessian = 2; //! number non-zero elements in the hessian (triangular view)
161163

162164
ExampleCostEvaluator(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector) {}
163165
~ExampleCostEvaluator() override = default;
@@ -203,7 +205,9 @@ class ExampleCostEvaluator final : public tpl::DiscreteCostEvaluatorBase<SCALAR>
203205
/*!
204206
* \note this function implementation is only required for the exact-Hessian solver case
205207
*/
206-
void sparseHessianValues(const Eigen::VectorXd& optVec, const Eigen::VectorXd& lambda, Eigen::VectorXd& hes) override
208+
void sparseHessianValues(const Eigen::VectorXd& optVec,
209+
const Eigen::VectorXd& lambda,
210+
Eigen::VectorXd& hes) override
207211
{
208212
hes.resize(nnz_hessian);
209213
hes.setConstant(-1.0 * lambda(0));
@@ -223,7 +227,7 @@ template <typename SCALAR>
223227
class ExampleConstraintsContainer final : public tpl::DiscreteConstraintContainerBase<SCALAR>
224228
{
225229
public:
226-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
230+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
227231
ExampleConstraintsContainer(std::shared_ptr<tpl::OptVector<SCALAR>> optVector) : optVector_(optVector)
228232
{
229233
this->constraints_.push_back(
@@ -247,7 +251,7 @@ template <typename SCALAR>
247251
class ExampleProblem final : public tpl::Nlp<SCALAR>
248252
{
249253
public:
250-
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
254+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
251255
ExampleProblem()
252256
{
253257
this->optVariables_ = std::shared_ptr<tpl::OptVector<SCALAR>>(new tpl::OptVector<SCALAR>(3));

ct_optcon/examples/switched_systems_optcon/StateSumConstraint.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@ class StateSumConstraint : public ct::optcon::ConstraintBase<2, 1>
2828
//! constructor with constraint boundaries.
2929
StateSumConstraint(double lb, double ub) : lb_(lb), ub_(ub)
3030
{
31-
Base::lb_.resize(1);
32-
Base::ub_.resize(1);
33-
Base::lb_.setConstant(lb);
34-
Base::ub_.setConstant(ub);
31+
Base::lb_.resize(1);
32+
Base::ub_.resize(1);
33+
Base::lb_.setConstant(lb);
34+
Base::ub_.setConstant(ub);
3535
}
3636

3737
virtual ~StateSumConstraint() {}
3838
virtual StateSumConstraint* clone() const override { return new StateSumConstraint(lb_, ub_); }
3939
virtual size_t getConstraintSize() const override { return 1; }
4040
virtual Eigen::VectorXd evaluate(const state_vector_t& x, const control_vector_t& u, const double t) override
4141
{
42-
Eigen::Matrix<double, 1, 1> val;
43-
val.template segment<1>(0) << x(0) + x(1);
44-
return val;
42+
Eigen::Matrix<double, 1, 1> val;
43+
val.template segment<1>(0) << x(0) + x(1);
44+
return val;
4545
}
4646

4747
virtual Eigen::Matrix<ct::core::ADCGScalar, Eigen::Dynamic, 1> evaluateCppadCg(
4848
const ct::core::StateVector<2, ct::core::ADCGScalar>& x,
4949
const ct::core::ControlVector<1, ct::core::ADCGScalar>& u,
5050
ct::core::ADCGScalar t) override
5151
{
52-
Eigen::Matrix<ct::core::ADCGScalar, 1, 1> val;
53-
val.template segment<1>(0) << x(0) + x(1);
54-
return val;
52+
Eigen::Matrix<ct::core::ADCGScalar, 1, 1> val;
53+
val.template segment<1>(0) << x(0) + x(1);
54+
return val;
5555
}
5656

5757
private:

ct_optcon/examples/switched_systems_optcon/plotResultsSwitched.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Licensed under the BSD-2 license (see LICENSE file in main directory)
66
#pragma once
77

88
void plotResults(const ct::core::StateVectorArray<2>& stateArray,
9-
const ct::core::ControlVectorArray<1>& controlArray,
10-
const ct::core::TimeArray& timeArray)
9+
const ct::core::ControlVectorArray<1>& controlArray,
10+
const ct::core::TimeArray& timeArray)
1111
{
1212
#ifdef PLOTTING_ENABLED
13-
using namespace ct::core;
13+
using namespace ct::core;
1414

1515
try
1616
{
@@ -72,6 +72,6 @@ void plotResults(const ct::core::StateVectorArray<2>& stateArray,
7272
std::cout << e.what() << std::endl;
7373
}
7474
#else
75-
std::cout << "Plotting is disabled." << std::endl;
75+
std::cout << "Plotting is disabled." << std::endl;
7676
#endif
7777
}

ct_optcon/examples/switched_systems_optcon/switched_continuous_optcon.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ int main(int argc, char** argv)
116116
generalConstraints_2->addIntermediateConstraint(phase2Constraint, verbose);
117117

118118
// Switched constraints
119-
SwitchedLinearConstraintContainer<STATE_DIM, CONTROL_DIM>::SwitchedLinearConstraintContainers switchedConstraintContainers;
119+
SwitchedLinearConstraintContainer<STATE_DIM, CONTROL_DIM>::SwitchedLinearConstraintContainers
120+
switchedConstraintContainers;
120121
switchedConstraintContainers.push_back(generalConstraints_1);
121122
switchedConstraintContainers.push_back(generalConstraints_2);
122123

0 commit comments

Comments
 (0)