A Fully Polynomial-Time Approximation Scheme for Speed Scaling with Sleep State

We study classical deadline-based preemptive scheduling of tasks in a computing environment equipped with both dynamic speed scaling and sleep state capabilities: Each task is specified by a release time, a deadline and a processing volume, and has to be scheduled on a single, speed-scalable processor that is supplied with a sleep state. In the sleep state, the processor consumes no energy, but a constant wake-up cost is required to transition back to the active state. In contrast to speed scaling alone, the addition of a sleep state makes it sometimes beneficial to accelerate the processing of tasks in order to transition the processor to the sleep state for longer amounts of time and incur further energy savings. The goal is to output a feasible schedule that minimizes the energy consumption. Since the introduction of the problem by Irani et al. [16], its exact computational complexity has been repeatedly posed as an open question (see e.g. [2,8,15]). The currently best known upper and lower bounds are a 4/3-approximation algorithm and NP-hardness due to [2] and [2,17], respectively. We close the aforementioned gap between the upper and lower bound on the computational complexity of speed scaling with sleep state by presenting a fully polynomial-time approximation scheme for the problem. The scheme is based on a transformation to a non-preemptive variant of the problem, and a discretization that exploits a carefully defined lexicographical ordering among schedules.


Introduction
As energy-efficiency in computing environments becomes more and more crucial, chip manufacturers are increasingly incorporating energy-saving functionalities to their processors.One of the most common such functionalities is dynamic speed scaling, where the processor is capable to dynamically adjust the speed at which it operates.A higher speed implies a higher performance, but this performance comes at the cost of a higher energy consumption.On the other hand, a lower speed results in better energy-efficiency, but at the cost of performance degradation.In practice, it has been observed [5,9] that the power consumption of the processor is approximately proportional to its speed cubed.However, even when the processor is idling, it consumes a non-negligible amount of energy just for the sake of "being active" (for example because of leakage current).Due to this fact, additional energy-savings can be obtained by further incorporating a sleep state to the processor, in addition to the speed-scaling capability.A sleep state is a state of negligible or even zero energy-consumption, to which the processor can transition when it is idle.Some fixed energy-consumption is then required to transition the processor back to the active state in order to continue processing.

Previous Work
The theoretical model for dynamic speed scaling was introduced in a seminal paper by Yao, Demers and Shenker [19].They developed a polynomial time algorithm called YDS, that outputs a minimum-energy schedule for this setting.Irani, Shukla and Gupta [16] initiated the algorithmic study of speed scaling combined with a sleep state.Such a setting suggests the so-called race to idle technique where some tasks are accelerated over their minimum required speed in order to incur a higher energy-saving by transitioning the processor to the sleep state for longer periods of time (see [3,11,12,18] and references therein for more information regarding the race to idle technique).Irani et al. developed a 2-approximation algorithm for speed scaling with sleep state, but the computational complexity of the scheduling problem has remained open.The first step towards attacking this open problem was made by Baptiste [7], who gave a polynomial time algorithm for the case when the processor executes all tasks at one fixed speed level, and all tasks are of unit-size.Baptiste's algorithm is based on a clever dynamic programming formulation of the scheduling problem, and was later extended to (i) arbitrarily-sized tasks in [8], and (ii) a multiprocessor setting in [10].
More recently, Albers and Antoniadis [2] improved the upper bound on the approximation ratio of the general problem, by developing a 4/3-approximation algorithm.With respect to the lower bound, [2] give an NP-hardness reduction from the partition problem.The reduction uses a particular power function that is based on the partition instance, i.e., it is considered that the power function is part of the input.The reduction of [2] was later refined by Kumar and Shannigrahi [17], to show that the problem is NP-hard for any fixed, non-decreasing and strictly convex power function.
The online setting of the problem has also been studied.Irani et al. [16] give a (2 2α−2 α α + 2 α−1+2 )-competitive online algorithm.Han et al. [13] improved upon this result by developing an (α α + 2)-competitive algorithm for the problem.Both of the above results assume a power function of the form P (s) = s α + β, where α > 1 and β > 0 are constants.
A more thorough discussion on the above scheduling problems can be found in the surveys [1,15].

