If loop inside the cvx

Uncategorized
Mar 1, 2024
R

How to use if loop inside the cvx, is that is similar to without cvx or any thing changes??

Actually, if I use if loop inside the cvx, then I am getting below error in matlab:

In > (line 21)
In Paper_3_b_paper_7_Fig9_Code (line 181)
Error using cvxprob/newcnstr
Disciplined convex programming error:
Invalid constraint: {concave} > {invalid}

Error in > (line 22)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘’ ), x, y, ‘>’ );

Error in Paper_3_b_paper_7_Fig9_Code (line 181)
if permutation_wsr > max_wsr

But, without if loop, the full code is working fine, that’s why

M

CVX variables and expressions are not allowed in the condition on which if branches. I.e., something can’t be a CVX variable or expression in if something, .... end

You will need logic constraints involving Big M. Read up on this at Posts containing 'logic constraints' - Operations Research Stack Exchange .