1

I need to solve the following quadratic minimization subject to linear inequality constraint;

enter image description here

Where

||ξ|| is the Euclidean norm of ξ,

ξ and vk are vectors

and λk is a scalar.

I think this can be done with CVXOPT, but I don't have any experience with quadratic minimization so I am a bit lost, some help or just pointers would be greatly appreciated!.

solve ξ∗ = argmin||ξ|| subject to z.T ξ ≥ −λk

Vinzent
  • 1,070
  • 1
  • 9
  • 14

1 Answers1

1

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']))
Vinzent
  • 1,070
  • 1
  • 9
  • 14
ghchoi
  • 4,812
  • 4
  • 30
  • 53
  • Thank you very much!, just one thing I don't understand; isn't ξT I ξ = ||ξ||^2 ???. Maybe it doesn't matter because minimizing the square of the norm is equivalent to minimizing the norm???. – Vinzent Jan 22 '21 at 01:23
  • @Vinzent Ah, sorry about that. Since it is not `argmin` but `min`, you are right. You may square root the result. – ghchoi Jan 22 '21 at 01:25
  • I'm not sure what is meant by argmin, but the problem IS actually formulated like this; "solve ξ∗ = argmin||ξ|| subject to z.T ξ ≥ −λk" But I can't square-root the result because the result is ξ, I need to find ξ such that ||ξ|| is minimal, not such that ||ξ||^2 is minimal, am I misunderstanding something?... – Vinzent Jan 22 '21 at 01:31
  • `argmin_x` means the argument `x` minimizing `f(x)`. `min_x` means the minimum `f(x)` by the given `x`. – ghchoi Jan 22 '21 at 01:33
  • Okay yes I thought so.. So is it then correct to minimize ||ξ||^2 rather than ||ξ|| as in your answer?.. I guess the value of ξ than makes ||ξ||^2 minimal will also be the value of ξ that makes ||ξ|| minimal right? – Vinzent Jan 22 '21 at 01:35
  • @Vinzent As long as it is `argmin`, one that minimizing `||ξ||^2` is equal to another that minimizing `√||ξ||^2` = `||ξ||`. – ghchoi Jan 22 '21 at 01:42
  • @Vinzent If it is `min`, `min ||ξ||` is equal to `min √||ξ||^2` – ghchoi Jan 22 '21 at 01:45
  • Yes that makes sense, thank you again!.. And then I guess since in my problem I need z.T ξ ≥ −λk then A = -z.T and b = λk .. ie. I can just negate both sides of the inequality to make >= into <= ??? – Vinzent Jan 22 '21 at 01:48
  • @Vinzent It seems so according to the reference. Also, I made an edit to find `min ||ξ||`. If fine, please accept the answer. – ghchoi Jan 22 '21 at 01:52
  • I have accepted the answer, thank you very much for your help!.. – Vinzent Jan 22 '21 at 01:55
  • @Vinzent Thank you too! – ghchoi Jan 22 '21 at 01:56
  • I think it would be best if you edit the line "sol = solvers.qp(P, q, z_k, l_k)" to say "sol = solvers.qp(P, q, -z_k, l_k)" to reflect that z_k needs to be negated.. in case others come across the question. – Vinzent Jan 22 '21 at 01:58
  • 1
    @Vinzent Nice, haha. Take my upvote, thanks! – ghchoi Jan 22 '21 at 02:01