Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does greedily removing intervals with most conflicts solve interval scheduling?

Tags:

algorithm

We can solve the scheduling problem, in which we must select the largest set of continuous intervals that do no overlap, with a greedy algorithm: we just keep picking the intervals that end the earliest: http://en.wikipedia.org/wiki/Interval_scheduling

Apparently, greedily picking the intervals with fewest conflicts does not work.

I was wondering if putting all the intervals in one big set and then greedily removing the interval with the most number of conflicts left (until the intervals have no conflicts) works. I can envision implementing this greedy algorithm with a priority queue: every time we remove the interval X with greatest conflicts from the priority queue, we update the other intervals that used to conflict with interval X so that the other intervals now are marked as having 1 less conflict.

Does this work? I'm trying to come up with a counterexample to disprove it and can't.

like image 310
dangerChihuahua007 Avatar asked Apr 05 '14 21:04

dangerChihuahua007


People also ask

Which greedy strategy gives the optimal solution in the interval scheduling problem?

i.e., strategy 4 yields an optimum solution, a solution with a maximum number of interval requests.

What is the interval scheduling problem?

The interval scheduling maximization problem (ISMP) is to find a largest compatible set, i.e., a set of non-overlapping intervals of maximum size. The goal here is to execute as many tasks as possible, that is, to maximize the throughput. It is equivalent to finding a maximum independent set in an interval graph.

What is weighted interval scheduling?

In weighted interval scheduling, we assume that in addition to the start and finish times, each request is associated with a numeric weight or value, call it vi, and the objective is to find a set of non-overlapping requests such that sum of values of the scheduled requests is maximum (see Fig. 1(b)).


1 Answers

Here is a counterexample. The idea is to drop a required interval on the very first pick. The number of conflicts is on the right.

        ====    2
       ----     3
      ----      3
    ====        4
  ----          3
 ----           3
====            2

Obviously, we will want to pick the three bold (====) intervals and drop the four thin (----) intervals. There is no other way to obtain three non-intersecting intervals.

By the way, you may find the TopCoder tutorial on greedy problems interesting since it starts with a discussion of several approaches on the same problem.

like image 107
Gassa Avatar answered Oct 21 '22 14:10

Gassa