nmpc_cgmres
Public Member Functions | Public Attributes | List of all members
nmpc_cgmres::CgmresSolver Class Reference

C/GMRES solver. More...

#include <CgmresSolver.h>

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW CgmresSolver (std::shared_ptr< CgmresProblem > problem, std::shared_ptr< OdeSolver > ode_solver, std::shared_ptr< OdeSolver > sim_ode_solver=nullptr)
 Constructor. More...
 
void setup ()
 Setup. More...
 
void run ()
 Run NMPC. More...
 
void calcControlInput (double t, const Eigen::Ref< const Eigen::VectorXd > &x, const Eigen::Ref< const Eigen::VectorXd > &next_x, Eigen::Ref< Eigen::VectorXd > u)
 Calculate the control input. More...
 
void calcDhDuList (double t, const Eigen::Ref< const Eigen::VectorXd > &x, const Eigen::Ref< const Eigen::MatrixXd > &u_list, Eigen::Ref< Eigen::MatrixXd > DhDu_list)
 Calculate the $ \frac{\partial h}{\partial u} $ list in the horizon. More...
 
Eigen::VectorXd eqAmulFunc (const Eigen::Ref< const Eigen::VectorXd > &vec)
 Function to return $ A * v $ where $ v $ is given. More...
 

Public Attributes

std::shared_ptr< CgmresProblemproblem_
 
std::shared_ptr< OdeSolverode_solver_
 
std::shared_ptr< OdeSolversim_ode_solver_
 
double sim_duration_ = 10
 
double steady_horizon_duration_ = 1.0
 
int horizon_divide_num_ = 25
 
double horizon_increase_ratio_ = 0.5
 
double dt_ = 0.001
 
double eq_zeta_ = 1000.0
 
int k_max_ = 5
 
double finite_diff_delta_ = 0.002
 
int dump_step_ = 5
 
Eigen::VectorXd x_
 
Eigen::VectorXd u_
 
double t_with_delta_
 
Eigen::VectorXd x_with_delta_
 
Eigen::MatrixXd x_list_
 
Eigen::MatrixXd lmd_list_
 
Eigen::MatrixXd u_list_
 
Eigen::MatrixXd u_list_Amul_func_
 
Eigen::MatrixXd DhDu_list_
 
Eigen::MatrixXd DhDu_list_with_delta_
 
Eigen::MatrixXd DhDu_list_Amul_func_
 
std::shared_ptr< Eigen::Map< Eigen::VectorXd > > DhDu_vec_
 
std::shared_ptr< Eigen::Map< Eigen::VectorXd > > DhDu_vec_with_delta_
 
std::shared_ptr< Eigen::Map< Eigen::VectorXd > > DhDu_vec_Amul_func_
 
Eigen::VectorXd delta_u_vec_
 
std::ofstream ofs_x_
 
std::ofstream ofs_u_
 
std::ofstream ofs_err_
 
const Eigen::IOFormat vecfmt_dump_ = Eigen::IOFormat(Eigen::StreamPrecision, 0, ", ", ", ", "", "", "", "")
 

Detailed Description

C/GMRES solver.

See the following articles about the C/GMRES method:

Definition at line 22 of file CgmresSolver.h.

Constructor & Destructor Documentation

◆ CgmresSolver()

EIGEN_MAKE_ALIGNED_OPERATOR_NEW nmpc_cgmres::CgmresSolver::CgmresSolver ( std::shared_ptr< CgmresProblem problem,
std::shared_ptr< OdeSolver ode_solver,
std::shared_ptr< OdeSolver sim_ode_solver = nullptr 
)
inline

Constructor.

Definition at line 28 of file CgmresSolver.h.

Member Function Documentation

◆ calcControlInput()

void nmpc_cgmres::CgmresSolver::calcControlInput ( double  t,
const Eigen::Ref< const Eigen::VectorXd > &  x,
const Eigen::Ref< const Eigen::VectorXd > &  next_x,
Eigen::Ref< Eigen::VectorXd >  u 
)

Calculate the control input.

◆ calcDhDuList()

void nmpc_cgmres::CgmresSolver::calcDhDuList ( double  t,
const Eigen::Ref< const Eigen::VectorXd > &  x,
const Eigen::Ref< const Eigen::MatrixXd > &  u_list,
Eigen::Ref< Eigen::MatrixXd >  DhDu_list 
)

Calculate the $ \frac{\partial h}{\partial u} $ list in the horizon.

◆ eqAmulFunc()

Eigen::VectorXd nmpc_cgmres::CgmresSolver::eqAmulFunc ( const Eigen::Ref< const Eigen::VectorXd > &  vec)

Function to return $ A * v $ where $ v $ is given.

◆ run()

void nmpc_cgmres::CgmresSolver::run ( )

Run NMPC.

◆ setup()

void nmpc_cgmres::CgmresSolver::setup ( )

Setup.

Member Data Documentation

◆ delta_u_vec_

Eigen::VectorXd nmpc_cgmres::CgmresSolver::delta_u_vec_