Our Contribution
We study the offline setting of speed scaling with sleep state.Since the introduction of the problem by Irani et al. [16], its exact computational complexity has been repeatedly posed as an open question (see e.g.[2,8,15]).The currently best known upper and lower bounds are a 4/3approximation algorithm and NP-hardness due to [2] and [2,17], respectively.In this paper, we settle the open question regarding the computational complexity of the problem, by presenting a fully polynomial-time approximation scheme.
At the core of our approach is a transformation of the original preemptive problem into a non-preemptive problem, where each task is replaced by a polynomial number of pieces.At first sight, it may seem counterintuitive to transform a preemptive problem into a harder nonpreemptive problem, especially as Bampis et al. [4] show that (for the problem of speed scaling alone) the ratio between an optimal preemptive and an optimal non-preemptive solution on the same instance can be very high.However, this does not apply in our case, as we consider the non-preemptive problem on a modified instance (we seek to schedule each piece of a task non-preemptively and not the whole task itself).Furthermore, in our analysis, we make use of a particular lexicographic ordering, which exploits the advantages of preemption.More specifically, we design a dynamic program that outputs a schedule which is optimal among a restricted class of non-preemptive schedules.The definition of this class is based on a discretization of the time horizon by a careful choice of polynomially many time points.Roughly speaking, the class is comprised of these schedules that start and end the processing of each piece at such a time point, and satisfy a certain constraint regarding the processing order of the pieces.To prove that a near-optimal schedule in this class exists, we perform a series of transformations from a lexicographically minimal optimal schedule for the original problem to a schedule of the above class, while the energy consumption increases by at most a factor of (1 + ).The lexicographic ordering is crucial to ensure that we get the correct ordering among the pieces without further increasing the energy consumption.
We remark that Baptiste [7] used a dynamic program of similar structure for the case of unit-sized tasks and a fixed-speed processor equipped with a sleep state.This dynamic program is also based on a particular ordering of tasks, which, however, is not sufficient for our setting.Since we have pieces of different sizes, the swapping argument used in [7] is rendered impossible.
In Section 2, we describe the YDS algorithm from [19] for the problem of speed scaling without a sleep state, and then show several properties that a schedule produced by YDS has for our problem of speed scaling with sleep state.We then, in Section 3, define a particular class of schedules that have a set of desirable properties, and show that there exists a schedule in this class, whose energy consumption is within a (1 + )-factor from optimal.Finally, in Section 4, we develop an algorithm based on a dynamic program, that outputs, in polynomial time, a schedule of minimal energy consumption among all the schedules of the aforementioned class.

