I have a maximization problem where I have two columns the represent an interval (between 0 and 1) and a third column that has value that I need to maximize. The interval columns overlap and in my real life problem, I have thousands of rows. The third column (‘Value _to _Maximize’) where I want to first select the highest value, then search forwards and backwards to find the next highest values that do not have overlapping intervals with previous highs/maximized values. Below is the code that has the three columns mentioned above as well as a 4th column that selects the optimal/expected output called ‘Rows_Choosen’. A “1” indicates it is the row chosen.
I cannot seem to find any literature on how to approach this problem, let alone solve it. Any help would be much appreciated!
beginIntervalvalue1 <- c(0.115,0.12,0.18,0.205,0.21,0.22,0.555,0.59,0.62,0.69,0.75,0.795,0.81,0.82,0.855,0.885,0.9,0.91)
endIntervalvalue2 <- c(0.13,0.19,0.185,0.21,0.25,0.43,0.63,0.65,0.705,0.73,0.78,0.83,0.875,0.845,0.86,0.915,0.925,0.93)
Value_to_Maximize <- c(16,22,9,6,0,98,51,107,37,13,34,9,1,22,5,14,0,0)
Rows_Choosen <- c("-",1,"-",1,"-",1,"-",1,"-",1,1,"-",",-",1,1,1,"-","-","-")
data<-cbind(beginIntervalvalue1, endIntervalvalue2, Value_to_Maximize, Rows_Choosen)
data
Desired output would look like this (however the “-” are not required):