Want to form the linear equations for conditions given below:

75 Views Asked by At

I want to formulate the set of linear equations for the following conditions:

  • $Q(i) = 0$ if $y(i)=1$ for $i = 1,2,...,n$
  • $Q(i) = P(i)$, if $\sum_{j=1}^{n}{y(j)}=0$ for $j \le i$.
  • $Q(i) = P(i-r)$, if $\sum_{j=1}^{r}{y(j)}\le r$ , and $y(r)=1$ and $y(i)=0$, where $ 0<r<i $

$y(i)$ is binary term $[0,1]$.

Example:

  • Given

Let $P = [ 1,4,6,7,8,1,90]$

Here, the length of $P$ is $7$, i.e. $(n =7)$

Let $y = [0,1,0,0,1,0,0]$. Note that length of $y$ and $P$ are equal.

So the indices : $i = 1,2,3,4,5,6,7$ and $r = 1,2,3,4,5,6$.

  • Calculation of $Q(i)$, which also has length $n$ are provided on the attached image This image shows the examplefile