Hello,
I need to check dual variables associated with second-order cone (SOC) constraint. For SOC constraint i am using ‘complex_lorentz()’ function. I am not able to associate the dual variable with the ‘complex_lorentz()’ function, here i am getting error. Error message is

??? Error using ==> cvxdual.colon at 17
Cannot assign a dual variable to a composite constraint.
Error in ==> test_SOCP at 18
z : {A*x+b, c*x+d} == complex_lorentz(2);

Example, Matlab code:

A = abs (rand (2,2));
b = abs (rand(2,1));
c= abs (rand(1,2));
d = rand(1);
cvx_begin
variable x(2,1) complex;
dual variable y;
dual variable z;
variable t;
minimize (t);
subject to
% SOC constraints
z : {A*x+b, c*x+d} == complex_lorentz(2);
y : {x, t} == complex_lorentz(2);
cvx_end

I agree that it is unfortunate that one cannot assign a dual variable to a composite constraint—one involving a cell array on the left or the right, as you have above.

The good news is that for real Lorentz cone constraints, there is a relatively easy workaround for now:

cvx_begin
variables x(2,1) t;
dual variables yx yt zx zt;
minimize(t);
C1 = lorentz(2);
C2 = lorentz(2);
A * x + b == C1.x : yx;
c * x + d == C1.y : yt;
x == C2.x : zx;
t == C2.y : zt;
cvx_end

Unfortunately, if you try do do this with complexx, you will uncover a bug in CVX associated with assigning dual variables to complex equality constraints.

So the bad news is, that the trick I just showed you above cannot be used in the complex case. I’m afraid there is currently no way to achieve the results you are seeking at this point, unless you manually convert the problem to real form. It can be done, but it is of course quite inconvenient.

I’ll add the complex dual variable bug into my bug tracker, and when I fix that I will also investigate if there is a way I can lift the restriction on dual variables with composite constraints.

Hi, I couldn’t get the trick that you did above
I have an SOC problem with some real Lorentz cone constraints. The following is my code.

for i=1:q
cvx_begin
variable zz(m)
variable uu(n,1)
minimize sum(zz)
subject to
for j=1:m
if I(j)==i
for k=1:dim(j)
{[s(sum(dim(1:j-1))+k,:)'-uu;(1-zz(j))/2],(1+zz(j))/2} <In> lorentz(n+1)
end
else
zz(j)==0;
end
end
cvx_end
end

When I update the code like the following (after adding “dual variables y t” command)

Error using cvxdual/colon (line 17)
Cannot assign a dual variable to a composite constraint.
Error in allocation (line 185)
y: {[s(sum(dim(1:j-1))+k,:)'-uu;(1-zz(j))/2],(1+zz(j))/2} <In> lorentz(n+1)

Is there a way to handle this?

Also,writing “: y” right hand side of the constraint, instead of writing “y :” left hand side changes the error I get. For this case, I am getting the following error.

Undefined function 'colon' for input arguments of type 'cvxtuple'.
Error in allocation (line 185)
{[s(sum(dim(1:j-1))+k,:)'-uu;(1-zz(j))/2],(1+zz(j))/2} <In> lorentz(n+1) : y

The reason of failure of “z : {Ax+b, cx+d} == complex_lorentz(2)” is that a dual variable cannot be attached to an object of type cell；
By using “y:[Ax+b; cx+d] == [L1.x; L1.y]”, the cell object is tranformed into numerical array and therefore dual variables can be attached.

Remark: Operation "[Ax+b; cx+d] " will tranform the real type of c*x+d into complex type, which may lead to some unpredictable results. A more robust solution is

I wanted to know is the dual variable of CVX as same as the theoretical solution or not?
Because when I simulate the water-filling problem with CVX and Bisection algorithm, the final answer of the objective function (Capacity) is as same as each other but the dual variable is not as same is each other. I do not know why and I hope there is an explanation or I did wrong with CVX. (Please notice that the final answer is as same as each other but the dual variable is not.)