Originally posted by: AdamGregory
Hey there,
I'm trying to determine how many times a particular number appears in an array of ranges defined by start values and end values.
My current approach is to iterate over the array of ranges and convert from a range to an array using:
all (j in rangeStart..rangeEnd) j
Where rangeStart and rangeEnd are both decision variables, and sum up or count the number of occurrences of a particular value.
The issue is that the generated array does not appear to contain any of the values on the range rangeStart..rangeEnd if either rangeStart or rangeEnd is a decision variable. If put placeholder integers in their place, the array appears correctly.
Can anyone advise on this particular problem or suggest an alternative approach to count the number of occurrences of a particular value in an array of ranges?
Thanks
#DecisionOptimization#OPLusingCPLEXOptimizer