In this code, when I use sum(y) <= Y, the solver tells me there is no solution. However, when I define an intermediate variable tmp = tmp + y in a loop (with tmp pre-defined as 0), and then add the constraint tmp <= Y, the solver finds a solution.
It sounds like sum(y) <= Y is the constraint you want. You don’t say what exactly the solver and CVX reports when you say there is no solution.
You don’t show the code for your loop, but because ``yis a vector, perhaps you are imposing the vector constraintm*y <= Y, i.e., each element of ymust be <=Y/m`, which I don’t think is what you want.
Thank you for your reply. The solver didn’t report any errors; it just showed an optimal value (cvx_optval): +Inf. Since the problem became infeasible in the first iteration, I didn’t show the loop code.