A sparse MPC solver for walking motion generation.
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members

Solve a quadratic program with a specific structure. qp_as = Quadratic Programming / Active Set. More...

#include <qp_as.h>

Inheritance diagram for qp_as:
AS::problem_parameters

Public Member Functions

 qp_as (const int N_, const double, const double, const double, const double, const double, const bool, const unsigned int, const bool)
 Constructor: initialization of the constant parameters. More...
 
 ~qp_as ()
 
void set_parameters (const double *, const double *, const double, const double *, const double *, const double *, const double *, const double *)
 Initializes quadratic problem. More...
 
void solve (vector< double > &)
 Solve QP problem. More...
 
void form_init_fp (const double *, const double *, const double *, const bool, double *)
 Generates an initial feasible point. More...
 
- Public Member Functions inherited from AS::problem_parameters
 problem_parameters (const int, const double, const double, const double, const double)
 
 ~problem_parameters ()
 
void set_state_parameters (const double *, const double *, const double)
 Initializes quadratic problem. More...
 

Public Attributes

double * X
 
unsigned int added_constraints_num
 
unsigned int removed_constraints_num
 
unsigned int active_set_size
 
bool constraint_removal_on
 
unsigned int max_added_constraints_num
 
- Public Attributes inherited from AS::problem_parameters
int N
 
state_parametersspar
 
double h_initial
 Height of the CoM at initial state divided by the gravity, this initial state precede the first state in the preview window. More...
 
double i2Q [3]
 
double i2P
 

Private Member Functions

int check_blocking_constraints ()
 Checks for blocking constraints. More...
 
int choose_excl_constr (const double *)
 Selects a constraint for removal from active set. More...
 
double compute_obj ()
 Compute value of the objective function. More...
 

Private Attributes

AS::chol_solve chol
 An instance of AS::chol_solve class. More...
 
const double * zref_x
 
const double * zref_y
 
double tol
 tolerance More...
 
bool obj_computation_on
 
vector< AS::constraintactive_set
 A set of active constraints. More...
 
vector< AS::constraintconstraints
 Vector of constraints. More...
 
double * dX
 
double alpha
 

Detailed Description

Solve a quadratic program with a specific structure. qp_as = Quadratic Programming / Active Set.

Definition at line 37 of file qp_as.h.

Constructor & Destructor Documentation

◆ qp_as()

qp_as::qp_as ( const int  N_,
const double  gain_position,
const double  gain_velocity,
const double  gain_acceleration,
const double  gain_jerk,
const double  tol_,
const bool  obj_computation_on_,
const unsigned int  max_added_constraints_num_,
const bool  constraint_removal_on_ 
)

Constructor: initialization of the constant parameters.

Parameters
[in]N_Number of sampling times in a preview window
[in]gain_positionPosition gain
[in]gain_velocityVelocity gain
[in]gain_accelerationAcceleration gain
[in]gain_jerkJerk gain
[in]tol_tolerance
[in]obj_computation_on_enable computation of the objective function
[in]max_added_constraints_num_limit on the number of the added constraints
[in]constraint_removal_on_enable constraint removal

Definition at line 36 of file qp_as.cpp.

◆ ~qp_as()

qp_as::~qp_as ( )

Destructor

Definition at line 66 of file qp_as.cpp.

Member Function Documentation

◆ check_blocking_constraints()

int qp_as::check_blocking_constraints ( )
private

Checks for blocking constraints.

Returns
sequential number of constraint to be added, -1 if no constraints.

Definition at line 159 of file qp_as.cpp.

◆ choose_excl_constr()

int qp_as::choose_excl_constr ( const double *  lambda)
private

Selects a constraint for removal from active set.

Parameters
[in]lambdavector of Lagrange multipliers corresponding to inequality constraints.
Returns
index of constraint in the active set, -1 if no constraint can be removed.
Attention
If a constraint for removal is selected, then it is removed from the active set (active_set).

Definition at line 226 of file qp_as.cpp.

◆ compute_obj()

double qp_as::compute_obj ( )
private

Compute value of the objective function.

Returns
value of the objective function.

Definition at line 343 of file qp_as.cpp.

◆ form_init_fp()

void qp_as::form_init_fp ( const double *  x_coord,
const double *  y_coord,
const double *  init_state,
const bool  tilde_state,
double *  X_ 
)

Generates an initial feasible point.

Parameters
[in]x_coordx coordinates of points satisfying constraints
[in]y_coordy coordinates of points satisfying constraints
[in]init_statecurrent state
[in]tilde_stateif true the state is interpreted as X_tilde.
[in,out]X_initial guess / solution of optimization problem

Definition at line 141 of file qp_as.cpp.

◆ set_parameters()

void qp_as::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 
)

Initializes quadratic problem.

Parameters
[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]angleRotation 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]lbarray of lower constraints for z_x and z_y
[in]ubarray of upper constraints for z_x and z_y

Definition at line 84 of file qp_as.cpp.

◆ solve()

void qp_as::solve ( vector< double > &  obj_log)

Solve QP problem.

Parameters
[in,out]obj_loga vector of objective function values
Returns
number of activated constraints

Definition at line 258 of file qp_as.cpp.

Member Data Documentation

◆ active_set

vector<AS::constraint> qp_as::active_set
private

A set of active constraints.

Definition at line 111 of file qp_as.h.

◆ active_set_size

unsigned int qp_as::active_set_size

Definition at line 82 of file qp_as.h.

◆ added_constraints_num

unsigned int qp_as::added_constraints_num

Definition at line 80 of file qp_as.h.

◆ alpha

double qp_as::alpha
private

A number from 0 to 1, which controls depth of descent X = X + alpha*dX.

Definition at line 122 of file qp_as.h.

◆ chol

AS::chol_solve qp_as::chol
private

An instance of AS::chol_solve class.

Definition at line 98 of file qp_as.h.

◆ constraint_removal_on

bool qp_as::constraint_removal_on

Definition at line 84 of file qp_as.h.

◆ constraints

vector<AS::constraint> qp_as::constraints
private

Vector of constraints.

Definition at line 114 of file qp_as.h.

◆ dX

double* qp_as::dX
private

Feasible descent direction (to be used for updating X).

Definition at line 119 of file qp_as.h.

◆ max_added_constraints_num

unsigned int qp_as::max_added_constraints_num

Definition at line 85 of file qp_as.h.

◆ obj_computation_on

bool qp_as::obj_computation_on
private

Definition at line 107 of file qp_as.h.

◆ removed_constraints_num

unsigned int qp_as::removed_constraints_num

Definition at line 81 of file qp_as.h.

◆ tol

double qp_as::tol
private

tolerance

Definition at line 105 of file qp_as.h.

◆ X

double* qp_as::X

Variables for the QP (contain the states + control variables). Initial feasible point with respect to the equality and inequality constraints.

Definition at line 76 of file qp_as.h.

◆ zref_x

const double* qp_as::zref_x
private

Definition at line 101 of file qp_as.h.

◆ zref_y

const double* qp_as::zref_y
private

Definition at line 102 of file qp_as.h.


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