Suppose $i$ varies from $0$ to $4$.
$A_i$, $S_i$, $E_i$ are binary variables.
Now, if $S_1=1$ and $E_3=1$, then how to make $A_1=A_2=A_3=1$ and $A_0=A_4=0$ using linear equations?
Suppose $i$ varies from $0$ to $4$.
$A_i$, $S_i$, $E_i$ are binary variables.
Now, if $S_1=1$ and $E_3=1$, then how to make $A_1=A_2=A_3=1$ and $A_0=A_4=0$ using linear equations?
If you add a constraint $$A_i = \sum_{j \le i} S_j - \sum_{j < i} E_j$$ for each value of $i$ then I think that does what you want.
Assuming there is some starting index $a$ for which $S_a = 1$ and some ending index $b$ for which $E_b = 1$, and all other $S$ and $E$ variables are $0$, the first sum in this constraint will be $1$ if $i \ge a$, and the second sum will be $1$ if $i > b$. So we'll have $0-0$ for $i<a$, $1-0$ for $a \le i \le b$, and $1-1$ for $i>b$.
You probably also want the constraints $$\sum_{i=0}^n S_i = \sum_{i=0}^n E_i = 1,$$ so that there's exactly one starting index and exactly one ending index.
sum of (Ai)=3but this does not guaranteeA4will be0... – Dr.PB Mar 27 '17 at 06:44ibetweenSiandEionAi": what the hell does that mean ? – Mar 27 '17 at 07:05