nmpc_fmpc
|
FMPC solver. More...
#include <FmpcSolver.h>
Classes | |
struct | Coefficient |
Coefficients of linearized KKT condition. More... | |
struct | ComputationDuration |
Data of computation duration. More... | |
struct | Configuration |
Configuration. More... | |
struct | TraceData |
Data to trace optimization loop. More... | |
struct | Variable |
Optimization variables. More... | |
Public Types | |
enum | Status { Status::Uninitialized = 0, Status::Succeeded = 1, Status::ErrorInForward = 2, Status::ErrorInBackward = 3, Status::ErrorInUpdate = 4, Status::MaxIterationReached = 5, Status::IterationContinued = 6 } |
Result status. More... | |
using | StateDimVector = typename FmpcProblem< StateDim, InputDim, IneqDim >::StateDimVector |
Type of vector of state dimension. More... | |
using | InputDimVector = typename FmpcProblem< StateDim, InputDim, IneqDim >::InputDimVector |
Type of vector of input dimension. More... | |
using | IneqDimVector = typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqDimVector |
Type of vector of inequality dimension. More... | |
using | StateStateDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::StateStateDimMatrix |
Type of matrix of state x state dimension. More... | |
using | InputInputDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::InputInputDimMatrix |
Type of matrix of input x input dimension. More... | |
using | StateInputDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::StateInputDimMatrix |
Type of matrix of state x input dimension. More... | |
using | InputStateDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::InputStateDimMatrix |
Type of matrix of input x state dimension. More... | |
using | IneqStateDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqStateDimMatrix |
Type of matrix of inequality x state dimension. More... | |
using | IneqInputDimMatrix = typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqInputDimMatrix |
Type of matrix of inequality x input dimension. More... | |
using | IneqIneqDimMatrix = Eigen::Matrix< double, IneqDim, IneqDim > |
Type of matrix of inequality x inequality dimension. More... | |
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | FmpcSolver (const std::shared_ptr< FmpcProblem< StateDim, InputDim, IneqDim >> &problem) |
Constructor. More... | |
Configuration & | config () |
Accessor to configuration. More... | |
const Configuration & | config () const |
Const accessor to configuration. More... | |
Status | solve (double current_t, const StateDimVector ¤t_x, const Variable &initial_variable) |
Solve optimization. More... | |
const Variable & | variable () const |
Const accessor to optimization variables. More... | |
const std::vector< Coefficient > & | coeffList () const |
Const accessor to sequence of coefficients of linearized KKT condition. More... | |
const std::vector< TraceData > & | traceDataList () const |
Const accessor to trace data list. More... | |
const ComputationDuration & | computationDuration () const |
Const accessor to computation duration. More... | |
void | dumpTraceDataList (const std::string &file_path) const |
Dump trace data list. More... | |
Protected Member Functions | |
void | checkVariable () const |
Check optimization variables. More... | |
Status | procOnce (int iter) |
Process one iteration. More... | |
double | calcKktError (double barrier_eps) const |
Calculate KKT condition error. More... | |
bool | backwardPass () |
Process backward pass a.k.a backward Riccati recursion. More... | |
bool | forwardPass () |
Process forward pass a.k.a forward Riccati recursion. More... | |
bool | updateVariables () |
Update optimization variables given Newton-step direction. More... | |
void | setupMeritFunc () |
Setup the merit function and its directional derivative. More... | |
double | calcMeritFunc (const Variable &variable) const |
Calculate merit function. More... | |
Protected Attributes | |
Configuration | config_ |
Configuration. More... | |
std::shared_ptr< FmpcProblem< StateDim, InputDim, IneqDim > > | problem_ |
FMPC problem. More... | |
Variable | variable_ |
Optimization variables. More... | |
Variable | delta_variable_ |
Update amount of optimization variables. More... | |
std::vector< Coefficient > | coeff_list_ |
Sequence of coefficients of linearized KKT condition. More... | |
std::vector< TraceData > | trace_data_list_ |
Sequence of trace data. More... | |
ComputationDuration | computation_duration_ |
Computation duration data. More... | |
double | current_t_ = 0 |
Current time [sec]. More... | |
StateDimVector | current_x_ = StateDimVector::Zero() |
Current state. More... | |
double | barrier_eps_ = 1e-4 |
Barrier parameter. More... | |
double | merit_const_scale_ = 0.0 |
Scale of constraint errors in the merit function. More... | |
double | merit_func_ = 0.0 |
Merit function. More... | |
double | merit_deriv_ = 0.0 |
Directional derivative of merit function. More... | |
FMPC solver.
StateDim | state dimension |
InputDim | input dimension |
IneqDim | inequality dimension |
See the following for a detailed algorithm.
Definition at line 23 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::IneqDimVector = typename FmpcProblem<StateDim, InputDim, IneqDim>::IneqDimVector |
Type of vector of inequality dimension.
Definition at line 33 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::IneqIneqDimMatrix = Eigen::Matrix<double, IneqDim, IneqDim> |
Type of matrix of inequality x inequality dimension.
Definition at line 54 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::IneqInputDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::IneqInputDimMatrix |
Type of matrix of inequality x input dimension.
Definition at line 51 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::IneqStateDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::IneqStateDimMatrix |
Type of matrix of inequality x state dimension.
Definition at line 48 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::InputDimVector = typename FmpcProblem<StateDim, InputDim, IneqDim>::InputDimVector |
Type of vector of input dimension.
Definition at line 30 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::InputInputDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::InputInputDimMatrix |
Type of matrix of input x input dimension.
Definition at line 39 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::InputStateDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::InputStateDimMatrix |
Type of matrix of input x state dimension.
Definition at line 45 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::StateDimVector = typename FmpcProblem<StateDim, InputDim, IneqDim>::StateDimVector |
Type of vector of state dimension.
Definition at line 27 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::StateInputDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::StateInputDimMatrix |
Type of matrix of state x input dimension.
Definition at line 42 of file FmpcSolver.h.
using nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::StateStateDimMatrix = typename FmpcProblem<StateDim, InputDim, IneqDim>::StateStateDimMatrix |
Type of matrix of state x state dimension.
Definition at line 36 of file FmpcSolver.h.
|
strong |
Result status.
Definition at line 92 of file FmpcSolver.h.
|
inline |
|
protected |
Process backward pass a.k.a backward Riccati recursion.
Definition at line 524 of file FmpcSolver.hpp.
|
protected |
Calculate KKT condition error.
barrier_eps | barrier parameter |
Definition at line 496 of file FmpcSolver.hpp.
|
protected |
Calculate merit function.
variable | variable |
Definition at line 936 of file FmpcSolver.hpp.
|
protected |
Check optimization variables.
Definition at line 285 of file FmpcSolver.hpp.
|
inline |
Const accessor to sequence of coefficients of linearized KKT condition.
Definition at line 325 of file FmpcSolver.h.
|
inline |
Const accessor to computation duration.
Definition at line 337 of file FmpcSolver.h.
|
inline |
Accessor to configuration.
Definition at line 299 of file FmpcSolver.h.
|
inline |
Const accessor to configuration.
Definition at line 305 of file FmpcSolver.h.
void nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::dumpTraceDataList | ( | const std::string & | file_path | ) | const |
Dump trace data list.
file_path | path to output file |
Definition at line 260 of file FmpcSolver.hpp.
|
protected |
Process forward pass a.k.a forward Riccati recursion.
Definition at line 668 of file FmpcSolver.hpp.
|
protected |
Process one iteration.
iter | current iteration |
Definition at line 365 of file FmpcSolver.hpp.
|
protected |
Setup the merit function and its directional derivative.
Definition at line 837 of file FmpcSolver.hpp.
FmpcSolver< StateDim, InputDim, IneqDim >::Status nmpc_fmpc::FmpcSolver< StateDim, InputDim, IneqDim >::solve | ( | double | current_t, |
const StateDimVector & | current_x, | ||
const Variable & | initial_variable | ||
) |
Solve optimization.
current_t | current time [sec] |
current_x | current state |
initial_variable | initial guess of optimization variables |
Definition at line 158 of file FmpcSolver.hpp.
|
inline |
Const accessor to trace data list.
Definition at line 331 of file FmpcSolver.h.
|
protected |
Update optimization variables given Newton-step direction.
Definition at line 711 of file FmpcSolver.hpp.
|
inline |
Const accessor to optimization variables.
Definition at line 319 of file FmpcSolver.h.
|
protected |
Barrier parameter.
Definition at line 414 of file FmpcSolver.h.
|
protected |
Sequence of coefficients of linearized KKT condition.
Definition at line 399 of file FmpcSolver.h.
|
protected |
Computation duration data.
Definition at line 405 of file FmpcSolver.h.
|
protected |
Definition at line 387 of file FmpcSolver.h.
|
protected |
Current time [sec].
Definition at line 408 of file FmpcSolver.h.
|
protected |
Current state.
Definition at line 411 of file FmpcSolver.h.
|
protected |
Update amount of optimization variables.
Definition at line 396 of file FmpcSolver.h.
|
protected |
Scale of constraint errors in the merit function.
Definition at line 417 of file FmpcSolver.h.
|
protected |
Directional derivative of merit function.
Definition at line 423 of file FmpcSolver.h.
|
protected |
Merit function.
Definition at line 420 of file FmpcSolver.h.
|
protected |
FMPC problem.
Definition at line 390 of file FmpcSolver.h.
|
protected |
Sequence of trace data.
Definition at line 402 of file FmpcSolver.h.
|
protected |
Optimization variables.
Definition at line 393 of file FmpcSolver.h.