Approximations for Throughput Maximization

In this paper we study the classical problem of throughput maximization. In this problem we have a collection $J$ of $n$ jobs, each having a release time $r_j$, deadline $d_j$, and processing time $p_j$. They have to be scheduled non-preemptively on $m$ identical parallel machines. The goal is to find a schedule which maximizes the number of jobs scheduled entirely in their $[r_j,d_j]$ window. This problem has been studied extensively (even for the case of $m=1$). Several special cases of the problem remain open. Bar-Noy et al. [STOC1999] presented an algorithm with ratio $1-1/(1+1/m)^m$ for $m$ machines, which approaches $1-1/e$ as $m$ increases. For $m=1$, Chuzhoy-Ostrovsky-Rabani [FOCS2001] presented an algorithm with approximation with ratio $1-\frac{1}{e}-\varepsilon$ (for any $\varepsilon>0$). Recently Im-Li-Moseley [IPCO2017] presented an algorithm with ratio $1-1/e-\varepsilon_0$ for some absolute constant $\varepsilon_0>0$ for any fixed $m$. They also presented an algorithm with ratio $1-O(\sqrt{\log m/m})-\varepsilon$ for general $m$ which approaches 1 as $m$ grows. The approximability of the problem for $m=O(1)$ remains a major open question. Even for the case of $m=1$ and $c=O(1)$ distinct processing times the problem is open (Sgall [ESA2012]). In this paper we study the case of $m=O(1)$ and show that if there are $c$ distinct processing times, i.e. $p_j$'s come from a set of size $c$, then there is a $(1-\varepsilon)$-approximation that runs in time $O(n^{mc^7\varepsilon^{-6}}\log T)$, where $T$ is the largest deadline. Therefore, for constant $m$ and constant $c$ this yields a PTAS. Our algorithm is based on proving structural properties for a near optimum solution that allows one to use a dynamic programming with pruning.


Introduction
Scheduling problems have been studied in various fields, including Operations Research and Computer Science over the past several decades. However, there are still several fundamental problems that are not resolved. In particular, for problems of scheduling of jobs with release times and deadlines in order to optimize some objective functions there are several problems left open (e.g. see [29,26,30]). In this paper we consider the classical problem of throughput maximization. In this problem, we are given a set J of n jobs where each job j ∈ J has a processing time p j , a release time r j , as well as a deadline d j . The jobs are to be scheduled non-preemptively on a single (or more generally on m identical) machine(s), which can process only one job at a time. The value of a schedule, also called its throughput, is the number of jobs that are scheduled entirely within their release time and deadline interval. Our goal is to find a schedule with maximum throughput. Throughput maximization is a central problem in scheduling that has been studied extensively in various settings (even special cases of it are interesting open problems). They have numerous applications in practice [16,1,25,19,32]. The problem is known to be NP-hard (one of the list of problems in the classic book by Garey and Johnson [17]). In fact, even special cases of throughput maximization have attracted considerable attention. For the case of all p j 's being equal in the weighted setting (where each job has a weight and we want to maximize the total weight of scheduled jobs), the problem can be solved in polynomial time only when m = O(1) (running time is exponential in m) [4,13]. The complexity of the problem is open for general m. For the case where all processing times are bounded by a constant the complexity of the problem is listed as an open question [30]. It was shown in [14] that even for m = 1 and p j ∈ {p, q} where p and q are strictly greater than 1 the problem is NP-Complete.

Related Works
It appears the first approximation algorithms for this problem were given by Spieksma [31] where a simple greedy algorithm has shown to have approximation ratio 1/2. This algorithm will simply run the job with the least processing time between all the available jobs whenever a machine completes a job. He also showed that the integrality gap of a natural Linear Program relaxation is 2. Later on, Bar-Noy et al. [6] analyzed greedy algorithms for various settings and showed that for the case of m identical machines greedy algorithm has ratio 1 − 1/(1 + 1/m) m . This ratio is 1/2 for m = 1 and approaches 1 − 1/e as m grows.
In a subsequent work, Chuzhoy et al. [12] looked at a slightly different version, call it discrete version, where for each job j, we are explicitly given a collection I j of intervals (possibly of different lengths) in which job j can be scheduled. A schedule is feasible if for each job j in the schedule, j is placed within one of the intervals of I j . This version (vs. the version defined earlier, which we call the "continuous" version) have similarities but none implies the other. In particular, the discrete version can model the continuous version if one defines each interval of size p j of [r j , d j ] as an interval in I j . However, the number of intervals in I j defined this way can be as big as d j − r j + p j which is not necessarily polynomial in the input size. Chuzhoy et al. [12] presented a (1 − 1/e − )-approximation for the discrete version of the problem. Spieksma [31] showed that the discrete version of the problem is M AX-SN P hard using a reduction to a version of M AX-3SAT . No such approximation hardness result has been proved for the continuous version.
Berman and DasGupta [8] provided a better than 2 approximation for the case when all the jobs are relatively big compared to their window size. A pseudo-polynomial time exact algorithm for this case is presented by Chuzhoy et al. [12] with running time O(n poly(k) T 4 ), where k = max j (d j − r j )/p j and T = max j d j .
For the weighted version of the problem, [3] showed that when we have uniform processing time p j = p, the problem is solvable in polynomial time for m = 1. For m = O(1) and with uniform processing time [4,13] presented polynomial time algorithms. For general processing time 2-approximation algorithms are provided in [8,5] and this ratio has been the best known bound for the weighted version of the problem. More recently, Im et al. [20] presented better approximations for throughput maximization for all values of m. For the unweighted case, for some absolute α 0 > 1 − 1/e, for any m = O(1) and for any > 0 they presented an (α 0 − )-approximation in time n O(m/ 5 ) . They also showed another algorithm with ratio 1 − O( (log m)/m − ) (for any > 0) on m machines. This ratio approaches 1 as m grows. Furthermore, their 1 − O( (log m)/m − ) ratio extends to the weighted case if T = Poly(n).
Bansal et al. [2] looked at various scheduling problems and presented approximation algorithms with resource augmentation (a survey of the many resource augmentation results in scheduling is presented in [27]). An α-approximation with β-speed augmentation means a schedule in which the machines are β-times faster and the total profit is α times the profit of an optimum solution on original speed machines. In particular, for throughput maximization they presented a 24-speed 1-approximation, i.e. a schedule with optimum throughput however the schedule needs to be run on machines that are 24-times faster in order to meet the deadlines. This was later improved by Im et al. [21], where they developed a dynamic programming framework for non-preemptive scheduling problems. In particular for throughput maximization (in weighted setting) they present a quasi-polynomial time (1 − , 1 + )-bi-criteria approximation (i.e. an algorithm that finds a (1 − )-approximate solution using (1 + ) speed up in quasi-polynomial time). We should point out that the PTAS we present for c distinct processing time implies (as an easy corollary) a bi-criteria QPTAS as well, i.e. a (1 − )-approximation using (1 + )-speed up. However, they use the (1 + )-speed up of machines crucially in several places in their algorithms and it does not seem that even adding the assumption of having c many distinct processing times to their algorithm would help to get a polynomial time approximation with ratio (1 − ).
For the problem of machine minimization, where we have to find the minimum number of machines with which we can schedule all the jobs, the algorithm provided in [28] has approximation ratio O( log n/ log log n) only when OP T = Ω( log n/ log log n), and ratio O(1) when OP T = Ω(log n). Later Chuzhoy et al. [10] presented an O(OP T )-approximation which is good for the instances with relatively small OP T . Combining this with the earlier works implies an O( log n/ log log n)-approximation. Chuzhoy and Naor [11] showed a hardness of Ω(log log n) for the machine minimization problem.
Another interesting generalization of the problem is when we assign a height to each job as well and allow them to share the machine as long as the total height of all the jobs running on a machine at the same time is no more than 1. The first approximation algorithm for this generalization is provided by [5] which has ratio 5. Chuzhoy et al. [12] improved it by providing an (e − 1)/(2e − 1) > 0.3873-approximation algorithm which is only working for the unweighted and discrete version of the problem. The problem has also been considered in the online setting [7,15,23,24].

