Error of my objective function

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?

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.

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?

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

Hi! I want to know how did you correct this error?