How to define a series of dual variables in a for loop?


#1

My problem is written in the following form

cvx_begin
    variables alpha(N) lambda;
    minimize(lambda);
    subject to
        sum(alpha) == 1;
        for m = 1:M
            1/2 * alpha' * KM(:,:,m) * alpha <= lambda;
        end
cvx_end

Now I want to get the optimal value of the dual variable d(m) corresponding to every quadratic constraint in the for loop. I have tried the following code but it didn’t work:

cvx_begin
    variables alpha(N) lambda;
    dual variable d;
    minimize(lambda);
    subject to
        sum(alpha) == 1;
        for m = 1:M
            d(m) : 1/2 * alpha' * KM(:,:,m) * alpha <= lambda;
        end
cvx_end

Can anyone give some advice? Thanks!


(Mark L. Stone) #2

Per http://cvxr.com/cvx/doc/advanced.html#indexed-dual-variables I believe you need
dual variable d{M}
not
dual variable d

Edit: Note that I just corrected this to use {}} rather than () as this is a cell declaration.


#3

Thank you very much, Mark!