|
A sparse MPC solver for walking motion generation (old version).
|
This page describes changes in KKT system after addition of inequality constraint to the active set.
Let
be the normal to the i-th inequality constraint (assumed to be a simple bound). Define the matrix
![$ \mbm{C} = \left[\begin{array}{c} \mbm{E} \\ \mbm{A}_{W}\end{array}\right] $](form_57.png)
where the rows of
contain the normals to the inequality constraints in the working set.
If a new constraint must be added to the active set, then the Schur complement must be updated:
![$ \frac{1}{2} \left[ \begin{array}{c} \mbm{C}\\ \mbm{a}^T\\ \end{array} \right] \mbm{H}^{-1} \left[\mbm{C}^T \quad \mbm{a}\right] = \frac{1}{2} \left[ \begin{array}{cc} \mbm{C} \mbm{H}^{-1} \mbm{C}^T & \mbm{C} \mbm{H}^{-1} \mbm{a}\\ \mbm{a}^T \mbm{H}^{-1} \mbm{C}^T & \mbm{a}^T \mbm{H}^{-1} \mbm{a}\\ \end{array} \right] $](form_59.png)
In general the last line is
![$ \mbm{s_a}^T = \frac{1}{2} \left[ \mbm{a}^T \mbm{H}^{-1} \mbm{E}^T \quad \mbm{a}^T \mbm{H}^{-1} \mbm{A}_W^T \quad \mbm{a}^T \mbm{H}^{-1} \mbm{a} \right] $](form_60.png)
Note that
is a vector of zeros. While
is a scalar.
selects and scales one column of
, this column corresponds to ZMP coordinates and can have at most 4 non-zero elements.
The total number of non-zero elements in the new row of Schur complement is 5 or 3 (for the last state in the preview window).
Input:
m_e % the number of equality constraints
m_a % the current cardinality of the active set
L % Cholesky factor
s_a % a row added to the Schur complement
Output:
l % a new (the last) row of L
l = s_a
first % the index of the first !=0 element of s_a
end = m_e + m_a + 1 % the index of the last element of s_a
for i = l_s:m_e
l(i) = l(i) / L(i,i)
l(end) = l(end) - l(i)^2
% Since ecL is sparse, no more than three subsequent elements with
% (known) indexes 'k' <= 'end' in 'l' must be updated:
l(k) = l(k) - l(i) * L(k,i)
for j = m_e+1:end-1
l(j) = l(j) - l(i) * L_(j,i)
end
end
for i = m_e+1:end-1
l(i) = l(i) / L(i,i)
l(end) = l(end) - l(i)^2
for j = i+1:end-1
l(j) = l(j) - l(i) * L(j,i)
end
end
l(end) = sqrt(l(end))
After Cholesky decomposition we get 
When a constraint is added to the active set, there is no need to perform full forward substitution in order to form
(but full backward substitution is still required).
![$ \mbm{s}^{+} = -\left[\begin{array}{c} \mbm{C} \\ \mbm{a}_i^T\end{array}\right] \left((\mbm{x}+\alpha\Delta\mbm{x})+\mbm{H}^{-1}\mbm{g}\right) = -\left[\begin{array}{c} \mbm{C}\mbm{x} + \mbm{C}\mbm{H}^{-1}\mbm{g} \\ \mbm{a}_i^T(\mbm{x}+\alpha\Delta\mbm{x}) + \mbm{a}_i^T\mbm{H}^{-1}\mbm{g}\end{array}\right] = \left[\begin{array}{c} \mbm{s} \\ s_n \end{array}\right]. $](form_67.png)
Note that
, because
is in the null space of the normals to the active constraints (stored in
). Hence, given
, computing
amounts to performing two multiplications plus one addition (note that
is constant, and
is already formed).
Now consider the forward substitution
![$ \underbrace{\left[\begin{array}{cc} \mbm{L} & \mbm{0} \\ \mbm{l}^T & \ell \end{array}\right]}_{\mbm{L}^{+}} \underbrace{\left[\begin{array}{c} \mbm{z} \\ z_n \end{array}\right]}_{\mbm{z}^{+}} = \underbrace{\left[\begin{array}{c} \mbm{s} \\ s_n \end{array}\right]}_{\mbm{s}^{+}}, $](form_75.png)
where
is an appended row. These are two equations

From the second one we can compute (note that
)

Hence, forming
amounts to performing one dot product.
1.8.0