Originally posted by: ununun
Hello, I have been struggling with this for a long time. any help is very much appreciated!
Let's say I have an array of length 5 and I define a binary variable y_i (i = 1.. 5) for each of them. I want to select a subset of this array with the continuity constraint that this subset must be adjacent. The size of this subset could be anywhere from 0 to 5.
example:
good: 0 0 0 0 0
good: 0 0 1 0 0
good: 0 1 1 1 0
good: 1 0 0 0 0
bad: 0 1 0 1 0
bad: 1 0 0 1 0
Basically, I am thinking of a constraint that forces those 1s together.
any help/comment is highly appreciated!
#DecisionOptimization#MathematicalProgramming-General