Our Results
Our main result is the following. Suppose that there are c distinct processing times. Theorem 1. For the throughput maximization problem with m identical machines and c distinct processing times for jobs, for any ε > 0, there is a randomized algorithm which finds a (1 − ε)-approximate solution with high probability runs in time n O(mc 7 ε −6 ) log T , where T is the largest deadline.
So for m = O(1) and c = O(1) we get a Polynomial Time Approximation Scheme (PTAS). Note that even for the case of m = 1 and c = 2, the complexity of the problem has been listed as an open problem in [30], however, it has been shown in [14] that even for m = 1 and p j ∈ {p, q} where p and q are strictly greater than 1 the problem is NP-Complete. Our algorithm for Theorem 1 is obtained by proving some structural properties for near optimum I S A A C 2 0 2 0 11:4 Approximations for Throughput Maximization solutions and by describing a randomized hierarchical decomposition which allows us to do a dynamic programming. In order to prove this we prove (and use at the base of our DP) the following (easier) special case: Theorem 2. Suppose we are given B intervals over the time-line where the machines are pre-occupied and cannot be used to run any jobs, there are R distinct release times, D distinct deadlines, and m machines, where R, D, B, m ∈ O (1). Then there is a PTAS for throughput maximization with time 2 ε −1 log −4 (1/ε) + Poly(n).
An easy corollary of Theorem 1 is the following. If the largest processing time p max = Poly(n) then we get a quasi-polynomial time (1 − )-approximation using (1 + )-speed up of machines. This result of course was already obtained in [21]. We should mention that the framework of [21] heavily relies on machine speed up and it is not clear if that approach can be adapted to give an improved approximation for the original (non-augmented) machine speeds.

Preliminaries
Recall that we have a set J of n jobs where each job j ∈ J has a processing time p j , a release time r j as well as a deadline d j , we assume all these are integers in the range [0, T ] (we can think of T as the largest deadline). The jobs are to be scheduled non-preemptively on m machines which can process only one job at a time. We point out that we do not require T to be poly-bounded in n. For each job j ∈ J we refer to [r j , d j ] as span of job j, denoted by span j . We use OPT to denote an optimum schedule and opt the value of it. In the weighted case, each job j has a weight/profit w j which we receive if we schedule the job within its span. The goal in throughput maximization is to find a feasible schedule with maximum weight of jobs. Like most of the previous works, we focus on the unit weight setting (so our goal is to find a schedule with maximum number of jobs scheduled). We also assume that for each p ∈ P , all the jobs with processing time p in an optimum solution are scheduled based on earliest deadline first rule; which says that at any time when there are two jobs with the same processing time available the one with the earliest deadline would be scheduled. This is known as Jackson rules and we critically use it in our algorithms.

Outline.
We start by presenting the proof of Theorem 1 in section 3. We defer the proof of the main Lemma 9 to the journal version of the paper. Finally we present the proof of Theorem 2 in section 4.

Proof of Theorem 1
In this section we prove Theorem 1. For ease of exposition, we present the proof for the case of m = 1 machine only and then extend it to the setting of multiple machines.

Overview of the Algorithm
At a high level, the algorithm removes a number of jobs so that there is a structured near optimum solution. We show that the new instance has some structural properties that is amenable to a dynamic programming. At the lowest level of dynamic programming we have disjoint instances of the problem, each of which has a set of jobs with only a constant size set of release times and deadlines, with possibly a constant number of intervals of time being blocked from being used. For this setting we use the algorithm of Theorem 2. We start (at level zero) by breaking the interval [0, T ] into a constant q (where q will be dependent on ε) number of (almost) equal size intervals, with a random offset. Let us call these intervals a 0,1 , a 0,2 , . . . , a 0,q . Assume each interval has size exactly T /q, except possibly the first and last (and for simplicity assume T is a power of q). For jobs whose span is relatively large, i.e. spans at least λ (where 1 ε ≤ λ ≤ εq) intervals, while their processing time is relatively small (much smaller than T /q), based on the random choice of break points for the intervals, we can assume the probability that the jobs position in the optimum solution is intersecting two intervals is very small. Hence, ignoring those jobs (at a small loss of optimum), we can assume that each of those jobs are scheduled (in a near optimum solution) entirely within one interval. For each of them we "guess" which of the λ intervals is the interval in which they are scheduled and pass down the job to an instance defined on that interval. For jobs whose span is very small (fits entirely within one interval), the random choice of the q intervals, implies that the probability of their span being "cut" by these intervals is very small (and again we can ignore those that have been cut by these break down). For medium size spans, we have to defer the decision making for a few iterations. We then try to solve each of the q instances, independently and recursively; i.e. we break the intervals again into roughly q equal size intervals and so on. If and when an instance generated has only O(1) release times or deadlines we stop the recursion and use the algorithm of Theorem 2 to find a near optimum solution. So considering the hierarchical structure of this recursion, we have a tree with at most O(log q T ) depth and at most O(n) leaves, which is polynomial in the input size. There are several technical details that one needs to overcome in this paradigm. One particular technical difficulty is for some jobs we decide to re-define their span to be a smaller subset of their original span by increasing their release time a little and decreasing their deadline a little. We call this procedure, cutting their "head" and "tail". This will be a key property in making our algorithm work. We will show (Lemma 9) that under some moderate conditions, the resulting instance still has a near optimum solution. This allows us to reduce the number of guesses we have to make in our dynamic program table and hence obtain Theorem 1. We should point out that the idea of changing the span or start/finish of a job was done in earlier works. However, using speed-up of machines one could "catch up" in a modified schedule with a near optimum one. The difficulty in our case is we do not have machine speed up.

Structure of a Near Optimum Solution
Consider an optimum solution OPT. One observation we use frequently is that such a solution is left-shifted, meaning that the start time of any job is either its release time or the finish time of another job. Therefore, we can partition the jobs in schedule OPT into continuous segments of jobs being run whose leftmost points are release times and the jobs in each segment are being run back to back. We call the set of possible rightmost points of these segments "slack times". Proof. We upper bound number of distinct r i + j∈J p j values. First note that there are only n different r i values. Also, for each set J ⊆ J, the sum j∈J p j can have at most n c possible values as the number of jobs in J with a specific processing time can be at most n and we assumed there are only c distinct processing times.
Given error parameter ε > 0 we set q = 1/ε 2 , k = log q T and for simplicity of presentation suppose T is a power of q. We define a hierarchical set of partitions on interval [0, T ]. For each 0 ≤ i ≤ k, I i is a partition of [0, T ] into q i+1 + 1 many intervals such that, except the first and the last intervals, all have length i = T /q i+1 , and the sum of the sizes of the first and last interval is equal to i as well. We choose a universal random offset for the start point of the first interval. More precisely, we pick a random number Note that the length of all intervals in I 0 is T q , except the first and the last which have their length randomly chosen and the sum of their lengths is T q . Similarly each interval in I 0 will be partitioned into q many intervals to form partition I 1 with each interval in I 1 having length T q 2 except the first interval obtained from breaking a 0,0 and the last interval in I 1 obtained from breaking a 0,q , which may be partitioned into less than q many, based on their lengths. All intervals in I 1 have size T q 2 except the very first one and the very last one. We do this iteratively and break intervals of I i (for each i ≥ 0) into q equal sized intervals to obtain I i+1 (with the exception of the very first and the very last interval of I i+1 might have lengths smaller).
We set λ = 1/ε = εq and partition the jobs into classes J 0 , we denote the set of jobs whose span is entirely inside a i,t by J(a i,t ).
Based on our definitions of interval levels and job classes, we can say that for each 0 ≤ i ≤ k if j ∈ J i , then span j would have intersection with at most λ + 1 (or fully spans at most λ − 1) many consecutive intervals from I i−1 and at least λ many consecutive intervals from I i . Suppose j ∈ I i and span j has intersection with a i,tj , a i,tj +1 , ..., a i,t j from I i , then define span j ∩ a i,tj and span j ∩ a i,t j as head j and tail j , respectively.
We consider two classes of jobs as "bad" jobs and show that there is a near optimum solution without any bad jobs. The first class of bad jobs are those that we call "spancrossing". For each job j ∈ J, we call it "span-crossing" if j ∈ J i for some 2 ≤ i ≤ k + 1 (so λ · i ≤ |span j | < λ · i−1 ), and its span has intersection with more than one interval in I i−2 . Proof. Observe that because j ∈ J i , we have |span j | < λ · i−1 . This means that the span j would have intersection with at most λ + 1 (or fully spans at most λ − 1) many consecutive intervals from I i−1 . Also because of the random offset while defining I 0 , and since i−2 = q · i−1 , the probability that job j being "span-crossing" will be at most λ+1 q .
So, we can assume with sufficiently high probability, that there is a (1−O(ε))-approximate solution with no span-crossing jobs. The second group of bad jobs are defined based on their processing time and their position in the optimum solution. We then prove that by removing these type of jobs, the profit of the optimum solution will be decreased by a small factor.
For each job j ∈ J, we call it "position-crossing" if i ≤ p j < i−1 for some 2 ≤ i ≤ k + 1, and its position in OPT has intersection with more than one interval in I i−2 .