Preliminaries
We start by giving a short description of the YDS algorithm presented in [19].For any interval I, let B(I) be the set of tasks whose allowed intervals are within I. We define the density of I as Note that the average speed that any feasible schedule uses during interval I is no less than dens(I).YDS works in rounds.In the first round, the interval I 1 of maximal density is identified, and all tasks in B(I 1 ) are scheduled during I 1 at a speed of dens(I 1 ), according to the earliest deadline first policy.Then the tasks in B(I 1 ) are removed from the instance and the time interval I 1 is "blacked out".In general, during round i, YDS identifies the interval I i of maximal density (while disregarding blacked out times, and already scheduled jobs), and then processes all jobs in B(I i ) at a uniform speed of dens(I i ).YDS terminates when all jobs are scheduled, and its running time is polynomial in the input size.We remark that the speed used for the processing of jobs can never increase between two consecutive rounds, i.e., YDS schedules the tasks by order of non-increasing speeds.Furthermore, note that by the definition of YDS, all the tasks scheduled in each round i have their allowed interval within I i .
Given any job instance J , let F AST (J ) be the subset of J that YDS processes at a speed greater than or equal to s crit , and let SLOW (J ) := J \ F AST (J ).The following lemma is an extension of a fact proven by Irani et at.[16].
Lemma 1 For any job instance J , there exists an optimal schedule (w.r.t.speed scaling with sleep state) in which 1. Every task in F AST (J ) is processed according to YDS.
2. Every task k ∈ SLOW (J ) is run at a uniform speed s k ≤ s crit , and the processor never (actively) runs at a speed less than We call an optimal schedule with these properties a YDS-extension for J .
Proof: To break ties among schedules with equal energy consumption, we introduce the pseudo cost function s(t) 2 dt (this idea was first used in [16]).Consider a minimal pseudo cost schedule Y , so that Y satisfies property 1, and minimizes the energy consumption among all schedules fulfilling this property.It was shown in [16] that Y is optimal for instance J , and that under Y every task k ∈ SLOW (J ) is run at a uniform speed s k , and the processor never (actively) runs at a speed less than s k during those portions of [r k , d k ) where no job from FAST(J ) is processed.
( * ) It therefore remains to prove that the speeds s k are no higher than s crit .For the sake of contradiction, assume that there exists a job j ∈ SLOW (J ) which is processed at speed higher than s crit .Let I be a maximal time interval, so that (i) I includes at least part of the execution of j, and (ii) at any time point t ∈ I the processor either runs strictly faster than s crit , or executes a job from F AST (J ).Then there must exist a job k ∈ SLOW (J ) (possibly k = j) which is executed to some extent during I, and whose allowed interval is not contained in I (otherwise, when running YDS, the density of I after the jobs in F AST (J ) have been scheduled is larger than s crit , contradicting the fact that YDS processes all remaining jobs slower than s crit ).By the maximality of I, there exists some interval I ⊆ [r k , d k ) right before I or right after I, during which no job from F AST (J ) is executed, and the processor either runs with speed at most s crit or resides in the sleep state.The first case contradicts property ( * ), as k is processed during I and thus at speed s k > s crit .In the second case, we can use a portion of I to slightly slow down k to a new speed s , such that s crit < s < s k .The resulting schedule Y has energy consumption no higher than Y , as By the previous lemma, we may use YDS to schedule the jobs in F AST (J ), and need to find a good schedule only for the remaining jobs (which are exactly SLOW (J )).To this end, we transform the input instance J to an instance J , in which the jobs F AST (J ) are replaced by dummy jobs.This introduction of dummy tasks bears resemblance to the approach of [2].We then show in Lemma 3, that any schedule for J with a certain property, can be transformed to a schedule for J without any degradation in the approximation factor.
Consider the schedule S Y DS that algorithm YDS produces on J .Let I i = [y i , z i ), i = 1, . . ., be the i-th maximal interval in which S Y DS continuously runs at a speed greater than or equal to s crit , and let T 1 , . . ., T m be the remaining intervals in [0, d max ) not covered by intervals I 1 , I 2 , . . ., I .Furthermore, let T := ∪ 1≤k≤m T k .Note that the intervals I i and T i partition the time horizon [0, d max ), and furthermore, by the way YDS is defined, every job j ∈ F AST (J ) is active in exactly one interval I i , and is not active in any interval T i .The opposite does not necessarily hold, i.e., a job j ∈ SLOW (J ) may be active in several (consecutive) intervals I i and T i .We transform J to a job instance J as follows: • For every job j ∈ SLOW (J ), if there exists an i such that r j ∈ I i (resp.d j ∈ I i ), then we set r j := z i (resp.d j := y i ), else we keep the job as it is.
• For each I i , we replace all tasks j ∈ F AST (J ) that are active in I i by a single task j d i with release time at y i , deadline at z i and processing volume of max{1, Clearly, the above transformation can be done in polynomial time.Note that after the transformation, there is no release time or deadline in the interior of any interval I i .Furthermore, we have the following proposition: , and furthermore SLOW (J ) and F AST (J ) are disjoint sets, it suffices to show that (i) For (i), we observe that no task j d i can be feasibly scheduled at a uniform speed less than s crit .As YDS uses a uniform speed for each task, these jobs must belong to F AST (J ).
For (ii), consider the execution of YDS on J .More specifically, consider the first round when a job from SLOW (J ) is scheduled.Let I be the maximal density interval of this round, and let J S and J d be the sets of jobs from SLOW (J ) and {j d i : 1 ≤ i ≤ }, respectively, that are scheduled in this round (note that I contains the allowed intervals of these jobs).As the speed used by YDS is non-increasing from round to round, it suffices to show that dens(I) < s crit .
Consider a partition of I into maximal intervals Λ 1 , . . ., Λ a , s.t. each Λ k is contained in some interval I i or T i .Then , since no Λ k can have a density larger than dens(I) (because I is the interval of maximal density).It follows that Furthermore, by the definition of SLOW (J ), it is possible to schedule all tasks in J S during I ∩ T , at a speed slower than s crit (since none of the steps in the transformation from J to J reduces the time any task is active during T ).Together with the previous inequality, this implies dens(I) < s crit . 2 The following lemma suggests that for obtaining an FPTAS for instance J , it suffices to give an FPTAS for instance J , as long as we schedule the tasks j d i exactly in their allowed intervals I i .
Lemma 3 Let S be a schedule for input instance J , that (i) processes each task j d i exactly in its allowed interval I i (i.e. from y i to z i ), and (ii) is a c-approximation for J .Then S can be transformed in polynomial time into a schedule S that is a c-approximation for input instance J .
Proof: Given such a schedule S , we leave the processing in the intervals T 1 , . . ., T m unchanged, and replace for each interval I i the processing of job j d i by the original YDS-schedule S Y DS during I i .It is easy to see that the resulting schedule S is a feasible schedule for J .We now argue about the approximation factor.
Let OPT be a YDS-extension for J , and let OPT be a YDS-extension for J .Recall that E(•) denotes the energy consumption of a schedule (including wake-up costs).Additionally, let E I (S) denote the total energy consumption of S in all intervals I 1 , . . ., I without wake-up costs (i.e. the energy consumption for processing or being active but idle during those intervals), and define similarly E I (S ), E I (OP T ), and E I (OP T ) for the schedules S , OPT, and OPT , respectively.Since S is a c-approximation for J , we have Note that OPT schedules exactly the task j d i in each I i (using the entire interval for it) by Proposition 2, and thus each of the schedules S, S , OPT, and OPT keeps the processor active during every entire interval I i .Therefore since S and S have the same wake-up costs and do not differ in the intervals T 1 , . . ., T m .Moreover, as E(OP T ) − E I (OP T ) and E(OP T ) − E I (OP T ) are both equal to the optimal energy consumption during T , of any schedule that processes the jobs SLOW (J ) in T and resides in the active state during each interval I i (including all wake-up costs of the schedule).Clearly, E I (S) = E I (OP T ), and since both S and OPT schedule exactly the task j d i in each I i (using the entire interval for it), we have that E I (S ) ≥ E I (OP T ).Therefore Since YDS (when applied to J ) uses a speed of at least s crit for each interval I i , and furthermore processes a volume of at least v min = 1 in each such interval, OPT runs with an average speed of at least max{1/|I i |, s crit } in each I i .On the other hand, OPT runs with speed exactly max{1/|I i |, s crit } during I i , and therefore E I (OP T ) ≥ E I (OP T ). 2

Discretizing the Problem
After the transformation in the previous section, we have an instance J .In this section, we show that there exists a "discretized" schedule for J , whose energy consumption is at most 1 + times that of an optimal schedule for J .In the next section, we will show how such a discretized schedule can be found by dynamic programming.Before presenting formal definitions and technical details, we here first sketch the ideas behind our approach.
A major challenge of the original problem is that we need to deal with an infinite number of possible schedules.We overcome this intractability by "discretizing" the problem as follows: (1) we break each job in SLOW (J ) into smaller pieces, and (2) we create a set of time points and introduce the additional constraint that each piece of a job has to start and end at these time points.The number of the introduced time points and job pieces are both polynomial, which greatly limits the amount of guesswork we have to make in the dynamic program.The challenge is to both find such a discretization and argue that it does not increase the optimal energy consumption by too much.

Further Definitions and Notation
We first define the set W of time points.Given an error parameter > 0, let δ := min{ 1  4 , 4 P (scrit) P (2scrit)−P (scrit) }.Furthermore, let Consider the elements of W in sorted order, and let t i , 1 ≤ i ≤ |W | be i-th element of W in this order.We call an interval [t i , t i+1 ) for 1 ≤ i ≤ |W | − 1 a zone, and observe that every zone is either equal to some interval I i or contained in T .
For each i in 1, . . ., |W | − 1, let x(i) be the largest integer j so that We are now ready to define the set of time points W as follows: Figure 1: We assume that r = 1 . . .8 and that x(i) = 2.The red dashed points correspond to j = 1 and the blue dotted points to j = 2.For clarity, we drew the points defined from t i and from t i+1 in two separate pictures.Note that for each j the number of points is the same and the points of the same color are at equal distance from each other.
Let us explain how these time points in W come about.As we will show later (Lemma 8(2)), there exists a certain optimal schedule for J in which each zone [t i , t i+1 ) ⊆ T contains at most one contiguous maximal processing interval, and this interval "touches" either t i or t i+1 (or both).The geometric series (1 + δ) j 1 4n 2 scrit(1+δ) 1/δ of time points are used to approximate the ending/starting time of this maximal processing interval.For each guess of the ending/starting time, we split the guessed interval, during which the job pieces (to be defined formally immediately) are to be processed, into 16n 6 1/δ 2 (1 + 1/δ ) many intervals of equal length.An example of the set W for a given zone can be seen in Figure 1.
Note that |W | is polynomial in the input size and 1/ .

Definition 4
We split each task j ∈ SLOW (J ) into 4n 2 1/δ equal sized pieces, and also consider each job j d i as a single piece on its own.For every piece u of some job j, let job(u) := j, r u := r j , d u := d j , and v u := v j /(4n 2 1/δ ) if j ∈ SLOW (J ), and v u := v j otherwise.Furthermore, let D denote the set of all pieces from all jobs.
Note that |D| = + |SLOW (J )| • 4n 2 1/δ is polynomial in the input size and 1/ .We now define an ordering of the pieces in D.
Definition 5 Fix an arbitrary ordering of the jobs in J , s.t. for any two different jobs j and j , j ≺ j implies r j ≤ r j .Now extend this ordering to the set of pieces, s.t. for any two pieces u and u , there holds u ≺ u ⇒ job(u) job(u ).
We point out that any schedule for J can also be seen as a schedule for D, by implicitly assuming that the pieces of any fixed job are processed in the above order.
We are now ready to define the class of discretized schedules.
Definition 6 A discretized schedule is a schedule for J that satisfies the following two properties: (i) Every piece is completely processed in a single zone, and without preemption.
(ii) The execution of every piece starts and ends at a time point from the set W .
A discretized schedule S is called well-ordered if and only if (iii) For any time point t, such that in S a piece u ends at t, S schedules all pieces u u with d u ≥ t after t.
Finally, we define a particular ordering over possible schedules, which will be useful in our analysis.
Definition 7 Consider a given schedule.For every job j ∈ J , and every x ≤ v j , let c j (x) denote the earliest time point at which volume x of job j has been finished under this schedule.Furthermore, for any j ∈ J , we define be the jobs in J .A schedule S is lexicographically smaller than a schedule S if and only if it is lexicographically smaller with respect to the vector (q j1 , q j2 , . . ., q j |J | ).
Observe that shifting the processing interval of any fraction of some job j to an earlier time point (without affecting the other processing times of j) decreases the value of q j .

Existence of a Near-Optimal Discretized Schedule
In this section, we show that there exists a YDS-extension for J with certain nice properties (recall that a YDS-extension is an optimal schedule satisfying the properties of Lemma 1), that such a YDS-extension can be transformed into a well-ordered discretized schedule, and that the speed of the latter, at all time, is at most (1 + δ) 3 times that of the former.This fact essentially guarantees the existence of a well-ordered discretized schedule with energy consumption at most 1 + that of an optimal schedule for J .
Lemma 8 Let OPT be a lexicographically minimal YDS-extension for J .Then the following hold: 1. Every task j d i is scheduled exactly in its allowed interval I i .

Every zone [t i , t i+1 ) ⊆ T has the following two properties:
(a) There is at most one contiguous maximal processing interval within [t i , t i+1 ), and this interval either starts at t i and/or ends at t i+1 .We call this interval the block of zone [t i , t i+1 ).(b) OPT uses a uniform speed of at most s crit during this block.
3. There exist no two jobs j j, such that a portion of j is processed after some portion of j , and before d j . Proof: , and OPT is a YDS-extension, it follows that each j d i is processed exactly in its allowed interval I i .2. (a) Assume for the sake of contradiction that [t i , t i+1 ) ⊆ T contains a number of maximal intervals N 1 , N 2 , . . ., N ψ (ordered from left to right2 ) during which jobs are being processed, with ψ ≥ 2. Let M 1 , M 2 , . . ., M ψ (again ordered from left to right) be the remaining maximal intervals in [t i , t i+1 ), so that N 1 , . . ., N ψ and M 1 , . . ., M ψ partition the zone [t i , t i+1 ).Furthermore, note that for each i = 1, . . ., ψ , the processor is either active but idle or asleep during the whole interval M i , since otherwise setting the processor asleep during the whole interval M i would incur a strictly smaller energy consumption.
We modify the schedule by shifting the intervals N i , i = 2, . . ., ψ to the left, so that N 1 , N 2 , . . ., N ψ now form a single contiguous processing interval.The intervals M k lying to the right of N 1 are moved further right and merge into a single (longer) interval M during which no tasks are being processed.If the processor was active during each of these intervals M k , then we keep the processor active during the new interval M , else we transition it to the sleep state.We observe that the resulting schedule is still a YDS-extension (note that its energy consumption is at most that of the initial schedule), but is lexicographically smaller.
For the second part of the statement, assume that there exists exactly one contiguous maximal processing interval N 1 within [t i , t i+1 ), and that there exist two M -intervals, M 1 and M 2 before and after N 1 , respectively.We consider two cases: Note that in this case the processor was asleep during M 1 .The schedule remains a YDS-extension, but its energy consumption becomes strictly smaller: (i) either the processor was asleep during M 2 , in which case the resulting schedule uses the same energy while the processor is active but has one wake-up operation less, or (ii) the processor was active and idle during M 2 , in which case the resulting schedule saves the idle energy that was expended during M 2 .(b) The statement follows directly from the second property of Lemma 1 and the fact that all tasks processed during [t i , t i+1 ) belong to SLOW (J ) and are active in the entire zone.
3. Assume for the sake of contradiction that there exist two jobs j j, such that a portion of j is processed during an interval We first observe that both jobs belong to SLOW (J ).This follows from the fact that both jobs are active during the whole interval [ζ 1 , ζ 2 ), and processed during parts of this interval, whereas any job j d i (which are the only jobs in F AST (J )) is processed exactly in its entire interval [y i , z i ) (by statement 1 of the lemma).By the second property of Lemma 1, both j and j are processed at the same speed.We can now apply a swap argument.).Given the above observations, it can be easily verified that the resulting schedule (i) is feasible and remains a YDS-extension, and (ii) is lexicographically smaller than OPT.

