I have a set of binary variables $X = \{ x_1, x_2, x_3, ... x_N \}$ which are connect and used with the rest of the model.
I want to define a set of binary variables which represents the change between the variables in $X$ with adjacency. Let this set be $Y = \{ y_1._2, y_2._3, y_3._4, ... y_{N-1}._{N} \}$.
This set $Y$ is expected to behave like this,
$$y_i._{i+1} = \begin{cases} 0 & \text{if $x_i=x_{i+1}$ } \\ 1 & \text{otherwise} \end{cases} $$
Eventually, I wish to limit the summation of these $y_i._{i+1}$ variables, but that is an easy part. Question is, how can I define $y_i._{i+1}$ variables in the OR model in terms of $X$ variables which reflects the multi-definition above?