A sparse MPC solver for walking motion generation (old version).
Public Member Functions | Private Member Functions | Private Attributes
qp_ip Class Reference

Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method. More...

#include <qp_ip.h>

Inheritance diagram for qp_ip:
qp_solver problem_parameters

List of all members.

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

Detailed Description

Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method.

Definition at line 36 of file qp_ip.h.


Constructor & Destructor Documentation

qp_ip::qp_ip ( const int  N_,
const double  Alpha,
const double  Beta,
const double  Gamma,
const double  regularization,
const double  tol_ 
)

Constructor: initialization of the constant parameters.

Parameters:
[in]N_Number of sampling times in a preview window
[in]AlphaVelocity gain
[in]BetaPosition gain
[in]GammaJerk gain
[in]regularizationregularization
[in]tol_tolerance

Definition at line 34 of file qp_ip.cpp.

Destructor

Definition at line 57 of file qp_ip.cpp.


Member Function Documentation

double qp_ip::form_bs_alpha_grad_dX ( ) [private]

Forms bs_alpha * grad' * dX.

Returns:
result of multiplication.

Definition at line 281 of file qp_ip.cpp.

void qp_ip::form_g ( const double *  zref_x,
const double *  zref_y 
) [private]

Forms vector g.

Parameters:
[in]zref_xx coordinates of reference ZMP positions
[in]zref_yy coordinates of reference ZMP positions

Definition at line 108 of file qp_ip.cpp.

void qp_ip::form_grad_i2hess_logbar ( const double  kappa) [private]

Compute gradient of phi, varying elements of i2hess, logarithmic barrier of phi.

Parameters:
[in]kappa1/t, a logarithmic barrier multiplicator.

Definition at line 136 of file qp_ip.cpp.

void qp_ip::form_i2hess_grad ( ) [private]

Finish initialization of i2hess_grad = -i2hess*grad.

Definition at line 183 of file qp_ip.cpp.

void qp_ip::form_phi_X ( ) [private]

Compute phi_X for initial point, phi_X must already store logarithmic barrier term.

Definition at line 207 of file qp_ip.cpp.

double qp_ip::form_phi_X_tmp ( const double  kappa) [private]

Forms phi(X+alpha*dX)

Parameters:
[in]kappalogarithmic barrier multiplicator.
Returns:
a value of phi.

Definition at line 301 of file qp_ip.cpp.

void qp_ip::init_alpha ( ) [private]

tolerance of the outer loop

Find initial value of alpha.

Note:
sets alpha to 0, if it is too small.

Definition at line 234 of file qp_ip.cpp.

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.

Parameters:
[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

Definition at line 354 of file qp_ip.cpp.

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.

Parameters:
[in]TSampling time (for the moment it is assumed to be constant) [sec.]
[in]hHeight of the Center of Mass divided by gravity
[in]h_initial_current h
[in]angleRotation angle for each state in the preview window
[in]zref_xreference values of z_x
[in]zref_yreference 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.

Definition at line 81 of file qp_ip.cpp.

int qp_ip::solve ( ) [virtual]

Solve QP using interior-point method.

Returns:
0 if ok, negative number otherwise.

Implements qp_solver.

Definition at line 377 of file qp_ip.cpp.

bool qp_ip::solve_onestep ( const double  kappa) [private]

One step of interior point method.

Parameters:
[in]kappalogarithmic barrier multiplier
Returns:
true if a step was made, false if alpha or dX are too small.

Definition at line 406 of file qp_ip.cpp.


Member Data Documentation

double qp_ip::bs_alpha [private]

multiplier of t, >1.

Definition at line 108 of file qp_ip.h.

double qp_ip::bs_beta [private]

backtracking search parameter alpha

Definition at line 109 of file qp_ip.h.

An instance of chol_solve_ip class.

Definition at line 96 of file qp_ip.h.

double* qp_ip::g [private]

2*N non-zero elements of vector g.

Definition at line 72 of file qp_ip.h.

double* qp_ip::grad [private]

N*SMPC_NUM_VAR gradient vector

Definition at line 82 of file qp_ip.h.

double* qp_ip::i2hess [private]

Inverted hessian: non-repeating diagonal elements 1:3:N*SMPC_NUM_STATE_VAR, 2*N in total.

Definition at line 76 of file qp_ip.h.

double* qp_ip::i2hess_grad [private]

Inverted hessian * gradient (N*SMPC_NUM_VAR vector)

Definition at line 79 of file qp_ip.h.

const double* qp_ip::lb [private]

lower and upper bounds

Definition at line 101 of file qp_ip.h.

int qp_ip::max_iter [private]

backtracking search parameter beta

Definition at line 110 of file qp_ip.h.

double qp_ip::mu [private]

logarithmic barrier parameter

Definition at line 107 of file qp_ip.h.

double qp_ip::P [private]

Diagonal elements of H.

Definition at line 91 of file qp_ip.h.

double qp_ip::phi_X [private]

Value of phi(X), where phi is the cost function + log barrier.

Definition at line 85 of file qp_ip.h.

double qp_ip::Q[3] [private]

Diagonal elements of H.

Definition at line 90 of file qp_ip.h.

double qp_ip::t [private]

Definition at line 106 of file qp_ip.h.

double qp_ip::tol_out [private]

maximum number of internal loop iterations

Definition at line 111 of file qp_ip.h.

const double* qp_ip::ub [private]

lower and upper bounds

Definition at line 102 of file qp_ip.h.


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