Error of my objective function


#1

Error using + (line 83)
Disciplined convex programming error:
Illegal operation: {concave} + {invalid}

Error in maxUcvx (line 25)
utility=utility+pow_p(lambda(v,i)*temp,1-alpha)/(1-alpha); %pow_p(x,p)

I’m a beginner for cvx, can someone help me with this?


(Mark L. Stone) #2

Look at the values of all the constituents in the argument of the pow_p term just before the time through the loops in which the error occurs. Perhaps there is an NaN.

Also, please copy and paste your code as text into your post, and apply the Preformatted text icon to it, rather than posting an image of your code. That will allow forum readers to copy and paste your code into their own MATLAB session.


#3
cvx_begin quiet
    variable y(V,I);
    utility=0;
    for v=1:V
        for i=1:I
            temp=0;
            for k=1:LENGTH(v,i)
                yy=0;
                for kk=1:k
                    yy=yy+y(PATH((v-1)*I+i,kk),i);
                end
                temp=temp+W(PATH((v-1)*I+i,k+1),PATH((v-1)*I+i,k))* min(1,yy);
            end
            utility=utility+pow_p(lambda(v,i)*temp,1-alpha)/(1-alpha);   %pow_p(x,p)
        end
    end
            
    maximize(utility);
    subject to
        for v=1:V
            cc=0;
            for i=1:I
                cc=cc+y(v,i);
                cc==c(v);
            end
        end
        0 <= y <= 1;
    
cvx_end

Thank you for your reply. I checked as you said. lambda and alpha are just constant, and temp is a cvx concave expression (scalar). Do you have other suggestions?


#4

I think I’ve found what cause this error. Thank you for your attention!