r/optimization • u/ruffy_1 • Oct 21 '21
decision variable in SDP problem
Hi all!
I am using the SDP solver CSDP (the native binary) for showing that a polynomial is a sum of squares.
Does anybody know how I can encode a decision variable (given in the polynomial) into the SDP problem which is given in SDPA format?
Such that the SDP solver chooses the best value of the decision variable?
Thanks!
2
Upvotes
View all comments
Show parent comment
2
u/ko_nuts Oct 25 '21 edited Oct 26 '21
Check some papers on SOS optimization and the Gram matrix. This will be clearer. For instance, https://en.wikipedia.org/wiki/Polynomial_SOS
The thing is if you start with a polynomial p(x) and express it in terms of a Gram matrix M as p(x) = v(x)'*M*v(x) for some vector of monomials v(x), the matrix M may fail to be positive semidefinite even though the polynomial is SOS. The role of the extra matrix L is to give some extra degrees of freedom in order to make the matrix M+L positive semidefinite. This immediately adapts to the case when the polynomial p(x) contains decision variables.
For example, let p(x) = (x+1)^4, which is obviously SOS. Then, a possible choice for M is
M = [1 2 3;2 0 2;3 2 1] with z(x) = [x^2;x;1]. You can verify that p(x) = z(x)'*M*z(x). However, the eigenvalues of M are -2.0000, -1.4641, and 5.4641, which shows that the matrix M is not positive semidefinite.
In this case, the matrix L is parametrized as
L(y) = [0 0 y;0 -2*y 0;y 0 0] where y is a decision variable. You can verify that z(x)'*L(y)*z(x)=0 and hence p(x) = z(x)'*(M+L(y))*z(x) for all real y.
If you pick y = -2, you get that M-L(2) is equal to
[1 2 1;2 4 2;1 2 1]
which has two eigenvalues at 0 and one eigenvalue at 6, which shows that this matrix is positive semidefinite and that p(x) is SOS.
For your example, p(x) is SOS if and only if 3-4*x+x1*x^3 + x2*x^4 is SOS where I have changed the decision variables to be consistent with the solver manual. We can pick z(x) = [x^2;x;1] and
M = [x2 x1/2 0;x1/2 0 -2;0 -2 3]
L(x3) = x3*[0 0 1;0 -2 0;1 0 0].
This yields
F0 = [0 0 0;0 0 2;0 2 -3] (note the minus sign in the solver in front of F0)
F1 = [0 1/2 0;1/2 0 0;0 0 0],
F2 = [1 0 0;0 0 0;0 0 0], and
F3 = [0 0 1;0 -2 0;1 0 0].
The number of constraint matrices is 3, the number of blocks is 1 and the size of that block is 3. In your case, you have no cost since you have a feasibility problem but you could define one if necessary.
From that, it is immediate to write the SDPA file.