Let $0\leq \beta\leq 1$ be an objective variable. The size of $\beta$ is $N\!\times\!N$.

Now, how can I impose the following?

if $\beta_{i,j}>0$ then $\beta_{j,i}=0$

Big M notation can be one of the possible ways, however, I am unable to proceed.

[post in CVX forum]


1 Answer 1


Introduce binary variable $x_{i,j}$ to indicate whether $\beta_{i,j}>0$ and linear constraints: \begin{align} \beta_{i,j} &\le x_{i,j}\\ x_{i,j} + x_{j,i} &\le 1 \end{align} (The big-M here is 1.)

The first constraint enforces $$\beta_{i,j}>0 \implies x_{i,j} = 1.$$ The second constraint enforces $$x_{i,j} = 1 \implies x_{j,i} = 0.$$ The first constraint enforces $$x_{j,i} = 0 \implies \beta_{j,i} \le 0.$$ The lower bound on $\beta$ enforces $$\beta_{j,i} \le 0 \implies \beta_{j,i} = 0.$$ So $$\beta_{i,j}>0 \implies \beta_{j,i} = 0,$$ as desired.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.