Suppose I have the following optimization problem
maximize f(x,y) x(N,2),y subject to sum(norm(x(i+1,:)-x(i,:))+norm(x(i+1,:)-x(i,:))^3)<=y
where x is a matrix variable and y is a scaler variable. I have a doubt about how to implement the above summation in CVX. Based on your previous answers, the guide, and MATLAB, I tried to do the following in CVX
variables x(N,2),y,s maximize f(x,y) subject to for i=1:N-1 s>=s+norm(x(i+1,:)-x(i,:))+pow_pos(norm(x(i+1,:)-x(i,:)),3) end s<=y
As you can see, I introduced a new variable, s, to represent the summation. I have a doubt about the introduction of the variable s. Please, will s properly hold the summation? Or, is there a better way of doing this? How should it be if y was a scaler constant instead of a variable?
Your help is much appreciated,