A question about modeling of if-else constraint in cvx

Hi. please help me .I have a if-else constraint as follow:
h11==pb(t);
if h11>0
w(t)==(w(t-1)-h11*1/0.9)
else
w(t)=w(t-1)-pb(t)10.9;
end
in this constraint pb(t),w(t),h11 are variables that defined.when I write this constrint in cvx ,it shows error:
Disciplined convex programming error:
Constraints may not appear in if/then statements.

You ought to be able to handle if-else constraints using a Big-M approach by introducing binary variables and using CVX’s MIDCP capability. . See for example How to generate cvx code of If-else constraints . If h11 is not an integer variable, you will have to useh11 >= small_number, where small_number is some small number such as 1e-6, for example.

thanks for your answer,but Ido’nt know it. please write the cvx code.

I suggest you learn. Look at some of these threads https://www.or-exchange.org/search/?csrfmiddlewaretoken=dc4d7a9de69ec869c92ee7a76b49cce4&q=Big+M+&Submit=Search&t=question .

hi. it must be mentioned that this problem is in GP form.and I can not solve it again,please write the appropriate code for this problem.(for the if-else constraint in above). thanks

You didn’t say before that this is part of a Geometric Program. CVX will solve the GP using its successive approximation method, However, the successive approximation method does not work correctly for integer (binary) variables. So I don’t think this can be done in CVX.