1
$\begingroup$

Suppose we are given n open intervals $(a_1, b_1), ..., (a_n, b_n)$, with interval $i$ being assigned a weight $w_i$ for all $i$. Define a "good subset" of intervals to be a subset of those $n$ intervals where each pair of intervals in the subset overlap (i.e. share a common value). Given an integer $k<n$, we would like to compute the maximum possible value of the total sum of all the weights covered when we choose k non-overlapping good subsets of intervals (i.e. no two of these subsets share an interval). How can you do this in an $O(N\log N)$ algorithm?

Sample input:

$n=6$, $k=2$

Intervals: $(-2, 2)$, $(3, 5)$, $(7, 9)$, $(9, 11)$, $(11, 13)$, $(11, 15)$

Weights: $w_1=0$, $w_2=6$, $w_3=10$, $w_4=8$, $w_5=12$, $w_6=14$

Expected output: $36$; formed by taking $\{(11, 13), (11, 15)\}$ and $\{(7, 9)\}$, so total weight is $12+14+10=36$

Some of my thoughts so far: This problems feel similar to the classic weighted interval scheduling problem, except instead we are trying to maximize the sum of overlapping interval sets rather than disjoint intervals. Additionally, we are trying to find the maximum for $k$ subsets rather than 1, so I can't see off the top of my head how the dynamic programming algorithm from the weighed interval scheduling problem can be used. Does anyone have any insight on this question?

$\endgroup$
5
  • $\begingroup$ so you a looking for the k "good" subsets with the most highest weight. This will give the k subsets with the highest sim, too. Right? $\endgroup$
    – miracle173
    Commented Dec 19, 2021 at 20:50
  • $\begingroup$ correct. However, these subsets are not allowed to share any intervals in common (well they can, but each interval would only count once in the total sum of the weights) $\endgroup$
    – jxia1234
    Commented Dec 19, 2021 at 20:51
  • $\begingroup$ so you want pairwise disjoint subsets. $\endgroup$
    – miracle173
    Commented Dec 19, 2021 at 20:56
  • $\begingroup$ yes, that is correct. $\endgroup$
    – jxia1234
    Commented Dec 19, 2021 at 20:58
  • $\begingroup$ @miracle173 another way this can be thought of is choosing a set of $k$ numbers, and trying to maximize the sum of the weights of the intervals we use (by "use", I define an interval to be used if it contains one of the $k$ numbers from the set). $\endgroup$
    – jxia1234
    Commented Dec 19, 2021 at 21:01

0

You must log in to answer this question.

Browse other questions tagged .