Solve problem with cvx


(farahnaz) #1

Hi
I want to solve this problem but I get this error with CVX:
Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {convex}
My code is:

lm_shiftable_cheat_h_OLD = lm_shiftable_cheat_h;
    for z=1:user_num
    if Ess(z)==2*Es(z)
        cvx_begin quiet
        variables l_cheat(1,H) l_star_cheat(1,H);
        lh_cheat = sum(lm_shiftable_cheat_h+lm_Non_shiftable_h)-lm_shiftable_cheat_h(z,:)+eps;
        lh_cheat_total=sum(lm_shiftable_cheat_h+lm_Non_shiftable_h)+eps;
        Bill_cheat =(l_cheat).*((cost_coeff(1)*(l_star_cheat+lh_cheat).^2 + cost_coeff(2)*(l_star_cheat+lh_cheat)))./(lh_cheat_total);
        minimize sum(Bill_cheat);
        subject to
        l_cheat(alpha(z):beta(z))>=0;
        l_cheat(1:alpha(z)-1)==0;
        l_cheat(beta(z)+1:H)==0;
        sum(l_cheat)==Es(z);
        l_star_cheat(alpha(z):beta(z))>=0;
        l_star_cheat(1:alpha(z)-1)==0;
        l_star_cheat(beta(z)+1:H)==0;
        sum(l_star_cheat)==Ess(z);

        cvx_end

What shoud I do?


(Mark L. Stone) #2

Your two CVX variables, l_cheat and l_star_cheat, are being multiplied in the expression for Bill_cheat. That is against CVX’s DCP rules. Why isn’t CVX accepting my model? READ THIS FIRST!

I will presume this model is non-convex unless you can show otherwise.