Content deleted Content added
→Sources: adjust format |
m Open access bot: url-access=subscription updated in citation with #oabot. |
||
(16 intermediate revisions by 7 users not shown) | |||
Line 1:
{{short description|Class of problems in
'''Interval scheduling''' is a class of problems in [[computer science]], particularly in the area of [[algorithm]] design. The problems consider a set of tasks. Each task is represented by an ''interval'' describing the time in which it needs to be processed by some machine (or, equivalently, scheduled on some resource). For instance, task A might run from 2:00 to 5:00, task B might run from 4:00 to 10:00 and task C might run from 9:00 to 11:00. A subset of intervals is ''compatible'' if no two intervals overlap on the machine/resource. For example, the subset {A,C} is compatible, as is the subset {B}; but neither {A,B} nor {B,C} are compatible subsets, because the corresponding intervals within each subset overlap.
Line 5:
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 [[Independent set (graph theory)|maximum independent set]] in an [[interval graph]].
A generalization of the problem considers <math>k>1</math> machines/resources.<ref name=Survey>{{Cite journal | title = Interval scheduling: A survey| year = 2007| last1 = Kolen| first1 = A. | journal = Naval Research Logistics| volume = 54| issue = 5| pages = 530–543| doi = 10.1002/nav.20231| s2cid = 15288326| doi-access = free}}</ref> Here the goal is to find <math>k</math> compatible subsets whose union is the largest.
In an upgraded version of the problem, the intervals are partitioned into groups. A subset of intervals is ''compatible'' if no two intervals overlap, and moreover, no two intervals belong to the same group (i.e., the subset contains at most a single representative of each group). Each group of intervals corresponds to a single task, and represents several alternative intervals in which it can be executed.
Line 21:
==Single-Interval Scheduling Maximization==
Single-interval scheduling refers to creating an interval schedule in which no intervals overlap.
=== Unweighted ===
Several algorithms, that may look promising at first sight, actually do not find the optimal solution:<ref name="KleinbergTardos">{{cite book|last=Kleinberg|first=Jon|url=https://archive.org/details/algorithmdesign0000klei|title=Algorithm Design|author2=Tardos, Éva|year=2006|publisher=Pearson/Addison-Wesley |isbn=978-0-321-29535-4|url-access=registration}}</ref>
* Selecting the intervals that start earliest is not an optimal solution, because if the earliest interval happens to be very long, accepting it would make us reject many other shorter requests.
* Selecting the shortest intervals or selecting intervals with the fewest conflicts is also not optimal.
Line 31 ⟶ 32:
# Repeat until the set of candidate intervals is empty.
Whenever we select an interval at step 1, we may have to remove many intervals in step 2. However, all these intervals necessarily cross the finishing time of ''x'', and thus they all cross each other
A more formal explanation is given by a [[Charging argument]].
Line 38 ⟶ 39:
=== Weighted ===
// The vectors are already sorted from earliest to latest finish time.
int v[numOfVectors + 1]; // list of interval vectors
int w[numOfVectors + 1]; // w[j] is the weight for v[j].
int p[numOfVectors + 1]; // p[j] is the # of vectors that end before v[j] begins.
int M[numOfVectors + 1];
int finalSchedule[];
// v[0] does not exist
w[0] = 0; p[0] = 0; M[0] = 0;
// The following code determines the value of M for each vector.
for (int i = 1; i < numOfVector + 1; i++) {▼
// The maximum weight of the schedule is equal to M[numOfVectors].
M[i] = max(w[i] + M[p[i]], M[i - 1]);
}
//
schedule (j) {
if (j == 0) { return; }
Line 66 ⟶ 67:
}
</syntaxhighlight><ref>{{Cite book |last1=Kleinberg |first1=Jon |title=Algorithm Design |last2=Tardos |first2=Eva |publisher=Pearson |year=2006 |isbn=9780321295354 |edition=1st |pages=254}}</ref>
==== Example ====
If we have the following 9 vectors sorted by finish time, with the weights above each corresponding interval, we can determine which of these vectors are included in our maximum weight schedule which only contains a subset of the following vectors.
[[File:Weighted Interval Scheduling.png|none|thumb|872x872px]]
Here, we input our final vector (where j=9 in this example) into our schedule function from the code block above. We perform the actions in the table below until j is set to 0, at which point, we only include into our final schedule the encountered intervals which met the <math display="inline">w[j]+M[p[j]] \ge M[j-1]</math> requirement. This final schedule is the schedule with the maximum weight.
{| class="wikitable"
!j
!Calculation
!<math display="inline">w[j]+M[p[j]] \ge M[j-1]</math>
(i.e. This vector is included in the final schedule)
!Set j to
|-
|9
|<math>\begin{align} & w[j]+M[p[j]]=w[9]+M[p[9]]=5+M[6]=5+16=21 \\ &
M[j-1]=M[9-1]=M[8]=20
\end{align}</math>
|True
|j=p[j]=p[9]=6
|-
|6
|<math>\begin{align} & w[j]+M[p[j]]=w[6]+M[p[6]]=5+M[4]=5+11=16 \\ &
M[j-1]=M[6-1]=M[5]=11
\end{align}</math>
|True
|j=p[j]=p[6]=4
|-
|4
|<math>\begin{align} & w[j]+M[p[j]]=w[4]+M[p[4]]=3+M[1]=3+5=8 \\ &
M[j-1]=M[4-1]=M[3]=11 \\
\end{align}</math>
|False
|j=j-1=4-1=3
|-
|3
|<math>\begin{align} & w[j]+M[p[j]]=w[3]+M[p[3]]=6+M[1]=6+5=11 \\ &
M[j-1]=M[3-1]=M[2]=5
\end{align}</math>
|True
|j=p[j]=p[3]=1
|-
|1
|<math>\begin{align} & w[j]+M[p[j]]=w[1]+M[p[1]]=5+M[0]=5+0=5 \\ &
M[j-1]=M[1-1]=M[0]=0
\end{align}</math>
|True
|j=p[j]=p[1]=0
|}
==Group Interval Scheduling Decision==
Line 116 ⟶ 164:
=== LP-based approximation algorithms ===
Using the technique of [[Linear programming relaxation]], it is possible to approximate the optimal scheduling with slightly better approximation factors. The approximation ratio of the first such algorithm is asymptotically 2 when ''k'' is large, but when ''k=2'' the algorithm achieves an approximation ratio of 5/3.<ref name=Spieksma/> The approximation factor for arbitrary ''k'' was later improved to 1.582.<ref name="ChuzoiEtAl">{{Cite journal
| doi | title | journal | volume | issue | pages | year | last1 | last2 | last3=Rabani | first3=Yuval
| citeseerx=10.1.1.105.2578}}</ref>
==Related problems==
Line 138 ⟶ 197:
{{Scheduling problems}}
[[Category:Optimal scheduling]]
[[Category:NP-complete problems]]
|