[Math] Linear programming: how to formulate a condition that product of two variables must be not positive

constraintslinear programming

In a non-trivial optimization problem, we have among others two variables $x_1$ and $x_2$ both of them are ranged, i.e. $x_1,x_2\in[L,U]$. It is requested that if one of them is positive then the other must be negative. That is:
$$
(x_1>0 \Rightarrow x_2<0) \land (x_1<0\Rightarrow x_2>0)
$$
The question: is it possible to formulate this as a set of linear constraints? Maybe with some additional variables.

EDIT 1: Preferably, no binary/integer variables to be used.

EDIT 2: Feel free to modify the problem in terms of equality/inequality if needed.

EDIT 3: There may be many pairs of variables like this, say $(x_{1,i},x_{2,i})$. For the simplicity sake, I have not included it in the basic formulation.

Best Answer

It is very uncommon in linear programming to have strict inequality as constraints! I would also guess that both variables have a domain (let us say $[-C,C]$ for the rest of this). Finally, I suppose you may use binary variables.

You can add two binary variables $p_1$ and $p_2$ that will encode if $x_1$ or $x_2$ is positive.

A constraint like $x_2 \leq C (1-p_1)$ would say that if $x_1$ is positive, $x_2$ has to be negative. Similarily, $x_1 \leq C (1-p_2)$ would be needed.

Still, you need to ensure that if $p_1$ is 1, $x_1$ has to be positive. A constraint like $x_1 \geq -C (1-p_1)$ would do the job. Same stands for $p_2$.