@@ -27,7 +27,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
27
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
28
******************************************************************************/
29
29
30
- #include " ocs2_pipg/mpc/PipgMpcSolver .h"
30
+ #include " ocs2_slp/SlpSolver .h"
31
31
32
32
#include < iostream>
33
33
#include < numeric>
@@ -38,11 +38,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
38
#include < ocs2_oc/multiple_shooting/Transcription.h>
39
39
#include < ocs2_oc/pre_condition/Scaling.h>
40
40
41
- #include " ocs2_pipg /Helpers.h"
41
+ #include " ocs2_slp /Helpers.h"
42
42
43
43
namespace ocs2 {
44
44
45
- PipgMpcSolver::PipgMpcSolver (slp::Settings settings, const OptimalControlProblem& optimalControlProblem, const Initializer& initializer)
45
+ SlpSolver::SlpSolver (slp::Settings settings, const OptimalControlProblem& optimalControlProblem, const Initializer& initializer)
46
46
: settings_(std::move(settings)),
47
47
pipgSolver_ (settings_.pipgSettings),
48
48
threadPool_(std::max(settings_.nThreads, size_t (1 )) - 1, settings_.threadPriority) {
@@ -68,13 +68,13 @@ PipgMpcSolver::PipgMpcSolver(slp::Settings settings, const OptimalControlProblem
68
68
filterLinesearch_.armijoFactor = settings_.armijoFactor ;
69
69
}
70
70
71
- PipgMpcSolver ::~PipgMpcSolver () {
71
+ SlpSolver ::~SlpSolver () {
72
72
if (settings_.printSolverStatistics ) {
73
73
std::cerr << getBenchmarkingInformationPIPG () << " \n " << getBenchmarkingInformation () << std::endl;
74
74
}
75
75
}
76
76
77
- void PipgMpcSolver ::reset () {
77
+ void SlpSolver ::reset () {
78
78
// Clear solution
79
79
primalSolution_ = PrimalSolution ();
80
80
performanceIndeces_.clear ();
@@ -88,7 +88,7 @@ void PipgMpcSolver::reset() {
88
88
computeControllerTimer_.reset ();
89
89
}
90
90
91
- std::string PipgMpcSolver ::getBenchmarkingInformationPIPG () const {
91
+ std::string SlpSolver ::getBenchmarkingInformationPIPG () const {
92
92
const auto GGTMultiplication = GGTMultiplication_.getTotalInMilliseconds ();
93
93
const auto preConditioning = preConditioning_.getTotalInMilliseconds ();
94
94
const auto lambdaEstimation = lambdaEstimation_.getTotalInMilliseconds ();
@@ -117,7 +117,7 @@ std::string PipgMpcSolver::getBenchmarkingInformationPIPG() const {
117
117
return infoStream.str ();
118
118
}
119
119
120
- std::string PipgMpcSolver ::getBenchmarkingInformation () const {
120
+ std::string SlpSolver ::getBenchmarkingInformation () const {
121
121
const auto linearQuadraticApproximationTotal = linearQuadraticApproximationTimer_.getTotalInMilliseconds ();
122
122
const auto solveQpTotal = solveQpTimer_.getTotalInMilliseconds ();
123
123
const auto linesearchTotal = linesearchTimer_.getTotalInMilliseconds ();
@@ -143,18 +143,18 @@ std::string PipgMpcSolver::getBenchmarkingInformation() const {
143
143
return infoStream.str ();
144
144
}
145
145
146
- const std::vector<PerformanceIndex>& PipgMpcSolver ::getIterationsLog () const {
146
+ const std::vector<PerformanceIndex>& SlpSolver ::getIterationsLog () const {
147
147
if (performanceIndeces_.empty ()) {
148
- throw std::runtime_error (" [PipgMpcSolver ]: No performance log yet, no problem solved yet?" );
148
+ throw std::runtime_error (" [SlpSolver ]: No performance log yet, no problem solved yet?" );
149
149
} else {
150
150
return performanceIndeces_;
151
151
}
152
152
}
153
153
154
- void PipgMpcSolver ::runImpl (scalar_t initTime, const vector_t & initState, scalar_t finalTime) {
154
+ void SlpSolver ::runImpl (scalar_t initTime, const vector_t & initState, scalar_t finalTime) {
155
155
if (settings_.printSolverStatus || settings_.printLinesearch ) {
156
156
std::cerr << " \n ++++++++++++++++++++++++++++++++++++++++++++++++++++++" ;
157
- std::cerr << " \n +++++++++++++ PIPG solver is initialized +++++++++++++" ;
157
+ std::cerr << " \n +++++++++++++ SLP solver is initialized + +++++++++++++" ;
158
158
std::cerr << " \n ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n " ;
159
159
}
160
160
@@ -215,16 +215,16 @@ void PipgMpcSolver::runImpl(scalar_t initTime, const vector_t& initState, scalar
215
215
if (settings_.printSolverStatus || settings_.printLinesearch ) {
216
216
std::cerr << " \n Convergence : " << toString (convergence) << " \n " ;
217
217
std::cerr << " \n ++++++++++++++++++++++++++++++++++++++++++++++++++++++" ;
218
- std::cerr << " \n +++++++++++++ PIPG solver has terminated +++++++++++++" ;
218
+ std::cerr << " \n +++++++++++++ SLP solver has terminated + +++++++++++++" ;
219
219
std::cerr << " \n ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n " ;
220
220
}
221
221
}
222
222
223
- void PipgMpcSolver ::runParallel (std::function<void (int )> taskFunction) {
223
+ void SlpSolver ::runParallel (std::function<void (int )> taskFunction) {
224
224
threadPool_.runParallel (std::move (taskFunction), settings_.nThreads );
225
225
}
226
226
227
- PipgMpcSolver ::OcpSubproblemSolution PipgMpcSolver ::getOCPSolution (const vector_t & delta_x0) {
227
+ SlpSolver ::OcpSubproblemSolution SlpSolver ::getOCPSolution (const vector_t & delta_x0) {
228
228
// Solve the QP
229
229
OcpSubproblemSolution solution;
230
230
auto & deltaXSol = solution.deltaXSol ;
@@ -283,13 +283,13 @@ PipgMpcSolver::OcpSubproblemSolution PipgMpcSolver::getOCPSolution(const vector_
283
283
return solution;
284
284
}
285
285
286
- PrimalSolution PipgMpcSolver ::toPrimalSolution (const std::vector<AnnotatedTime>& time, vector_array_t && x, vector_array_t && u) {
286
+ PrimalSolution SlpSolver ::toPrimalSolution (const std::vector<AnnotatedTime>& time, vector_array_t && x, vector_array_t && u) {
287
287
ModeSchedule modeSchedule = this ->getReferenceManager ().getModeSchedule ();
288
288
return multiple_shooting::toPrimalSolution (time , std::move (modeSchedule), std::move (x), std::move (u));
289
289
}
290
290
291
- PerformanceIndex PipgMpcSolver ::setupQuadraticSubproblem (const std::vector<AnnotatedTime>& time, const vector_t & initState,
292
- const vector_array_t & x, const vector_array_t & u) {
291
+ PerformanceIndex SlpSolver ::setupQuadraticSubproblem (const std::vector<AnnotatedTime>& time, const vector_t & initState,
292
+ const vector_array_t & x, const vector_array_t & u) {
293
293
// Problem horizon
294
294
const int N = static_cast <int >(time .size ()) - 1 ;
295
295
@@ -362,8 +362,8 @@ PerformanceIndex PipgMpcSolver::setupQuadraticSubproblem(const std::vector<Annot
362
362
return totalPerformance;
363
363
}
364
364
365
- PerformanceIndex PipgMpcSolver ::computePerformance (const std::vector<AnnotatedTime>& time, const vector_t & initState,
366
- const vector_array_t & x, const vector_array_t & u) {
365
+ PerformanceIndex SlpSolver ::computePerformance (const std::vector<AnnotatedTime>& time, const vector_t & initState, const vector_array_t & x ,
366
+ const vector_array_t & u) {
367
367
// Problem horizon
368
368
const int N = static_cast <int >(time .size ()) - 1 ;
369
369
@@ -408,9 +408,9 @@ PerformanceIndex PipgMpcSolver::computePerformance(const std::vector<AnnotatedTi
408
408
return totalPerformance;
409
409
}
410
410
411
- slp::StepInfo PipgMpcSolver ::takeStep (const PerformanceIndex& baseline, const std::vector<AnnotatedTime>& timeDiscretization,
412
- const vector_t & initState, const OcpSubproblemSolution& subproblemSolution, vector_array_t & x,
413
- vector_array_t & u) {
411
+ slp::StepInfo SlpSolver ::takeStep (const PerformanceIndex& baseline, const std::vector<AnnotatedTime>& timeDiscretization,
412
+ const vector_t & initState, const OcpSubproblemSolution& subproblemSolution, vector_array_t & x,
413
+ vector_array_t & u) {
414
414
using StepType = FilterLinesearch::StepType;
415
415
416
416
/*
@@ -501,7 +501,7 @@ slp::StepInfo PipgMpcSolver::takeStep(const PerformanceIndex& baseline, const st
501
501
return stepInfo;
502
502
}
503
503
504
- slp::Convergence PipgMpcSolver ::checkConvergence (int iteration, const PerformanceIndex& baseline, const slp::StepInfo& stepInfo) const {
504
+ slp::Convergence SlpSolver ::checkConvergence (int iteration, const PerformanceIndex& baseline, const slp::StepInfo& stepInfo) const {
505
505
using Convergence = slp::Convergence;
506
506
if ((iteration + 1 ) >= settings_.slpIteration ) {
507
507
// Converged because the next iteration would exceed the specified number of iterations
0 commit comments