aligator  0.15.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
workspace-base.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#include "aligator/fwd.hpp"
6#include "solver-util.hpp"
9
10namespace aligator {
11
13template <typename Scalar> struct WorkspaceBaseTpl {
15
16protected:
17 // Whether the workspace was initialized.
19
20public:
22 std::size_t nsteps;
25
28 std::vector<VectorXs> trial_xs;
29 std::vector<VectorXs> trial_us;
31
33 std::vector<VectorXs> dyn_slacks;
34
38
39 explicit WorkspaceBaseTpl(const TrajOptProblemTpl<Scalar> &problem);
40
41 ~WorkspaceBaseTpl() = default;
42
43 bool isInitialized() const { return m_isInitialized; }
44
47 void cycleLeft();
48
52 void cycleAppend(shared_ptr<StageDataTpl<Scalar>> data) {
53 problem_data.stage_data.emplace_back(data);
54 this->cycleLeft();
55 problem_data.stage_data.pop_back();
56 }
57};
58
59/* impl */
60
61template <typename Scalar>
63 const TrajOptProblemTpl<Scalar> &problem)
64 : m_isInitialized(true)
65 , nsteps(problem.numSteps())
66 , problem_data(problem) {
68}
69
78
79} // namespace aligator
80
81#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
82#include "workspace-base.txx"
83#endif
Forward declarations.
Utils for model-predictive control.
Main package namespace.
void rotate_vec_left(std::vector< T, Alloc > &v, long n_head=0, long n_tail=0)
Simply rotate an entire std::vector to the left.
Definition mpc-util.hpp:17
Common utilities for all solvers.
Data struct for stage models StageModelTpl.
Problem data struct.
std::vector< shared_ptr< StageData > > stage_data
Data structs for each stage of the problem.
Trajectory optimization problem.
void initializeSolution(std::vector< VectorXs > &xs, std::vector< VectorXs > &us) const
Execute the initialization strategy to generate an initial candidate solution to the problem.
std::size_t nsteps
Number of steps in the problem.
std::vector< VectorXs > trial_us
TrajOptDataTpl< Scalar > problem_data
Problem data.
void cycleLeft()
Cycle the workspace data to the left.
std::vector< VectorXs > dyn_slacks
Dynamical infeasibility gaps.
void cycleAppend(shared_ptr< StageDataTpl< Scalar > > data)
Same as cycleLeft(), but add a StageDataTpl to problem_data.
std::vector< VectorXs > trial_xs