Definition at line 102 of file CgmresSolver.h.

◆ DhDu_list_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::DhDu_list_

Definition at line 94 of file CgmresSolver.h.

◆ DhDu_list_Amul_func_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::DhDu_list_Amul_func_

Definition at line 96 of file CgmresSolver.h.

◆ DhDu_list_with_delta_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::DhDu_list_with_delta_

Definition at line 95 of file CgmresSolver.h.

◆ DhDu_vec_

std::shared_ptr<Eigen::Map<Eigen::VectorXd> > nmpc_cgmres::CgmresSolver::DhDu_vec_

Definition at line 98 of file CgmresSolver.h.

◆ DhDu_vec_Amul_func_

std::shared_ptr<Eigen::Map<Eigen::VectorXd> > nmpc_cgmres::CgmresSolver::DhDu_vec_Amul_func_

Definition at line 100 of file CgmresSolver.h.

◆ DhDu_vec_with_delta_

std::shared_ptr<Eigen::Map<Eigen::VectorXd> > nmpc_cgmres::CgmresSolver::DhDu_vec_with_delta_

Definition at line 99 of file CgmresSolver.h.

◆ dt_

double nmpc_cgmres::CgmresSolver::dt_ = 0.001

Definition at line 72 of file CgmresSolver.h.

◆ dump_step_

int nmpc_cgmres::CgmresSolver::dump_step_ = 5

Definition at line 79 of file CgmresSolver.h.

◆ eq_zeta_

double nmpc_cgmres::CgmresSolver::eq_zeta_ = 1000.0

Definition at line 74 of file CgmresSolver.h.

◆ finite_diff_delta_

double nmpc_cgmres::CgmresSolver::finite_diff_delta_ = 0.002

Definition at line 77 of file CgmresSolver.h.

◆ horizon_divide_num_

int nmpc_cgmres::CgmresSolver::horizon_divide_num_ = 25

Definition at line 69 of file CgmresSolver.h.

◆ horizon_increase_ratio_

double nmpc_cgmres::CgmresSolver::horizon_increase_ratio_ = 0.5

Definition at line 70 of file CgmresSolver.h.

◆ k_max_

int nmpc_cgmres::CgmresSolver::k_max_ = 5

Definition at line 75 of file CgmresSolver.h.

◆ lmd_list_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::lmd_list_

Definition at line 89 of file CgmresSolver.h.

◆ ode_solver_

std::shared_ptr<OdeSolver> nmpc_cgmres::CgmresSolver::ode_solver_

Definition at line 62 of file CgmresSolver.h.

◆ ofs_err_

std::ofstream nmpc_cgmres::CgmresSolver::ofs_err_

Definition at line 107 of file CgmresSolver.h.

◆ ofs_u_

std::ofstream nmpc_cgmres::CgmresSolver::ofs_u_

Definition at line 106 of file CgmresSolver.h.

◆ ofs_x_

std::ofstream nmpc_cgmres::CgmresSolver::ofs_x_

Definition at line 105 of file CgmresSolver.h.

◆ problem_

std::shared_ptr<CgmresProblem> nmpc_cgmres::CgmresSolver::problem_

Definition at line 61 of file CgmresSolver.h.

◆ sim_duration_

double nmpc_cgmres::CgmresSolver::sim_duration_ = 10

Definition at line 66 of file CgmresSolver.h.

◆ sim_ode_solver_

std::shared_ptr<OdeSolver> nmpc_cgmres::CgmresSolver::sim_ode_solver_

Definition at line 63 of file CgmresSolver.h.

◆ steady_horizon_duration_

double nmpc_cgmres::CgmresSolver::steady_horizon_duration_ = 1.0

Definition at line 68 of file CgmresSolver.h.

◆ t_with_delta_

double nmpc_cgmres::CgmresSolver::t_with_delta_

Definition at line 85 of file CgmresSolver.h.

◆ u_

Eigen::VectorXd nmpc_cgmres::CgmresSolver::u_

Definition at line 83 of file CgmresSolver.h.

◆ u_list_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::u_list_

Definition at line 91 of file CgmresSolver.h.

◆ u_list_Amul_func_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::u_list_Amul_func_

Definition at line 92 of file CgmresSolver.h.

◆ vecfmt_dump_

const Eigen::IOFormat nmpc_cgmres::CgmresSolver::vecfmt_dump_ = Eigen::IOFormat(Eigen::StreamPrecision, 0, ", ", ", ", "", "", "", "")

Definition at line 108 of file CgmresSolver.h.

◆ x_

Eigen::VectorXd nmpc_cgmres::CgmresSolver::x_

Definition at line 82 of file CgmresSolver.h.

◆ x_list_

Eigen::MatrixXd nmpc_cgmres::CgmresSolver::x_list_

Definition at line 88 of file CgmresSolver.h.

◆ x_with_delta_

Eigen::VectorXd nmpc_cgmres::CgmresSolver::x_with_delta_

Definition at line 86 of file CgmresSolver.h.


The documentation for this class was generated from the following file: