Problem related to formulating a MIP (MILP)

I want the following help in linear fashion:

  • I have a vector (parameter) : Z = [1 2 3 4 5 …n].


  • I have binary variables with length of Z : y(1),y(2)…y(n)

A new vector, ‘Z_new’ is needed as follows:

  • such that, if y(i) is 1, then the ith element in Z_new should be zero.

For example, if y(1) and y(4) are 1, then Z_new(1) and Z_new(4), should be zero.

  • The rest elements should come from Z parameter

For example, in above case : Z_new = [0 1 2 3 0 1 2 3 4 …n]

The Z parameter should restart in the non-zero position.

Another example :

if y(1) and y(2) are 1, then Z_new should be as follows:

Z_new = [0 0 1 2 3 4 … n].

Can you please help me formulating this problem?