I'm trying to find a sensible way to add constraint for my optimization problem.
Lets assume we have binary decision variables $x_i\in\{0,1\}$ and two constraints \begin{align*} \sum\limits_{i=1}^n x_i&\geq Y_1\\ \sum\limits_{i=1}^n x_i &\leq Y_2\end{align*}
How could I add constraints to my problems in such way that all decision variables that are $1$ have to be "grouped" together and there is no "holes" (zeroes) inside them. So if $n=5,Y_1=2,Y_2=3$ feasible solutions would be
\begin{align*}&\overbrace{\{1,1,0,0,0\}}^{Y_1\,\text{solutions}}\;\text{OR}\\ &\{0,1,1,0,0\}\;\text{OR}\\ &\vdots\\ &\{0,0,0,1,1\} &\\ &\overbrace{\{1,1,1,0,0\}}^{Y_2\, \text{solutions}}\;\text{OR}\\ &\vdots\\ &\{0,0,1,1,1\}\end{align*}
And unfeasible solution would be for example
$$\{1,0,1,0,1\}$$
How could this kind of constraint be implemented?