|
A sparse MPC solver for walking motion generation (old version).
|
Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method. More...
#include <qp_ip.h>
Public Member Functions | |
| qp_ip (const int N_, const double, const double, const double, const double, const double) | |
| Constructor: initialization of the constant parameters. | |
| ~qp_ip () | |
| void | set_parameters (const double *, const double *, const double, const double *, const double *, const double *, const double *, const double *) |
| Initializes quadratic problem. | |
| void | set_ip_parameters (const double, const double, const double, const double, const int, const double) |
| Set parameters of interior-point method. | |
| int | solve () |
| Solve QP using interior-point method. | |
Private Member Functions | |
| void | init_alpha () |
| tolerance of the outer loop | |
| double | form_bs_alpha_grad_dX () |
| Forms bs_alpha * grad' * dX. | |
| double | form_phi_X_tmp (const double) |
| Forms phi(X+alpha*dX) | |
| bool | solve_onestep (const double) |
| One step of interior point method. | |
| void | form_g (const double *, const double *) |
| Forms vector g. | |
| void | form_grad_i2hess_logbar (const double) |
| Compute gradient of phi, varying elements of i2hess, logarithmic barrier of phi. | |
| void | form_i2hess_grad () |
| Finish initialization of i2hess_grad = -i2hess*grad. | |
| void | form_phi_X () |
| Compute phi_X for initial point, phi_X must already store logarithmic barrier term. | |
Private Attributes | |
| double * | g |
| 2*N non-zero elements of vector g. | |
| double * | i2hess |
| Inverted hessian: non-repeating diagonal elements 1:3:N*SMPC_NUM_STATE_VAR, 2*N in total. | |
| double * | i2hess_grad |
| Inverted hessian * gradient (N*SMPC_NUM_VAR vector) | |
| double * | grad |
| N*SMPC_NUM_VAR gradient vector | |
| double | phi_X |
| Value of phi(X), where phi is the cost function + log barrier. | |
| chol_solve_ip | chol |
| An instance of chol_solve_ip class. | |
| double | t |
| double | mu |
| logarithmic barrier parameter | |
| double | bs_alpha |
| multiplier of t, >1. | |
| double | bs_beta |
| backtracking search parameter alpha | |
| int | max_iter |
| backtracking search parameter beta | |
| double | tol_out |
| maximum number of internal loop iterations | |
| double | Q [3] |
| Diagonal elements of H. | |
| double | P |
| Diagonal elements of H. | |
| const double * | lb |
| lower and upper bounds | |
| const double * | ub |
| lower and upper bounds | |
Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method.
| qp_ip::qp_ip | ( | const int | N_, |
| const double | Alpha, | ||
| const double | Beta, | ||
| const double | Gamma, | ||
| const double | regularization, | ||
| const double | tol_ | ||
| ) |
| qp_ip::~qp_ip | ( | ) |
| double qp_ip::form_bs_alpha_grad_dX | ( | ) | [private] |
| void qp_ip::form_g | ( | const double * | zref_x, |
| const double * | zref_y | ||
| ) | [private] |
| void qp_ip::form_grad_i2hess_logbar | ( | const double | kappa | ) | [private] |
| void qp_ip::form_i2hess_grad | ( | ) | [private] |
| void qp_ip::form_phi_X | ( | ) | [private] |
| double qp_ip::form_phi_X_tmp | ( | const double | kappa | ) | [private] |
| void qp_ip::init_alpha | ( | ) | [private] |
| void qp_ip::set_ip_parameters | ( | const double | t_, |
| const double | mu_, | ||
| const double | bs_alpha_, | ||
| const double | bs_beta_, | ||
| const int | max_iter_, | ||
| const double | tol_out_ | ||
| ) |
Set parameters of interior-point method.
| [in] | t_ | logarithmic barrier parameter |
| [in] | mu_ | multiplier of t, >1. |
| [in] | bs_alpha_ | backtracking search parameter alpha |
| [in] | bs_beta_ | backtracking search parameter beta |
| [in] | max_iter_ | maximum number of internal loop iterations |
| [in] | tol_out_ | tolerance of the outer loop |
| void qp_ip::set_parameters | ( | const double * | T, |
| const double * | h, | ||
| const double | h_initial_, | ||
| const double * | angle, | ||
| const double * | zref_x, | ||
| const double * | zref_y, | ||
| const double * | lb_, | ||
| const double * | ub_ | ||
| ) | [virtual] |
Initializes quadratic problem.
| [in] | T | Sampling time (for the moment it is assumed to be constant) [sec.] |
| [in] | h | Height of the Center of Mass divided by gravity |
| [in] | h_initial_ | current h |
| [in] | angle | Rotation angle for each state in the preview window |
| [in] | zref_x | reference values of z_x |
| [in] | zref_y | reference values of z_y |
| [in] | lb_ | array of lower bounds for z_x and z_y |
| [in] | ub_ | array of upper bounds for z_x and z_y |
Implements qp_solver.
| int qp_ip::solve | ( | ) | [virtual] |
| bool qp_ip::solve_onestep | ( | const double | kappa | ) | [private] |
double qp_ip::bs_alpha [private] |
double qp_ip::bs_beta [private] |
chol_solve_ip qp_ip::chol [private] |
An instance of chol_solve_ip class.
double* qp_ip::g [private] |
double* qp_ip::grad [private] |
N*SMPC_NUM_VAR gradient vector
double* qp_ip::i2hess [private] |
Inverted hessian: non-repeating diagonal elements 1:3:N*SMPC_NUM_STATE_VAR, 2*N in total.
double* qp_ip::i2hess_grad [private] |
Inverted hessian * gradient (N*SMPC_NUM_VAR vector)
int qp_ip::max_iter [private] |
double qp_ip::phi_X [private] |
double qp_ip::tol_out [private] |
1.8.0