Lemma 6. The expected number of position-crossing jobs in OPT is at most
Proof. Consider OPT and suppose that j ∈ J is a job with i ≤ p j < i−1 . Observe that j can have intersection with at most 2 intervals in I i−2 because of its size. Considering our random offset to define interval levels, the probability of job j being a position-crossing (with respect to the random intervals defined) would be at most 1 . Thus, the expected number of position-crossing jobs in OPT is at most opt/q. Hence, using Lemmas 5 and 6, with sufficiently high probability, there is a solution of value at least (1 − O(ε))opt without any span-crossing or position-crossing jobs. We call such a solution a canonical solution.
From now on, we suppose the original instance I is changed to I after we first defined the intervals randomly and removed all the span-crossing jobs. So we focus (from now on) on finding a near optimum feasible solution to I that has no position-crossing jobs. By OPT we mean such a solution of maximum value for I ; we call that a canonical optimum solution. If we find a (1 − O(ε))-approximation to OPT (that has no position-crossing jobs), then using the above two lemmas we have a (1 − O(ε))-approximate solution to I. So with OPT being an optimum solution to I with no position-crossing jobs we let opt be its value.

Finding a Near Optimum Canonical Solution
As a starting point and warm-up, we consider the special case where instance I only consists of jobs whose processing time is relatively big compared to their span and show how the problem could be solved. Consider the extreme case where for each j ∈ J, p j = |span j |. In this case the problem will be equivalent to the problem of finding a maximum independent set in an interval graphs which is solvable in polynomial time [18]. The following theorem shows that if p j ≥ |spanj | λ for each j ∈ J (which we call them "tight" jobs), then we can find a good approximation as well. Therefore, it is the "loose" jobs (those whose processing time p j is smaller than |spanj | λ ) that make the problem difficult. (we should point out that Chuzhoy et al. [12] also considered this special case and presented a DP algorithm with run time O(n Poly(λ) T 4 ) however, their DP table is indexed by integer points on the time-line and the polynomial dependence on T , which can be exponential in n, is unavoidable). The idea of the dynamic program of the next theorem is the basis of the more general case that we will prove later that handles "loose" and "tight" jobs together but the following theorem is easier to understand and follow and we present it as a warm-up for the main theorem.
then there is a dynamic programming algorithm that finds a canonical solution for instance I with total profit opt in time Proof. Recall that k = log q T and observe that for each 0 ≤ i ≤ k − 1 and each j ∈ J i : λ · i ≤ |span j | ≤ λp j , so i ≤ p j . Now if we somehow know OPT ∩ J 0 and OPT ∩ J 1 and remove the rest of jobs in J 0 and J 1 , then the remaining jobs (which are all in J i≥2 ) have intersection with exactly one interval in I 0 (recall we have no span-crossing or positioncrossing jobs), hence we would have q + 1 many independent sub-problems (defined on the q + 1 sub-intervals partitioned in level 0) with jobs from J i≥2 . So our first task is to "guess" the jobs in OPT ∩ (J 0 ∪ J 1 ) (as well as their positions) and then remove the rest of the jobs in J 0 ∪ J 1 from J as well as the jobs whose span is crossing any of the intervals in I 0 ; then recursively solve the problem on independent sub-problems obtained for each interval in I 0 together with the jobs whose spans are entirely within such interval. In order to guess the positions of jobs in OPT ∩ (J 0 ∪ J 1 ) we use the fact that each job can start at a slack time. Since jobs in J 0 ∪ J 1 have size at least 1 = T /q 2 , we can have at most q 2 of them in a solution. We guess a set S of size at most q 2 of such jobs and a schedule for them; there are at most |Ψ| q 2 = n O(q 2 c) choices for the schedule of S. Then we remove the rest of J 0 and J 1 from J for the rest of our dynamic programming. The guessed schedule of S defines a vector v of blocked spaces (those that are occupied by the jobs from S) and for each interval a 0,t , the projection of vector v in interval a i,t , denote it by v t , has dimension at most q (a 0,t has length 0 = T /q and each job in S has length at least 1 = T /q 2 ). We pass each such vector v to the corresponding sub-problem.
Consider an interval a i,t ∈ I i for some 0 ≤ i ≤ k and 0 ≤ t ≤ T i . Recall that the set of jobs j ∈ J whose span is completely inside a i,t is J(a i,t ). Because of the assumption of no span-crossing jobs, for each job j ∈ J \ J(a i,t ), if its span has intersection with a i,t , then it would be in J i for some i ≤ i + 1 (jobs from J i+2 are entirely within one interval of level I i ) and |span j | would be at least λ i+1 , and hence p j ≥ i+1 . Thus we can have at most i / i+1 = q such jobs. Assume we have a guessed vector v of length q where each entry of the vector denotes the start time as well as the end time of one of such jobs. This vector describes the sections of a i,t that are blocked for running such jobs from J \ J(a i,t ). The number of guesses for such vectors v is at most n 2q(c+1) based on the bounds on the number of slack times. Given v and J(a i,t ) we want to schedule the jobs of J(a i,t ) in the free (unblocked by v) sections of a i,t . Now we are ready to precisely define our dynamic programming table. For each a i,t and for each q-dimensional vector v, we have an entry in our DP table A. This entry, denoted by A[a i,t , v], will store the maximum throughput for an schedule of jobs running during interval a i,t , using jobs in J(a i,t ) by considering the free slots defined by v. The final solution would be max S { t A[a 0,t , v t ] + |S|}, where the max is taken over all guesses S of jobs from J 0 ∪ J 1 and v t is the blocked area of a i,t based on S.
The base case is when a i,t has only constantly many release/deadline times. Given that we have also only constantly many processing times and v defines at most q many sections of blocked (used by bigger jobs) areas, then using Theorem 2 we can find a (1 − O(ε))approximation in time Γ, where Γ is the running time of the PTAS for Theorem 2.
We can bound the size of the table as follows. First note that we do not really need to continue partitioning an interval a i,t if there are at most O(1) many distinct release times and deadlines within that interval, since this will be a base case of our dynamic program. So the hierarchical decomposition of intervals I 0 , I 1 , . . . , I k will actually stop at such an interval a i,t when there are at most O(1) release times and deadlines. Therefore, at each level I i of the random hierarchical decomposition, there are at most O(n) intervals in I i that will be decomposed into q more intervals in I i+1 (namely those that have at least a constant number of release times and deadlines within them). Thus the number of intervals at each level I i is at most O(nq) and the number of levels is at most k = log q T . Therefore, the total number of intervals in all partitions is bounded by O(knq). To bound the size of the table A, each v has n 2q(c+1) many options, based on the fact that we have at most n c+1 many choices of start time and end time (from the set Ψ of slacks) for each of the q dimensions of v. Also as argued above, there are O(knq) many intervals a i,t overall. So the size of table is at most kqn O(qc) .

