Originally posted by: MSaqib
Reformatting my question posted earlier to the forum. I wonder why I never noticed the help bar on the right.
Hello everyone
I have a decision variable in the form of an array of integers.
dvar
int Map[S24][TIMES] in LOCATIONS;
where S24, TIMES and LOCATIONS are all ranges of integers.
I need a constraint on Map, so that at least n consecutive values in it must be the same. For example, if the solver assigns the value 13 to
Map[1][1]
then
Map[1][2], Map[1][3], ..., Map[1][2+n]
must also be 13.
Map[1][2+n+1] is free to take on any value, including 13
Supposing that
Map[1][2+n+1] takes on the value 2
then
Map[1][2+n+2], Map[1][2+n+3], ..., Map[1][2+n+1+n] must also take on the value 2.
Here, n is an integer model parameter, and of course, this sort of constraint must hold for Map[2][*], Map[3][*] etc as well.
Any help/pointers would be helpful.
Thanks and best regards
#ConstraintProgramming-General#DecisionOptimization