How to write if in cvx?


(seven) #1

I’m trying to add a constraints of Piecewise function,
such as:
Ri[n] − ci[n]) ≥ η;
Rj[n] ≤ ci[n],∀(j not equal to i)

Can i write it directly?
for i=1:k
(constraints1)
for j=1:k
if j~=i
(constraint2)
end
end
end


(Mark L. Stone) #2

You can use your “write it directly” construct. As to whether that implements your piecewise function constraints, I am not clear on what those constraints are.