11:9
Now we describe how to fill the entries of the table. To fill A[a i,t , v] for each 0 ≤ i ≤ k − 1 and 0 ≤ t ≤ T i , suppose a i,t is divided into q many equal size intervals a i+1,t +1 , ..., a i+1,t +q in I i+1 . We first guess a subsetJ i,t of jobs from J i+2 ∩ J(a i,t ), to be processed during interval a i,t consistent with free slots defined by v. This defines a new vector v that describes the areas blocked by jobs guessed recently as well as those blocked by v . Projection of v onto the  q intervals a i+1,t +1 , ..., a i+1,t +q defines q new vectors v 1 , ..., v q . Now we check the sum of We would choose theJ i,t which maximizes the above sum. Observe that jobs in J(a i,t ) \ J i+2 have length at most i+3 and because we have no position-crossing jobs, each of them is inside one of intervals a i+1,t +1 , ..., a i+1,t +q and would be considered in sub-problems.
Note that to fill each entry A[a i,t , v] the number of jobs from J i+2 possible to be processed in a i,t would be at most q 2 , because of their lengths. So the total number of guesses would be at most n O(q 2 c) . This means that we can fill the whole table in time at most kqn O(q 2 c) , where q = 1/ε 2 and k = log q T .
Considering Theorem 7, we next show how to handle "loose" jobs, i.e. those for which p j < |spanj | λ . Recall that for each 0 ≤ i ≤ k and for each j ∈ J i , if span j has intersection with intervals a i,tj , a i,tj +1 , ..., a i,t j of I i , then we denote span j ∩ a i,tj and span j ∩ a i,t j as the head and tail of (span of) j, respectively. Our next (technical) lemma states that if we reduce the span of each loose job by removing its head and tail then there is still a near optimum solution for I . More specifically, for each job loose j ∈ J i (p j ≤ |spanj | λ ), whose span has intersection with intervals a i,tj , a i,tj +1 , ..., a i,t j of I i , we replace its release time to start at the beginning of a i,tj +1 and its deadline to be end of a i,t j −1 ; so span j will be replaced with with span j \ (a i,tj ∪ a i,t j ). Let this new instance be called I . Note that a feasible solution for instance I would be still a valid solution for I as well. Proof. The proof to the following important key lemma is deferred to the journal version of the paper: Lemma 9 (Head and tail cutting). Consider any fixed processing time p ∈ P . Start with instance I and remove only the head (or only the tail) part of span j for all jobs j ∈ J with p j = p ≤ |spanj | λ . Then there is a solution for the remaining instance with profit at least (1 − 60 λ )opt . Considering Lemma 9, the proof of Lemma 8 would be easy. We just need to apply Lemma 9 for all c many distinct processing times p ∈ P and for both "head" and "tail". Then the total loss for removing all head and tail parts would be 60 λ · 2c = 120ε fraction: The next theorem together with Lemmas 5, 6, and 9 will help us to complete the proof.

