Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method.
More...
#include <qp_ip.h>
|
| qp_ip (const int N_, const double, const double, const double, const double, const double, const bool, const backtrackingSearchType) |
| Constructor: initialization of the constant parameters. More...
|
|
| ~qp_ip () |
|
void | set_parameters (const double *, const double *, const double, const double *, const double *, const double *, const double *, const double *) |
| Initializes quadratic problem. More...
|
|
void | form_init_fp (const double *, const double *, const double *, const bool, double *) |
| Generates an initial feasible point. First we perform a change of variable to X_tilde generate a feasible point, and then we go back to X_bar. More...
|
|
void | set_ip_parameters (const double, const double, const double, const double, const unsigned int, const double) |
| Set parameters of interior-point method. More...
|
|
void | solve (vector< double > &) |
| Solve QP using interior-point method. More...
|
|
| problem_parameters (const int, const double, const double, const double, const double) |
|
| ~problem_parameters () |
|
void | set_state_parameters (const double *, const double *, const double, const double *) |
| Initializes quadratic problem. More...
|
|
Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point method.
Definition at line 38 of file qp_ip.h.
◆ qp_ip()
qp_ip::qp_ip |
( |
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 backtrackingSearchType |
bs_type_ |
|
) |
| |
Constructor: initialization of the constant parameters.
- Parameters
-
[in] | N_ | Number of sampling times in a preview window |
[in] | gain_position_ | (Alpha) Position gain |
[in] | gain_velocity_ | (Beta) Velocity gain |
[in] | gain_acceleration_ | (Gamma) Acceleration gain |
[in] | gain_jerk_ | (Eta) Jerk gain |
[in] | tol_ | tolerance |
[in] | obj_computation_on_ | enable computation of the objective function |
[in] | bs_type_ | type of backtracking search |
Definition at line 38 of file qp_ip.cpp.
◆ ~qp_ip()
◆ compute_obj()
double qp_ip::compute_obj |
( |
const bool |
add_constant_term | ) |
|
|
private |
Computes value of the objective function.
- Parameters
-
[in] | add_constant_term | the objective function contains a constant term, that can be dropped in some cases. |
- Returns
- value of the objective function.
Definition at line 631 of file qp_ip.cpp.
◆ form_bs_alpha_obj_dX()
double qp_ip::form_bs_alpha_obj_dX |
( |
| ) |
|
|
private |
Forms bs_alpha * (objective') * dX.
- Returns
- result of multiplication.
Definition at line 296 of file qp_ip.cpp.
◆ form_decrement()
double qp_ip::form_decrement |
( |
| ) |
|
|
private |
◆ form_g()
void qp_ip::form_g |
( |
const double * |
zref_x_, |
|
|
const double * |
zref_y_ |
|
) |
| |
|
private |
Forms vector g.
- Parameters
-
[in] | zref_x_ | x coordinates of reference ZMP positions |
[in] | zref_y_ | y coordinates of reference ZMP positions |
Definition at line 126 of file qp_ip.cpp.
◆ form_grad_i2hess_logbar()
double qp_ip::form_grad_i2hess_logbar |
( |
const double |
kappa | ) |
|
|
private |
Compute gradient of phi (partially), varying elements of i2hess, logarithmic barrier part of phi, i2hess_grad = -i2hess*grad.
- Parameters
-
[in] | kappa | 1/t, a logarithmic barrier multiplicator. |
- Returns
- logarithmic barrier part of phi.
Definition at line 156 of file qp_ip.cpp.
◆ form_init_fp()
void qp_ip::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. First we perform a change of variable to X_tilde generate a feasible point, and then we go back to X_bar.
- Parameters
-
[in] | x_coord | x coordinates of points satisfying constraints |
[in] | y_coord | y coordinates of points satisfying constraints |
[in] | init_state | current state |
[in] | tilde_state | if true the state is assumed to be in X_tilde form |
[in,out] | X_ | initial guess / solution of optimization problem |
Definition at line 603 of file qp_ip.cpp.
◆ form_phi_X()
double qp_ip::form_phi_X |
( |
| ) |
|
|
private |
Compute phi_X for initial point, phi_X must already store logarithmic barrier term.
Definition at line 208 of file qp_ip.cpp.
◆ form_phi_X_tmp()
double qp_ip::form_phi_X_tmp |
( |
const double |
kappa, |
|
|
const double |
alpha |
|
) |
| |
|
private |
Forms phi(X+alpha*dX)
- Parameters
-
[in] | kappa | logarithmic barrier multiplicator. |
[in] | alpha | step length |
- Returns
- a value of phi.
Definition at line 341 of file qp_ip.cpp.
◆ init_alpha()
double 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 247 of file qp_ip.cpp.
◆ set_ip_parameters()
void qp_ip::set_ip_parameters |
( |
const double |
t_, |
|
|
const double |
mu_, |
|
|
const double |
bs_alpha_, |
|
|
const double |
bs_beta_, |
|
|
const unsigned 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 402 of file qp_ip.cpp.
◆ set_parameters()
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_ |
|
) |
| |
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] | 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 |
Definition at line 97 of file qp_ip.cpp.
◆ solve()
void qp_ip::solve |
( |
vector< double > & |
obj_log | ) |
|
Solve QP using interior-point method.
- Parameters
-
[in,out] | obj_log | a vector of objective function values |
- Returns
- 0 if ok, negative number otherwise.
Definition at line 427 of file qp_ip.cpp.
◆ solve_onestep()
bool qp_ip::solve_onestep |
( |
const double |
kappa, |
|
|
vector< double > & |
obj_log |
|
) |
| |
|
private |
One step of interior point method.
- Parameters
-
[in] | kappa | logarithmic barrier multiplier |
[in,out] | obj_log | a vector of objective function values |
- Returns
- true if a step was made, false if alpha or dX are too small.
Value of phi(X), where phi is the cost function + log barrier.
Definition at line 503 of file qp_ip.cpp.
◆ bs_alpha
multiplier of t, >1.
Definition at line 148 of file qp_ip.h.
◆ bs_beta
backtracking search parameter alpha
Definition at line 149 of file qp_ip.h.
◆ bs_counter
unsigned int qp_ip::bs_counter |
◆ bs_type
◆ chol
◆ dX
Feasible descent direction (to be used for updating X).
Definition at line 106 of file qp_ip.h.
◆ ext_loop_counter
unsigned int qp_ip::ext_loop_counter |
2*N non-zero elements of vector g.
Definition at line 109 of file qp_ip.h.
◆ gain_position
double qp_ip::gain_position |
|
private |
◆ grad
2*N gradient vector, only the elements that correspond to the ZMP positions are computed, it is faster to compute the others on the fly. Hint: the computed terms are affected by the logarithmic barrier.
Definition at line 121 of file qp_ip.h.
◆ i2hess
◆ i2hess_grad
double* qp_ip::i2hess_grad |
|
private |
◆ int_loop_counter
unsigned int qp_ip::int_loop_counter |
◆ lb
lower and upper bounds
Definition at line 137 of file qp_ip.h.
◆ max_iter
unsigned int qp_ip::max_iter |
|
private |
backtracking search parameter beta
Definition at line 150 of file qp_ip.h.
◆ mu
logarithmic barrier parameter
Definition at line 147 of file qp_ip.h.
◆ obj_computation_on
bool qp_ip::obj_computation_on |
|
private |
Diagonal elements of H.
Definition at line 127 of file qp_ip.h.
Diagonal elements of H.
Definition at line 126 of file qp_ip.h.
◆ tol
tolerance
Definition at line 97 of file qp_ip.h.
◆ tol_out
maximum number of internal loop iterations (in total)
Definition at line 151 of file qp_ip.h.
◆ ub
lower and upper bounds
Definition at line 138 of file qp_ip.h.
Variables for the QP (contain the states + control variables). Initial feasible point with respect to the equality and inequality constraints.
Definition at line 84 of file qp_ip.h.
◆ zref_x
const double* qp_ip::zref_x |
|
private |
◆ zref_y
const double* qp_ip::zref_y |
|
private |
The documentation for this class was generated from the following files: