I declare an array of binary variables as $y(i), i = 1, ..., N$
I would like to model the following:
If $y(i-1) + y(i) = 1$ then $y(k) = 0$ for $k < i$ and $y(m) = 1$ for $m \geq i$
To make the question clear, here is an example:
Suppose I have the following 10 binary variables.
$$y(1), y(2), y(3), y(4), y(5), y(6), y(7), y(8), y(9), y(10)$$
The following is true: $y(i-1) \leq y(i)$ for $i > 2 $
The optimiser is supposed to set the values of the variables in a pattern like the following: $(y(1), y(2), y(3), y(4), y(5), y(6), y(7), y(8), y(9), y(10)) = ( 0,0,0,0,0,1,1,1,1,1)$
I know that I will get a pattern like the one mentioned, but I don't know when the first $1$ will appear. I need to determine the variable $y(i)$ that gets first the value $1$ and then set all variables to its right to $1$ and all variables to its left to $0$. So I need to determine when $y(i) + y(i-1) = 1$, knowing that this implies $y(i) = 1$ and $y(i-1)=0$.