Theorem 10. There is a dynamic programming algorithm that finds an optimum solution for instance
Before presenting the proof of this theorem we show how this can be used to prove Theorem 1 for m = 1.
Proof of Theorem 1. Starting from instance I we first reduced it to instance I at a loss of 1 − O(ε). Then remove the head and tail part of the span for all the loose jobs to obtain instance I . Based on Lemma 9, we only loose a factor of (1 − O(εc)) compared to optimum of I . Theorem 10 shows we can actually find an optimum canonical solution to instance I . This solution will have value at least (1 − O(εc))opt using Lemmas 5, 6, and 9. To get a (1 − ε )-approximation we set ε = ε/c in Theorem 10. The run time will be c 3 ε −3 n O(ε −6 c 7 ) log T . Now we prove Theorem 10.
Proof. The idea of the proof is similar to that of Theorem 7. However, the presence of "loose" jobs needs to be handled too. Suppose j ∈ J i is a loose job, so λ i ≤ |span j | < λ i−1 and p j ≤ spanj λ < i−1 . We break these loose jobs into two categories. For the loose jobs that p j < i+1 , because they are not position-crossing, their position in the final solution will have intersection with at most one interval of I i (and so we can pass them down to lower sub-problems). But for loose jobs where i+1 ≤ p j < i−1 we need to guess them (similar to the tight jobs) and we can do the guessing since their size (relative to i ) is big. In order to handle these guesses, we add one more vector to the DP table, and we do the guess for two consecutive levels of our decomposition as we go down the DP.
Suppose 1,1 , . . . , u q,c ), where each u γ,σ , 0 ≤ u γ,σ ≤ n, we have an entry in our DP table A. Suppose a i,t is partitioned into intervals a i+1,t +1 , ..., a i+1,t +q in I i+1 . Entry A[a i,t , v, u], will store the maximum throughput of a schedule in interval a i,t by selecting subsets of jobs from the following two collections of jobs: J(a i,t ) ∩ J ≥(i+2) u γ,σ many jobs with processing time p σ where p σ < i+2 whose span is the entire interval a i+1,t +γ , for each 1 ≤ γ ≤ q, and 1 ≤ σ ≤ c. by considering the free slots defined by vector v (that describes blocked spaces by jobs of higher levels).
Vector u is defining the sets of jobs from loose jobs (from higher levels of DP table) whose span was initially much larger than i+1 , the guesses we made requires them to be scheduled in interval a i+1,t +γ (of length i+1 ) and hence their span is the entire interval a i+1,t +γ . Like before, v is defining the portions of the interval which are already used by bigger jobs (that are guessed at the higher levels), and for similar reasons as in Theorem 7, we only need to consider v's of size at most q 2 and each job listed in v will be denoted by its start position and end position (so there is O(|Ψ| 2q 2 ) = n O(q 2 c) possible values for v).
Similar to Theorem 7, suppose we start at I 0 . We guess a subset of tight jobs from J 0 to decide on their schedule. Note that tight jobs will have p j ≥ 0 . We also need to guess (and decide on their schedule) those "loose" jobs j ∈ J 0 where p j ≥ 2 = T /q 3 (since their position may cross more than one I 1 intervals in the final solution). So we guess a set S 0 ⊆ J 0 with |S 0 | ≤ q 3 of jobs j where p j ≥ 2 and a feasible schedule for them. This will take care of guessing tight and those loose jobs of J 0 with p j ≥ 2 . We need to do similarly for jobs from J 1 , i.e. we need to guess a set of tight jobs j from J 1 (note that for them p j ≥ 1 ) and also guess (and decide on their schedule) those "loose" jobs j ∈ J 1 with p j ≥ 2 . To do so, we guess a set S 1 ⊆ J 1 of jobs j where p j ≥ 2 = T /q 3 and a feasible schedule for them (given the guesses for S 0 ); note that |S 0 ∪ S 1 | ≤ q 3 (since all of S 0 ∪ S 1 must fit in [0, T ]). For each such guess, their schedule projects a vector of blocked spaces (occupied time of machine). This will be vector v. The projection of v to each interval a 0,t will be v t which is the blocked area of a 0,t . Note that although v has up to q 3 blocks, each a 0,t can have at most q 2 blocks since each block has size at least 2 = T /q 3 and each a 0,t has size 0 = T /q. For all the other jobs in J 0 ∪ J 1 that have p j < 2 , because they are not position-crossing, we can assume their position (in the final solution) has intersection with only one interval of I 1 . For all these jobs of J 0 ∪ J 1 , we use the assumption that there is a near optimum solution in which they are not scheduled in their head or tail. So for the jobs in J 0 ∪ J 1 with processing time less than 2 we can re-define their span to a guessed interval of I 1 ; these guesses define the qc-dimensional vectors u t for each of the q sub-intervals of a 0,t at level I 1 (how many loose jobs from J 0 ∪ J 1 with p j < 2 have their span redefined to be one of sub-intervals of a 0,t ). The final solution will be max S0, where the max is taken over all guesses S 0 ⊆ J 0 , S 1 ⊆ J 1 and u t as described above.
To bound the size of the table, as argued before, we would have at most O(knq) many intervals in all of I 0 , I 1 , . . . , I k . For each of them we consider a table entry for at most n O(q 2 c) many vectors v, n O(qc) many vectors u. So the total size of the table would be (kq)n O(q 2 c) .
Like before, the base case is when interval a i,t has O(1) many release times and deadlines. These base cases A[a i,t , v, u] can be solved using Theorem 2 for each vector v and u.
To fill A[a i,t , v, u] in general (when 0 ≤ i ≤ k and 0 ≤ t ≤ T i and there are more than O(1) many release times and deadlines in a i,t ), suppose a i,t is divided into q many equal size intervals a i+1,t +1 , ..., a i+1,t +q in I i+1 . What we decide at this level is: make a decision for all the jobs j ∈ J i+2 ∩ J(a i,t ); those that are bigger than i+3 will be scheduled or dropped by making a guess; the rest we narrow down their span (guess) to be one of the lower level sub-intervals of a i,t and will be passed down as u to sub-problems below a i,t ; make a decision for jobs in u: those that are bigger than i+3 will be scheduled or dropped; the rest we narrow down their span (by a guess) to be one of the lower level sub-intervals of a i,t As in the case of I 0 , we need to guess a set of tight jobs from J i+2 ∩ J(a i,t ) and some loose jobs j with p j ≥ i+3 and their positions to be processed in a i,t (considering the blocked areas defined by v). Let S 0 with s 0 = |S 0 | be this guessed set. Note that s 0 ≤ q 3 since p j ≥ i+3 = i /q 3 . Also for each non-zero u γ,σ where p σ ≥ i+3 we guess how many of those u γ,σ many jobs should be scheduled and where exactly in a i+1,t +γ (consistent with v and S 0 ); let S 1 be this guessed subset and |S 1 | = s 1 . Note that s 0 + s 1 ≤ q 3 and there are at most |Ψ| 2q 3 possible guesses for S 0 and S 1 together with their positions; thus a total of n O(q 3 c) possible ways to guess S 0 ∪ S 1 and guess their locations in the schedule. Then for each possible pair of such guessed sets S 0 , S 1 we compute the resulting v ; this defines the space available for the rest of the jobs in J(a i,t ) ∩ J ≥i+3 , and those defined by u where p j < i+3 after blocking the space defined by v and the space occupied by the pair of guessed sets S 0 , S 1 above. We divide v into q many vectors v 1 , ..., v q , (as we divided a i,t into q intervals).
We also change u to u by setting all the entries of u γ,σ with p σ ≥ i+3 to zero and guess how to distribute u into q many (qc)-dimensional vectors u 1 , ..., u q such that u 1 + u 2 +...+ u q = u , where u γ is describing the number of jobs of different sizes whose span is re-defined to be one of the sub-intervals of a i+1,t +γ at level I i+2 . The number of ways to break u into u 1 , . . . , u q is bounded by n O(q 2 c) .
For all the other jobs in J i+2 ∩ J(a i,t ) that have p j < i+3 , because they are not positioncrossing, we can assume their position (in the final solution) has intersection with only one interval of I i+2 . We also use the assumption that there is a near optimum solution in which they are not scheduled in their head or tail. So for the jobs in J i+2 ∩ J(a i,t ) with processing time less than i+3 we can re-define their span to a guessed sub-interval of a i+1,t +γ at level I i+2 ; these guesses define the qc-dimensional vectors w γ for each interval a i+1,t +γ (how many loose jobs from J i+2 ∩ J(a i,t ) with p j < i+3 have their span redefined to be one of the q sub-intervals of a i+1,t +γ at level i + 2). Observe that, by only knowing how many of w σ many jobs with processing times p σ are scheduled in each interval a i+1,t +1 , ..., a i+1,t +q in the optimum solution, we would be able to detect which job is in which interval. The reason is that we know for each p σ ∈ P , all jobs with processing time p σ are scheduled based on earliest deadline first rule, which basically says that at any time when there are two jobs with the same processing time available the one with earliest deadline would be scheduled first.
Note that the jobs in J(a i,t ) ∩ J ≥(i+3) all have processing time at most i+3 and their spans are completely inside one of intervals a i+1,t +1 , ..., a i+1,t +q . These jobs will be passed down to the corresponding smaller sub-problems. So for each given v and u, we consider all guesses S 0 , S 1 and consider the resulting u , v and any possible way of breaking u , and w into q parts, we check: where s 0 , s 1 are the sizes of the subsets S 0 , S 1 of jobs with processing time p j ≥ i+3 guessed from J(a i,t ) ∩ J i+2 and those from u with processing time p j ≥ i+3 . We would choose the maximum over all guesses S 0 ⊆ J i+2 ∩ J(a i,t ), S 1 , and all possible ways to distribute jobs with p j < i+3 to create u γ and w γ as described above.
Note that to fill each entry A[a i,t , v, u] the number of jobs from J i+2 ∩ J(a i,t ) plus jobs from u with processing time bigger than i+3 possible to be processed in a i,t would be at most q 3 , because of their lengths. So we could have at most n O(q 3 c) many different v to consider. For u and w we would have at most n O(q 2 c) many ways to distribute each of them into q many qc-dimensional vectors. This means that we can fill the whole table in time at most Γkqn O(q 3 c) = n O(ε −6 c) log q T , where Γ is the running time of the PTAS for Theorem 2, which is at most 2 ε −1 log −4 (1/ε) + Poly(n). So the total time will be n O(ε −6 c) log T .
For extension to a constant number of machines please refer to the journal version of the paper.

