I intend to generate a binary sequence with a size of $N = 10$, for example, $[1, 0, 0, 0, 0, 1, 1, 1, 0, 0]$. The constraint is that when zero appears, it must appear for at least two consecutive times, such as $[1, 0, 0, 1] $ or $[1, 0, 0, 0, 1]$. In contrast, $[1, 0, 1]$ is not good since zero has appeared for only one time. Previously I have asked a similar question with minimum consecutive one requirement here. But this time the requirement is changed into zeros. I know I can simply define a new variable which convert this "zeros" constraint to "ones" constraint. But I am curious how mathematical formulations will vary.
Asked
Active
Viewed 345 times
2
-
2Just substitute $1-x_i$ for $x_i$ in the answer to your previous question. – prubin Dec 10 '21 at 00:36
-
1Yeah, Thank you for your response. But the previous question has a constraint that requires three consecutive ones. But this problem has the constraint for two consecutive zeros. I think I need more revision than replacing 1-xi. – shaojie liu Dec 10 '21 at 01:19
-
1@prubin Thank you very much. It works by adding 1- towards x_i and x_i-1 and other relevant variables. Sorry, that I did not fully capture your point. – shaojie liu Dec 10 '21 at 03:11