cvxopt.solvers.qp
seems to be able to solve
1/2 xT P x + qT x
subject to
Ax ≤ B
For your case,
||ξ||2 = ξ2 = ξT I ξ = 1/2 ξT (2 × I) ξ + 0 x ξ
where I is an identity matrix. So your P and q are (2 × I) and 0 and A = -z_k, b = l_k.
With the given z_k
and l_k
(λ), you can solve matrix inequality by
import numpy
from cvxopt import matrix
P = matrix([
[2., 0., 0.],
[0., 2., 0.],
[0., 0., 2.]
])
q = matrix([[0., 0., 0.]])
z_k = matrix([
[1.],
[2.],
[3.]
])
l_k = matrix([4.])
from cvxopt import solvers
sol = solvers.qp(P, q, -z_k, l_k)
print(sol['x']) # argmin ξ
print(sol['primal objective']) # min ξ^2
Check this.
If you need min ||ξ||
, the norm:
import math
print(math.sqrt(sol['primal objective']))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…