• No results found

Numerical Modifications to Increase Reliability

Though qpOASES is based on numerically stable matrix factorisations, namely a modified QR factorisation and a Cholesky decomposition, the online active set strategy can encounter numerical difficulties when solving certain QPs. Two main reasons can be distinguished:

• First, the QP can be ill-conditioned leading to projected Hessian matrices with large condition numbers. This can either be due to Hessian matrices with greatly varying eigenvalues or due to constraints that are very close to being linearly dependent3.

• Second, the minimum determining the homotopy step length in Equa- tions (3.7) can be attained for more than one constraint at once. In this situation, usually called a tie [237], it is not clear which of these constraints shall be added or removed. This can lead to repeated addition and deletion within a fixed subset of constraints causing cycling of the algorithm. The phenomenon of cycling is common to all active-set QP methods and “most QP implementations simply ignore the possibility of cycling” [178]. However, for solving QPs reliably, this issue needs to be addressed (for example by following one of the approaches described in [102, 88]).

3Exact linear dependence of the constraints is usually less of a problem as the linear independence test in step (5) of Algorithm 3.1 can prevent a linearly dependent constraint from being added to the current working set.

NUMERICAL MODIFICATIONS TO INCREASE RELIABILITY 59

In the following subsections we briefly summarise ideas proposed in [193] to tackle these issues for increasing the reliability of the QP solution. These ideas have also been implemented into qpOASES and can optionally be used if necessary or desired [83].

4.3.1

Dealing with Rounding Errors and Ill-Conditioning

In order to reduce the influence of ill-conditioned projected Hessian matrices on the computation of the step direction, iterative refinement can be employed when solving the linear system (3.6). Iterative refinement (as originally proposed in [241]) recovers in each iteration a fixed number of extra valid digits of the solution of the linear system, provided that the refinement step is performed with higher precision. However, numerical accuracy is typically also improved if residuals are computed only at working precision (so-called fixed precision iterative refinement) [217, 125]. Thus, iterative refinement can be helpful whenever the condition number of the KKT matrix in (3.6) is only a few orders of magnitude smaller than the inverse of the machine precision. Its additional computational cost amounts in each iteration to one matrix-vector multiplication and one backward substitution with the matrix decomposition of the KKT matrix, which is moderate compared to the computational cost of a full QP iteration. qpOASES allows one to specify the desired non-negative number of fixed precision iterative refinement steps per QP iteration. Monitoring the norm of the iterative refinement residuals in consecutive iterations could also help to detect increasing ill-conditioning of the matrix factorisations due to the use of matrix updates.

A second idea aims at preventing the accumulation of rounding errors in the QP solution over multiple iterations, which can become large for ill-conditioned problems. Repeatedly updating the constraint vector b(w0) and the dual solution

vector y(w0) in each QP iteration might render them inconsistent. For example,

a component bi(w0) corresponding to an active constraint i might not exactly

match the value G

ix(w0) or the corresponding dual multiplier yi(w0) might have a

small negative entry (instead of a non-negative one). The so-called drift correction changes the values of b(w0) and y(w0) straight-forwardly to consistent values and

afterwards modifies the QP gradient as follows:

g(w0) def

= Hx(w0) − Gy(w0) . (4.9)

That way the current QP is slightly perturbed such that the current solution is an exact one, i.e. the drift correction actually introduces tiny kinks into the homotopy path. However, this allows the algorithm to annihilate all rounding errors in the QP solution before performing the next QP iteration. The drift correction increases computational load mainly by the two extra matrix-vector multiplications in Equation (4.9), which might become quite expensive compared

to the overall QP iteration in certain situations. Therefore, and because it is often superfluous to perform a drift correction in each QP iteration even for ill- conditioned QPs, qpOASES allows the user to specify a frequency at which drift corrections are to be performed (if at all).

A third idea to avoid ill-conditioning of the Cholesky factors R due to tiny eigenvalues of the Hessian matrix is the introduction of flipping bounds. The main idea is to check upon removal of an active constraint (or bound) whether the new diagonal elements of R drops below a certain threshold. If so, the constraint remains active but the intermediate QP data is changed such that it is active at its opposite limit (e.g. an active upper bound will become an active lower bound). qpOASESprovides options to enable the use of flipping bounds and to adjust this threshold. As all matrix decompositions remain valid in case one needs to flip, the computational overhead is low.

The flipping bound strategy requires that the projected Hessian matrix is numerically positive definite at the beginning. This can be easily achieved by starting the homotopy such that all bounds are fixed in the beginning (as described in Section 3.2) leading to a projected Hessian matrix of dimension zero. Moreover, it requires that all bounds and constraints do have lower and upper limits. To ensure this, Potschka et al. [193] suggest to introduce so-called far

bounds. Artificial limits are introduced for all bounds and constraints that do

not have such limits within the QP formulation. By successively increasing the absolute value of these limits, it can be ensured that no such artificial limit will stay active at the solution (otherwise it can be concluded that the QP is unbounded).

4.3.2

Dealing with Ties

A rigorous approach for resolving ties has been presented in [237] where an auxiliary QP is solved at each tie. However, as this would be an inadequate computational overhead for the online context, qpOASES by default uses a much simpler heuristic that works very well in practice: if a tie occurs, constraint removal is preferred over constraint addition and if this is not sufficient to break the tie, the constraint with smallest index is removed.

An alternative heuristic, called ramping, has been proposed in [193] and is also implemented within qpOASES. It basically aims at avoiding ties by adding mutually different offsets to the constraint and dual solution vectors. Afterwards, the gradient vector is modified in a very similar way as described in Equation (4.9) to restore a consistent QP solution.

One should note that ties cannot be avoided in certain cases, e.g. if the QP solution lies at a point where the LICQ does not hold. In such cases the ramping strategy

INTERFACES AND APPLICATIONS 61

aims at postponing the occurrence of ties to the very last step along the homotopy, where there is no need to resolve them anymore as the QP solution is already found. However, this reasoning is questionable in the online context when a whole sequence of QPs is to be solved.