Hello!
I have a problem formulating a SOCP problem in Matlab with cvx, it works for a simple example, but fails if i want to implement a larger set of constraints using indexed parameters:
% A: a cell of N*1 matrices each with a size of 2*30
% r: a 30*1 vector
cvx_begin
variables x(30) t(N) c(N)
n = 1:N;
minimize sum(t(n))
subject to
r.'*x == 1;
{[A{n,1}*x; 0.5*c(n)-0.5],0.5*c(n)+0.5} <In> lorentz(3);
{[c(n); 0.5*t(n)-0.5],0.5*t(n)+0.5} <In> lorentz(2);
t(n) >= 0;
c(n) >= 0;
cvx_end
For this code, I get the error “Too many input arguments.” in the first lorentz-cone constraint. But when using only one element A{1,1} and consequently removing the indexing…
cvx_begin
variables x(30) t c
minimize t
subject to
r.'*x == 1;
{[A{1,1}*x; 0.5*c-0.5],0.5*c+0.5} <In> lorentz(3);
{[c; 0.5*t-0.5], 0.5*t+0.5} <In> lorentz(2);
t >= 0;
c >= 0;
cvx_end
… the optimization works. Is the indexing (n) for the constraint variables the problem and if so, how can I fix it?
Thanks a lot and best wishes!