# How to model these constraints correctly

$$W$$ is a vector of $$N$$ complex elements. $$D$$ is a binary variable

The requirements are: when $$D==1$$, $$L_{\min}\le ||W||_2^2\le L_{\max}$$ and when $$D==0$$, $$||W||_2^2=0$$

I have formulated the following constraints to fulfill the requirements

$$||W||_2^2\ge 0$$

$$||W||_2^2\le L_{\max}$$

$$||W||_2^2\le DL_{\max}$$

$$||W||_2^2\ge DL_{\min}$$

Using programming language

 norm(W)>= 0
norm(W)<=sqrt(Lmax)
norm(W)<=D*sqrt(Lmax)
norm(W)>=D*sqrt(Lmin)


norm is a convex function. Is convex>=0 a valid model?

Have I modeled them correctly?

• Since norm is a convex function, you obtain a nonconvex quadratic model as you have lower constraint on it. Gurobi is capable of solving mixed-integer nonconvex quadratics, and as you speak of CVX below and thus work in MATLAB, you might want to know thatt YALMIP supports this mode in Gurobi..Mosek is not applicable, and neither is CVX. Dec 4, 2020 at 20:37
• @JohanLöfberg, thanks for your comment. Unfortunately I am employing MOSEK with CVX, and CVX does not accept this and throws error.
– KGM
Dec 8, 2020 at 0:46
• Yes, as clearly stated, you simply cannot model this using cvx+mosek Dec 8, 2020 at 6:00

The first and second constraints can be omitted. The third and fourth constraints are sufficient, as you can see by considering both cases for $$D$$.