• No results found

The online active set strategy iterates through optimal solutions of intermediate QPs along the homotopy path. As the solution of each consecutive QP starts at the optimal solution of the previous one, this section addresses the question of how to initialise the homotopy of the very first QP to be solved. Besides the standard initialisation as presented in [77], we also present novel variants that significantly speed-up QP solution in case a sufficiently accurate guess for the optimal active-set is available. Moreover, we discuss how to obtain such guesses in the MPC context.

3.2.1

Initialisation Strategies

Standard Initialisation

Let us assume that we want to solve the quadratic program QP(w0) for a given

parameter w0, being the first one of possibly a whole sequence of QPs. The main

idea for initialising the online active set strategy is to setup an auxiliary parametric quadratic program QPaux(w) whose solution for w = waux

0 is already known and

whose solution for w = w0 coincides with the optimal solution of QP(w0). This

allows one to perform a usual homotopy from the optimal solution of QPaux(waux 0 )

to that of QP(w0).

It turns out that instead of constructing such an auxiliary parametric quadratic program QPaux(w) explicitly, it suffices to construct a single instance QPaux(waux

0 ),

which is a standard QP. Let us assume that QP(w0) does not comprise any

(implicitly defined) equality constraints and that no prior information on its solution is available. In this situation it is natural to construct QPaux(waux

0 ) such

that its optimal active-set is empty: QPaux(waux0 ) : min

x

1 2x

Hx + x0 (3.8a)

INITIALISATION OF THE HOMOTOPY 39

i.e. the gradient vector is set to zero and all components of the constraint vector to −α with α > 0.

It can be easily verified that the choice xopt def= 0, yopt def= 0 and Aopt def= ∅ satisfies

the KKT optimality conditions (2.8) of QPaux(waux

0 ). Thus, we can now start

from this optimal solution performing a homotopy to the optimal solution of the initial quadratic program QP(w0). If the unconstrained minimum is also optimal

for this initial QP, its solution will be obtained after a single full step without any active-set change.

Starting with a Guess for the Optimal Active-Set

In case a good guess for the optimal active-set corresponding to the solution of QP(w0) is available, the standard initialisation described above may lead to

unnecessarily many active-set changes before finding the optimal solution. In particular, this is the case if QP(w0) comprises (implicitly defined) equality

constraints as these constraints are known to be active at the optimal solution. Assuming that a guess for the optimal active-set, denoted by bAopt, is available, we

therefore construct QPaux(waux

0 ) in a different way:

QPaux(waux0 ) : minx 12x

Hx + x0 (3.9a) s. t.  GbAopt GbIopt  x ≥  0 −α · 1  , (3.9b)

where α > 0 and bIopt def= {1, . . . , m} \ bAopt summarises the indices of constraints

that are supposed to be inactive at the optimal solution.

This time we set the gradient vector to zero but the constraint vector is chosen such that constraints that are guessed to be active are indeed active and such that the remaining ones are inactive. It might happen that a constraint i ∈ bIopt is guessed to be inactive although it is linearly dependent from the other active ones (i.e. the ones with an index from bAopt). If this is the case, also the i-th component

of the constraint vector is set to 0 instead of −α rendering this constraint weakly

active. Similarly, if GbAoptdoes not have full row rank, only the indices of a linearly

independent subset of these constraints are actually included in bAopt.

Again, it can be easily verified that the choice xopt def= 0, yopt def= 0 and Aopt def= bAopt

satisfies the KKT optimality conditions of (3.9). Thus, we can now start from this optimal solution performing a homotopy to the optimal solution of the initial quadratic program QP(w0). If the guess has been perfect, its solution will be

Starting with a Guess for the Optimal Primal Solution

It is often more natural to obtain a guess for the optimal primal solution instead of a guess for the optimal active-set. Such a guess, saybxopt, can be easily transformed

into one for the optimal active-set: We simply define b

Aopt def= i ∈ {1, . . . , n} | G

ixbopt≤ bi

to yield a consistent guess for the optimal active-set bAopt. This means that we add

constraints to bAopt that are active or violated at the guessed primal solution

b

xopt

(which is sometimes referred to as clipping). Using this definition we construct QPaux(waux

0 ) as follows:

QPaux(waux0 ) : minx 12xHx + xgaux (3.10a)

s. t.  GbAopt GbIopt  x ≥  GbAoptbx opt GbIoptxb opt− −α · 1  , (3.10b)

where α > 0 and the gradient is defined to be gaux def= −H

b

xopt.

Looking at the KKT optimality conditions of QPaux(waux

0 ), it can be easily verified

that the choice xopt def=

b

xopt, yopt def= 0 and Aopt def= bAopt is an optimal solution. As

before, we can thus start from this optimal solution performing a homotopy to the optimal solution of the initial quadratic program QP(w0). If the guess for the

primal solution has been perfect, its solution will be obtained after a single full step without any active-set change.

3.2.2

Obtaining Good Initial Guesses

Having presented different strategies to start the homotopy, the question arises how to obtain good initial guesses to speed-up QP solution in the MPC context. Part of the answer is that one often does not have to worry about this: as the online active set strategy can always start from the solution of the previous QP, the homotopy only needs to be initialised once at the solution of an auxiliary problem QPaux(waux

0 ). So, if this occurs only once at the very start of the MPC

controller, obtaining a sophisticated guess for the very first QP solution is usually not necessary from a computational point of view.

The initialisation strategies presented in Subsection 3.2.1 will be most interesting in the following situations:

EXTENSION TO MULTIPLY LINEARISED MPC 41

• if not a whole sequence but only a single QP needs to be solved and computation time is crucial;

• if the QP sequence is re-initialised more frequently than only at the very beginning (e.g. due to accumulating numerical errors in the internal matrix factorisations as discussed in Subsection 4.3.1) and one is interested in speeding-up QP solution at the sampling instants where a re-initialisation is required;

• if one does not want the QP sequence to start each homotopy at the optimal solution of the previous QP but at a different initial guess instead.

The third situation typically occurs if the nature of the MPC problem to be solved asks to initialise QP solution with the shifted optimal solution of the previous QP. This is usually the case when the prediction horizon is long and the contribution of the Lagrange term to the objective function dominates that of the Mayer term (see also the discussion in [62]). Also the time-optimal MPC formulation in [230]

makes use of an alternative initialisation of the homotopy.