Proof of Theorem 2
In this section we prove Theorem 2. We start by presenting a (1 − ε)-approximation algorithm for the case of m = 1 that runs in time Poly(n, p max ) where p max is the largest processing time, and then show how to extend it to a PTAS. We assume that r j 's comes from a set of size R, d j 's from a set of size D where R, D ∈ O (1). Also, we are given a vector v with , v i (f )) that specifies the start and end of a blocked interval over time in which the machine cannot be used. Our approach will be to find windows in the time-line where jobs can feasibly be scheduled in any order; these will be windows that do not contain any release time or deadline nor any blocked space. Each of these windows will be contained entirely between a pair of release times or deadlines or blocks defined by v, so we can schedule jobs in a window in any order. We call the pair of release time and deadline of a job its type Definition 11 (Types). We say a job j ∈ J is of type t = (u, v) if u is the release time of job j, r j , and if v is the deadline of job j, d j . We let T denote the set of all job types.
Since we assume R, D ∈ O(1), therefore |T | ≤ RD ∈ O(1). With these classifications, before scheduling individual jobs, we first guess how much processing time each job type t has in an optimal solution and use this guess as a budget for job processing times and maximize the number of jobs of type t scheduled given this budget. The number of such guesses will be at most O((np max ) |T | ) ∈ O((np max ) RD ).

If a release time r j is within a blocked interval (
Similarly if a deadline d j is within a blocked interval ( v i (s), v i (f )) we change d j to v i (s). We call the union of these release times and deadlines straddle points, which we denote by S. Note that |S| ≤ R + D ∈ O(1). We say a job j in a schedule straddles a straddle point if it starts before the straddle point and finishes after the straddle point (hence at the time of the straddle point the machine is busy with job j).
Let S be the union of v i (s)'s and v i (f )'s (i.e. start and end points of the blocked windows defined by v). For each point v i (s) ∈ S we assume there is a dummy job of size v i (f ) − v i (s) that is being run exactly at start point v i (s) until point v i (f ) and its position is fixed. We enumerate the points in S = S ∪ S so that s i ∈ S is the i th point in increasing order.
If the number of jobs in an optimum solution is smaller than S /ε = O((R + D + B)/ε) then we guess all these O(1) jobs and a permutation/schedule for them in optimum and this can be done in time n S /ε (S/ε)!. So let's assume otherwise. If we remove all the jobs in optimum that straddle a straddle point (i.e. span a release time or deadline), we incur a loss of at most |S | and we are left with a solution of value at least (1 − ε)opt. So there is a near optimum solution with no straddle job. Let us call such a near optimum solution O. Our goal is to find such a solution.
We define windows, which will denote the intervals where we schedule non-straddle jobs. The free interval between two consecutive points in S define a window, i.e. the free intervals between consecutive straddle points or between a dummy job and a straddle point. Let these windows be W. Note that there are at most R + D + B many windows. Before describing the algorithm, we will take the near optimal schedule O with no straddle jobs, and reschedule its jobs to nicely adhere to the definitions of straddle jobs and dummy jobs and allotments (total processing time allocated for each job type). We will also note that any feasible schedule can be left-shifted, meaning that the start time of any job is its release time or the end time of another job, or the start time of the interval right after a dummy job. This will then define canonical schedules that we can enumerate over in our algorithm. We will look at the schedule O and shift-left the jobs until either: (1) they hit their release time, or (2) hit the finish time of another job (dummy or not), or (3) hit another release time/deadline point. Let a * be the allotment of jobs in each window. Lastly, we have the following observation that will be important for finding optimal canonical schedules.

Observation 12.
Given the allotments a * , the problem of scheduling jobs of type t is independent of every other job type.
This last observation is important as it allows our algorithm to deal with each job type independently. This is clearly true since each job type has a specified allotment that jobs of that type can be scheduled in, and the allotments of two job types do not overlap. Given windows and allotments a i,t for each type t and window i we have to see what is the maximum number of jobs of type t that we can pack into these windows given the allotments for them in each window. This is a multiple knapsack problem.

Algorithm
The algorithm here is a sweep across all canonical schedules by iterating through the windows and allotments, combined with a Multiple Knapsack dynamic program to schedule jobs of each type in their corresponding allotments. For each window W i ∈ W we guess an optimal choice of allotments in W i , denoted a i , where a i,σ ∈ [0, np max ] is the allotment in the ith window for jobs of type σ. We check that this choice of allotments corresponds to a canonical schedule in W i by checking if the allotments can be scheduled feasibly as if they were jobs (as explained below). More specifically, we let window W 1 begin from the first straddle point s 1 and check that the point s 1 + |T | σ=1 a 1,σ is at most I) the next straddle point or II) start of a dummy job (whichever comes first), if not then the check fails as the allotments are too large to fit in the window. We then repeat this process from start of window W 2 and so on. We also check that for any a i,σ = 0, that the release time of type σ is before start of window i, and the deadline of type σ is at least end of this window, this ensures that when the jobs are scheduled in their allotments they are scheduled feasibly. We repeat this procedure for each window to get a choice of allotments a = { a i } i∈[ ] . If the checks succeed for each window then the allotments can correspond to a canonical schedule.
Note that for any fixed job type, the size of an allotment for that type in a given window is in [0, np max ], so there are O(np max ) many guesses for each job type in this window. There are at most (R + D + B) many windows and and RD job types, so there are at most (np max ) (R+D+B) 3 many allotment choices. With a choice of allotments that correspond to a canonical schedule, we apply Observation 12 to reduce the problem to solving an instance of the Multiple Knapsack problem for each job type. For the problem corresponding to jobs of type σ, say there is a knapsack m i corresponding to every window i, of size a i,σ , and for each job j of type σ there is a corresponding item, x j in the Multiple Knapsack problem, with weight equal to p j and profit of 1. Using a standard DP for the Multiple Knapsack problem with R + D + B many knapsacks, we can solve this problem in time O((np max ) (R+B+D) 3 ). This establishes the following lemma.

Lemma 13. This algorithm gives an (1 − ε)-approximation solution to Throughput
Maximization with a constant number of release times and deadlines and blocked intervals and runs in time (np max ) (R+B+D) 3 + n R+D/ε (R + D/ε)!.

A PTAS
If job sizes are not assumed to be bounded by a polynomial in n then the run-time of our algorithm has two problems. The first is that we make O(np max ) many guesses for each allotment. The second one, we exactly solve the Multiple Knapsack problem using an algorithm with run-time that is polynomial with respect to both n and p max . To deal with the first problem we use a rounding and buckeing procedure with 2 loss in the objective to reduce the number of guesses. To deal with the second problem, we use a PTAS for the Multiple Knapsack problem to find a schedule (e.g. [9,22]). To deal with the first problem we will use the following lemma, which states that given a (1 − ε)-optimal canonical schedule O with no straddle jobs, for each allotment a i,t , if the allotment has at least 1/ε 2 jobs then we can reduce the size of the allotment to the nearest power of (1 + ε) and drop jobs in order from largest to smallest until the remaining jobs can be scheduled entirely in this reduced allotment, at a loss of factor at most 1 − 2ε. Proof. Take a canonical schedule O. For a fixed window, if an allotment has at least α = 1/ε 2 jobs then we round down the size of the allotment to the nearest power of (1 + ε). We drop jobs in order of largest to smallest until the remaining jobs fit in the allotment.
We want to show that the fraction of jobs remaining after this rounding is at least 1 1+ε . The worst case for this fraction is when the jobs in this allotment is exactly α many jobs. Rounding the allotment size down to the nearest (1 + ε) power means that there will be at least α 1+ε jobs. If we let α = 1 ε 2 , the fraction of jobs remaining will be at least (1 − 2ε).
So the number of guesses we have to make for allotment of each job type in each window will reduce from O(np max ) to O(log(np max )). The algorithm we use will be similar to the pseudo-polynomial time algorithm. We will sweep across the windows as before, checking that they correspond to canonical schedules. To sweep across allotments, we will guess from both allotment sizes that are powers of (1 + ε) and that are equal to combinations of up to 1/ε 2 many job sizes. This reduces the number of guesses from (np max ) (R+D+B) 3 to (log(np max )) (R+D+B) 3 . The reduction to the Multiple Knapsack problem is the same but instead of the pseudo-polynomial time solution, we use the PTAS due to [22] which runs in time 2 ε −1 log −4 (1/ε) + Poly(n). The proof of the following is immediate. Proof. We know we restrict our choices of allotments to be either the case that the size of the allotment is some rounded value, or that are combinations of up 1/ε 2 many jobs. As we have shown in Lemma 14 this will give an allotment whose optimal packing is within 1 − 2ε of the optimal value for that job type and window.
Given this choice of allotments, a solution to Multiple Knapsack problems with constant many knapsacks with unit weighted jobs of arbitrary size can be solved using a PTAS due to [22]. Therefore, we find a solution that is at least a (1−ε)(1−2ε)(1−ε) = 1−O(ε) factor of the optimal solution where one 1 − ε factor is to assume there are no straddle jobs, on 1 − ε factor is due to use of a PTAS for the Multiple Knapsack problem, and the 1 − 2ε factor is due to the rounding up the guessed sizes of allotments to powers of 1 + ε. Total time will be (2 ε −1 log −4 (1/ε) + Poly(n))(log(np max )) (R+D+B) 3 = O(2 ε −1 log −4 (1/ε) + Poly(n)).
For extension to a constant number of machines please refer to the journal version of the paper.