A sparse MPC solver for walking motion generation.
qp_ip.h
Go to the documentation of this file.
1 
9 #ifndef QPIP_H
10 #define QPIP_H
11 
12 /****************************************
13  * INCLUDES
14  ****************************************/
15 #include "smpc_solver.h"
16 #include "smpc_common.h"
17 #include "ip_chol_solve.h"
18 #include "ip_problem_param.h"
19 
20 #include <vector>
21 
22 
23 /****************************************
24  * Defines
25  ****************************************/
26 
27 
28 using namespace std;
29 using namespace smpc;
30 
33 
39 {
40  public:
41 // functions
42  qp_ip(
43  const int N_,
44  const double,
45  const double,
46  const double,
47  const double,
48  const double,
49  const bool,
51  ~qp_ip();
52 
53  void set_parameters(
54  const double*,
55  const double*,
56  const double,
57  const double*,
58  const double*,
59  const double*,
60  const double*,
61  const double*);
62 
63  void form_init_fp (
64  const double *,
65  const double *,
66  const double *,
67  const bool,
68  double *);
69 
70 
71  void set_ip_parameters (
72  const double,
73  const double,
74  const double,
75  const double,
76  const unsigned int,
77  const double);
78 
79  void solve(vector<double> &);
80 
84  double *X;
85 
86 
87  unsigned int int_loop_counter;
88  unsigned int ext_loop_counter;
89  unsigned int bs_counter;
90 
91 
92  private:
93  // parameters
94  double gain_position;
95 
97  double tol;
98 
101 
102 
103  // variables and descent direction
104 
106  double *dX;
107 
109  double *g;
110 
113  double *i2hess;
114 
116  double *i2hess_grad;
117 
121  double *grad;
122 
123 
126  double Q[3];
127  double P;
129 
130 
133 
134 
137  const double *lb;
138  const double *ub;
140 
141  const double *zref_x;
142  const double *zref_y;
143 
144 
145 // IP parameters
146  double t;
147  double mu;
148  double bs_alpha;
149  double bs_beta;
150  unsigned int max_iter;
151  double tol_out;
152 
153 
154 // functions
155  double init_alpha();
156  double form_bs_alpha_obj_dX ();
157  double form_phi_X_tmp (const double, const double);
158  bool solve_onestep (const double, vector<double> &);
159  void form_g (const double *, const double *);
160  double form_grad_i2hess_logbar (const double);
161  double form_phi_X ();
162  double form_decrement();
163  double compute_obj(const bool);
164 };
165 
167 #endif /*QPIP_H*/
unsigned int ext_loop_counter
Definition: qp_ip.h:88
double * dX
Definition: qp_ip.h:106
double * i2hess
Inverted hessian: non-repeating diagonal elements 1:3:N*SMPC_NUM_STATE_VAR, 2*N in total.
Definition: qp_ip.h:113
Solve a quadratic program with a specific structure. qp_ip = Quadratic Programming / Interior-point m...
Definition: qp_ip.h:38
double tol
tolerance
Definition: qp_ip.h:97
const double * ub
lower and upper bounds
Definition: qp_ip.h:138
A set of problem parameters.
unsigned int int_loop_counter
Definition: qp_ip.h:87
unsigned int max_iter
backtracking search parameter beta
Definition: qp_ip.h:150
const double * zref_x
Definition: qp_ip.h:141
bool obj_computation_on
Definition: qp_ip.h:99
double * i2hess_grad
Inverted hessian * gradient (N*SMPC_NUM_VAR vector)
Definition: qp_ip.h:116
Interface of the library.
double t
Definition: qp_ip.h:146
IP::chol_solve chol
An instance of IP::chol_solve class.
Definition: qp_ip.h:132
backtrackingSearchType
Type of the backtracking search.
Definition: smpc_solver.h:420
double tol_out
maximum number of internal loop iterations (in total)
Definition: qp_ip.h:151
double mu
logarithmic barrier parameter
Definition: qp_ip.h:147
Solves KKT system using Cholesky decomposition.
Definition: ip_chol_solve.h:35
double * X
Definition: qp_ip.h:84
double bs_beta
backtracking search parameter alpha
Definition: qp_ip.h:149
double * grad
2*N gradient vector, only the elements that correspond to the ZMP positions are computed,...
Definition: qp_ip.h:121
backtrackingSearchType bs_type
Definition: qp_ip.h:100
unsigned int bs_counter
Definition: qp_ip.h:89
const double * zref_y
Definition: qp_ip.h:142
double * g
2*N non-zero elements of vector g.
Definition: qp_ip.h:109
double P
Diagonal elements of H.
Definition: qp_ip.h:127
const double * lb
lower and upper bounds
Definition: qp_ip.h:137
double gain_position
Definition: qp_ip.h:94
double bs_alpha
multiplier of t, >1.
Definition: qp_ip.h:148