2
The next lemma shows how to transform the lexicographically minimal YDS-extension for J of the previous lemma into a well-ordered discretized schedule.This is the most crucial part of our approach.Roughly speaking, the transformation needs to guarantee that (1) in each zone, the volume of a job j ∈ SLOW (J ) processed is an integer multiple of v j /(4n 2 1/δ ) (this is tantamount to making sure that each zone has integral job pieces to deal with), (2) the job pieces start and end at the time points in W , and (3) all the job pieces are processed in the "right order".As we will show, the new schedule may run at a higher speed than the given lexicographically minimal YDS-extension, but not by too much.
Lemma 9 Let OPT be a lexicographically minimal YDS-extension for J , and let s S (t) denote the speed of schedule S at time t, for any S and t.Then there exists a well-ordered discretized schedule F , such that at any time point t ∈ T , there holds and for every t / ∈ T , there holds Proof: Through a series of three transformations, we will transform OPT to a well-ordered discretized schedule F , while upper bounding the increase in speed caused by each of these transformations.More specifically, we will transform OPT to a schedule F 1 satisfying (i) and (iii) of Definition 6, then F 1 to F 2 where we slightly adapt the block lengths, and finally F 2 to F which satisfies all three properties of Definition 6.Each of these transformations can increase the speed by at most a factor (1 + δ) for any t ∈ T and does not affect the speed in any interval I i .Transformation 1 (OPT → F 1 ): We will transform the schedule so that (i) For each task j ∈ SLOW (J ), an integer multiple of v j /(4n2 1/δ ) volume of job j is processed in each zone, and the processing order of jobs within each zone is determined by ≺.Together with property 1 of Lemma 8, this implies that F 1 (considered as a schedule for pieces) satisfies Definition 6(i).
(ii) The well-ordered property of Definition 6 is satisfied.
(iii) For all t ∈ T it holds that s F1 (t) ≤ (1 + δ)s OP T (t), and for every t / ∈ T it holds that s F1 (t) = s OP T (t).
Note that by Lemma 8, every zone is either empty, filled exactly by a job j d i , or contains a single block.For any task j ∈ SLOW (J ), and every zone [t i , t i+1 ), let V i j be the processing volume of task j that OPT schedules in zone [t i , t i+1 ).Since there can be at most 2n different zones, for every task j there exists some index h(j), such that V h(j) j ≥ v j /(2n).For every task j ∈ SLOW (J ), and every i = h(j), we reduce the load of task j processed in [t i , t i+1 ), by setting it to Finally, we set the volume of j processed in [t h(j) , t h(j)+1 ) to V h(j) j = v j − i =h(j) V i j .To keep the schedule feasible, we process the new volume of each non-empty zone [t i , t i+1 ) ⊆ T in the zone's original block B i , at a uniform speed of j∈SLOW (J ) (V i j )/|B i |.Here, the processing order of the jobs within the block is determined by ≺.
Note that in the resulting schedule F 1 , a job may be processed at different speeds in different zones, but each zone uses only one constant speed level.
It is easy to see that F 1 is a feasible schedule in which for each task j ∈ SLOW (J ), an integer multiple of v j /(4n 2 1/δ ) volume of j is processed in each zone, and that V i j ≤ V i j for all i = h(j).Furthermore, if i = h(j), we have that V i j − V i j ≤ v j /(2n 1/δ ), and V i j ≥ v j /(2n).It follows that V i j ≤ V i j + V i j / 1/δ ≤ (1 + δ)V i j in this case, and therefore s F1 (t) ≤ (1 + δ)s OP T (t) for all t ∈ T .We note here, that for every task j d i , and the corresponding interval I i , nothing changes during the transformation.
We finally show that F 1 satisfies the well-ordered property of Definition 6. Assume for the sake of contradiction that there exists a piece u ending at some t, and there exists a piece u u with d u ≥ t that is scheduled before t.Recall that we can implicitly assume that the pieces of any fixed job are processed in the corresponding order ≺.Therefore job(u ) job(u), by definition of the ordering ≺ among pieces.Furthermore, if [t k , t k+1 ) and [t k , t k +1 ) are the zones in which u and u , respectively, are scheduled, then k < k, as k = k would contradict F 1 's processing order of jobs inside a zone.Also note that d u ≥ t k+1 , since t ∈ (t k , t k+1 ], and (t k , t k+1 ) does not contain any deadline.This contradicts property 3 of Lemma 8, as the original schedule OPT must have processed some volume of job(u ) in [t k , t k +1 ), and some volume of job(u) in [t k , t k+1 ).
Transformation 2 (F 1 → F 2 ): In this transformation, we slightly modify the block lengths, as a preparation for Transformation 3.For every non-empty zone [t i , t i+1 ) ⊆ T , we increase the uniform speed of its block until it has a length of (1 + δ) j this zone was at most (1 + δ)s crit .The speedup needed for this modification is clearly at most (1 + δ).
As this transformation does not change the processing order of any pieces nor the zone in which any piece is scheduled, it preserves the well-ordered property of Definition 6.
Transformation 3 (F 2 → F ): In this final transformation, we want to establish Definition 6(ii).To this end, we shift and compress certain pieces in F 2 , such that every execution interval starts and ends at a time point from W (this is already true for pieces corresponding to tasks j d i ).The procedure resembles a transformation done in [14].For any zone [t i , t i+1 ) ⊆ T , we do the following: Consider the pieces that F 2 processes within the zone [t i , t i+1 ), and denote this set of pieces by D i .If D i = ∅, nothing needs to be done.Otherwise, let β be the integer such that (1 + δ) β 1 4n 2 scrit(1+δ) 1/δ is the length of the block in this zone, and let Note that in the definition of W , we introduced 16n 6 1/δ 2 (1 + 1/δ ) many time points (for j = β and r = 1, . . ., 16n 6 1/δ 2 (1+ 1/δ )) that subdivide this block into 16n 6 1/δ 2 (1+ 1/δ ) intervals of length ∆.Furthermore, since |D i | ≤ 4n 3 1/δ , there must exist a piece u ∈ D i with execution time Γ u ≥ 4n 3 1/δ (1 + 1/δ )∆.We now partition the pieces in D i \ u into D + , the pieces processed after u, and D − , the pieces processed before u.First, we restrict our attention to D + .Let q 1 , . . ., q |D + | denote the pieces in D + in the order they are processed by F 2 .Starting with the last piece q |D + | , and going down to q 1 , we modify the schedule as follows.We keep the end of q |D + | 's execution interval fixed, and shift its start to the next earlier time point in W , reducing its uniform execution speed accordingly.At the same time, to not produce any overlappings, we shift the execution intervals of all q k , k < |D + | by the same amount to the left (leaving their lengths unchanged).Eventually, we also move the execution end point of u by the same amount to the left (leaving its start point fixed).This shortens the execution interval of u and "absorbs" the shifting of the pieces in D + (note that the processing speed of u increases as its interval gets shorter).We then proceed with q |D + |−1 , keeping its end (which now already resides at a time point in W ) fixed, and moving its start to the next earlier time point in W . Again, the shift propagates to earlier pieces in D + , which are moved by the same amount, and shortens u's execution interval once more.When all pieces in D + have been modified in this way, we turn to D − and apply the same procedure there.This time, we keep the start times fixed and instead shift the right end points of the execution intervals further to the right.As before, u "absorbs" the propagated shifts, as we increase its start time accordingly.After this modification, the execution intervals of all pieces in D i start and end at time points in W .
To complete the proof, we need to argue that the speedup of piece u is bounded by a factor (1 + δ).Since |D i | ≤ 4n 3 1/δ , u's execution interval can be shortened at most 4n 3 1/δ times, each time by a length of at most ∆.Furthermore, recall that the execution time of u was Γ u ≥ 4n 3 1/δ (1 + 1/δ )∆.Therefore, its new execution time is at least Γ u − 4n 3 1/δ ∆ ≥ Γ u − Γu 1+ 1/δ , and the speedup factor thus at most Again, the transformation does not change the processing order of any pieces nor the zone in which any piece is scheduled, and thus preserves the well-ordered property of Definition 6. 2 We now show that the speedup used in our transformation does not increase the energy consumption by more than a factor of 1 + .To this end, observe that for any t ∈ T , the speed of the schedule OPT in Lemma 9 is at most s crit , by Lemma 8 (2).Furthermore, note that the final schedule F has speed zero whenever OPT has speed zero.This allows F to use exactly the same sleep phases as OPT (resulting in the same wake-up costs).It therefore suffices to prove the following lemma, in order to bound the increase in energy consumption.
-By Definition 6(i), in a discretized schedule, a piece has to be processed completely inside a zone [t i , t i+1 ) (recall that t i ∈ W are the release times and deadlines of the jobs).Therefore, in the right guess, the interior of [b, e) does not contain any release times or deadlines; more precisely, there is no time point t i ∈ W so that b < t i < e. -By Definition 6(iii), in a well-ordered discretized schedule, if piece u k ends at time point e, then all pieces u u k with deadline d u ≥ e are processed after u k .However, consider the guess [b, e), where e = d u for some u u k (notice that the previous case does not rule out this possibility).Then u cannot be processed anywhere in a well-ordered schedule.Thus, such a guess [b, e) cannot be right.
By the preceding discussion, if the guess (b, e) is right, the two sets of pieces {u u k+1 : τ 1 < d u ≤ b} and {u u k+1 : e < d u ≤ τ 2 }, along with piece u k , comprise all pieces to be processed that are required by the definition of E k (τ 1 , τ 2 ).Clearly, the former set of pieces {u u k+1 : τ 1 < d u ≤ b} has to be processed in the interval [τ 1 , b); the latter set of pieces, in a well-ordered schedule, must be processed in the interval [e, τ 2 ) if [b, e) is the correct guess for the execution of the piece u k .We therefore have that  The correctness of the DP follows from an inductive argument.It can be verified that the running time of the DP is polynomial in the input size and 1/ .The minimum energy consumption for the target schedule is E 1 (0, d max ).
Theorem 13 There exists a fully polynomial-time approximation scheme (FPTAS) for speed scaling with sleep state.
Proof: Given an arbitrary instance J for speed scaling with sleep state, we can transform it in polynomial time to an instance J , as seen in Section 2. We then apply the dynamic programming algorithm that was described in this section to obtain a well-ordered discretized schedule S of minimal energy consumption for instance J .By Lemma 11, we have that S is a (1 + )-approximation for instance J .Furthermore, note that every discretized schedule (and therefore also S ) executes each task j d i exactly in its allowed interval I i = [y i , z i ).This holds because there are no time points from the interior of I i included in W , and any discretized schedule must therefore choose to run j d i precisely from y i ∈ W to z i ∈ W .Therefore, by Lemma 3, we can transform S to a schedule S in polynomial time and obtain a (1 + )approximation for J . 2 Let L := min{|Z|, |Z |}.Note that OPT schedules only j during [ζ 2 − L, ζ 2 ) and only j during [ζ 2 − L, ζ 2 ).Swap the part of the schedule OPT in [ζ 2 −L, ζ 2 ) with the schedule in the interval [ζ 2 −L, ζ 2
• The processor is active just before t i , or the processor is asleep both just before t i and just after t i+1 : In this case we can shift N 1 left by |M 1 | time units, so that it starts at t i .Again, we keep the processor active during [t i + |N 1 |, t i+1 ) only if it was active during both M 1 and M 2 .As before, the resulting schedule remains a YDS-extension, and is lexicographically smaller.• The processor is in the sleep state just before t i but active just after t i+1 : In this case we shift N 1 by |M 2 | time units to the right, so that its right endpoint becomes t i+1 .During the new idle interval [t i , t i +|M 1 |+|M 2 |) we set the processor asleep.