Solve a quadratic program with a specific structure. qp_as = Quadratic Programming / Active Set.
More...
#include <qp_as.h>
|
| 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...
|
|
| 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...
|
|
Solve a quadratic program with a specific structure. qp_as = Quadratic Programming / Active Set.
Definition at line 37 of file qp_as.h.
◆ 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_position | Position gain |
[in] | gain_velocity | Velocity gain |
[in] | gain_acceleration | Acceleration gain |
[in] | gain_jerk | Jerk 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()
◆ 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] | lambda | vector 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_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 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] | 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 constraints for z_x and z_y |
[in] | ub | array 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_log | a vector of objective function values |
- Returns
- number of activated constraints
Definition at line 258 of file qp_as.cpp.
◆ active_set
A set of active constraints.
Definition at line 111 of file qp_as.h.
◆ active_set_size
unsigned int qp_as::active_set_size |
◆ added_constraints_num
unsigned int qp_as::added_constraints_num |
◆ alpha
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
◆ constraint_removal_on
bool qp_as::constraint_removal_on |
◆ constraints
Vector of constraints.
Definition at line 114 of file qp_as.h.
◆ dX
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 |
◆ obj_computation_on
bool qp_as::obj_computation_on |
|
private |
◆ removed_constraints_num
unsigned int qp_as::removed_constraints_num |
◆ tol
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 |
◆ zref_y
const double* qp_as::zref_y |
|
private |
The documentation for this class was generated from the following files: