In a problem I am trying to model with a MIP program, the following scenario occurs:
I am given binary variables $x_1,\ldots,x_n$ and $y_1,\ldots,y_n$ which can really be regarded as $n$-vectors. What I need to compute is the number of bits in which they differ. In particular I just need to make sure they are only equal in at most one bit.
This can be done by adding the following quadratic constraint
$$\sum_{i=1}^n x_i y_i \leq 1$$
Given the very specific nature of this condition, I am wondering
Is there a better way to express this?
and
Is there a trick to convert this expression into a linear one?