Peak Demand Minimization via Sliced Strip Packing

We study Nonpreemptive Peak Demand Minimization (NPDM) problem, where we are given a set of jobs, specified by their processing times and energy requirements. The goal is to schedule all jobs within a fixed time period such that the peak load (the maximum total energy requirement at any time) is minimized. This problem has recently received significant attention due to its relevance in smart-grids. Theoretically, the problem is related to the classical strip packing problem (SP). In SP, a given set of axis-aligned rectangles must be packed into a fixed-width strip, such that the height of the strip is minimized. NPDM can be modeled as strip packing with slicing and stacking constraint: each rectangle may be cut vertically into multiple slices and the slices may be packed into the strip as individual pieces. The stacking constraint forbids solutions where two slices of the same rectangle are intersected by the same vertical line. Nonpreemption enforces the slices to be placed in contiguous horizontal locations (but may be placed at different vertical locations). We obtain a $(5/3+\epsilon)$-approximation algorithm for the problem. We also provide an asymptotic efficient polynomial-time approximation scheme (AEPTAS) which generates a schedule for almost all jobs with energy consumption $(1+\epsilon)OPT$. The remaining jobs fit into a thin container of height $1$. The previous best for NPDM was 2.7 approximation based on FFDH [Ranjan et al. 2015]. One of our key ideas is providing several new lower bounds on the optimal solution of a geometric packing, which could be useful in other related problems. These lower bounds help us to obtain approximative solutions based on Steinberg's algorithm in many cases. In addition, we show how to split schedules generated by the AEPTAS into few segments and to rearrange the corresponding jobs to insert the thin container mentioned above.


Introduction
Recent years have seen a substantial increase in the demand of electricity, due to rapid urbanization, economic growth and new modes of electrical energy consumption (e.g., electric cars).Traditionally, electricity generation, transmission, and distribution relied on building infrastructure to support the peak load, when the demand for electricity is maximum.
However, the peak is rarely achieved and thus more demands can be accommodated using the inherent flexibility of scheduling of certain jobs.E.g., energy requirements for HVAC unit, electric vehicle, washer and dryer, water heater, etc. can be met with a flexible scheduling of these appliances.Smart-grids [47, 31,44] are next-generation cyber-physical systems that couple digital communication systems on top of the existing grid infrastructure for such efficient utilization of power, e.g., by shifting users' demand to off-peak hours in order to reduce peak load.
Future smart-grids are expected to obtain demand requirements for a time period and schedule the jobs such that the peak demand is minimized.Recently, this problem has received considerable attention [3,36,39,41,12].Each job can also be modeled as a rectangle, with desired power demand as height and required running time as width.This gives a geometric optimization problem where the goal is to pack the slices of the rectangles into a strip of width as the time period.The goal is to minimize the maximum height of the packing.There is another additional stacking constraint requiring that no vertical line may intersect two slices from the same rectangle.
In this paper, we study this problem known as Nonpreemptive Peak Demand Minimization (NPDM)).Formally, we are given a set of jobs J .Each job j ∈ J has a processing time p(j) ∈ N (also called width) and an energy requirement e(j) ∈ N (also called height).Furthermore, we are given a deadline D ∈ N.All the jobs are available from the time 0 and have to be finished before the deadline D. A schedule σ of the jobs J assigns each job a starting time σ(j) ∈ N such that it is finished before the deadline, i.e., c(j) := σ(j) + p(j) ≤ D. The total energy consumption at a time τ ∈ {0, . . ., D} is given by e(τ ) := j∈J ,σ(j)≤τ <σ(j)+p(j) e(j).The objective is to minimize the peak of energy consumption, i.e., minimize T σ := max τ ∈{0,...,D−1} e(τ ).
NPDM can be viewed as a variant of strip packing problem, where we are allowed to slice the rectangles vertically and the slices must be packed in contiguous horizontal positions (but may be placed at different vertical positions).In the classical strip packing problem, we are given a set of rectangles as well as a bounded-width strip and the objective is to find a non-overlapping, axis-aligned packing of all rectangles into the strip so as to minimize the height of the packing.A simple reduction from partition problem shows a lower bound of 3/2 for polynomial-time approximation for the problem.In 1980, Baker et al. [4] first gave a 3-approximation algorithm.Later Coffman et al. [30] introduced two simple shelf-based algorithms: Next Fit Decreasing Height (NFDH), First Fit Decreasing Height (FFDH), with approximation ratios as 3 and 2.7, respectively.Sleator [45] gave a 2.5-approximation.Thereafter, Steinberg [46] and Schiermeyer [43] independently improved the approximation ratio to 2. Afterwards, Harren and van stee [20] obtained a 1.936-approximation.The present best approximation is (5/3 + ε), due to Harren et al. [19].
Alamdari et al. [3] studied a variant where we allow preemption of jobs, also known as two-dimensional strip packing with slicing and stacking constraints (2SP-SSC), or preemptive offline cost optimal scheduling problem (P-OCOSP) [40].They showed this variant to be NP-hard and obtained an FPTAS.They also studied several shelf-based algorithms and provide a practical polynomial time algorithm that allows only one preemption per job.Ranjan et al. [41] proposed a practical 4/3-approximation algorithm for this problem.
For NPDM, Tang et al. [47] first proposed a 7-approximation algorithm.Yaw et al. [48] showed that NPDM is NP-hard to approximate within a factor better than 3/2.They have given a 4-approximation for a special case when all jobs require the same execution time.Ranjan et al. [39], have proposed a 3-approximation algorithms for NPDM.They [40] also proposed an FFDH-based 2.7-approximation algorithm for a mixed variant where some jobs can be preempted and some can not be preempted.

Our Contributions
We obtain improved approximation algorithms for NPDM.Note that the optimal solutions of sliced strip packing/NPDM and strip packing can be quite different.In fact, in [9] an example with a ratio 5/4 is presented.Thus, the techniques from strip packing does not always translate directly to our problem.We exploit the property that, due to slicing, we can separately guess regions (profile) for packing of jobs with large energy demand (tall jobs) and jobs with large time requirements (wide jobs).We show that we can remove a small amount of jobs with large energy demand so that we can approximately guess the optimal profile of jobs with large processing time so that their starting positions come from a set containing a constant number of values.This helps us to show the existence of a structured solution that we can pack near-optimally using linear programs.This shows the existence of an asymptotic efficient polynomial-time approximation scheme (AEPTAS): ▶ Theorem 1.For any ε > 0, there is an algorithm that schedules all jobs such that the peak load is bounded by (1 + ε)OPT + e max .The time complexity of this algorithm is bounded by In fact we show here a slightly stronger results providing a schedule for almost all jobs J \ C with peak load bounded by (1 + ε)OPT plus a schedule for the remaining jobs C with peak load e max and schedule length λD for a sufficiently small λ ∈ [0, 1].
Previously, in strip packing (and related problems) the lower bound on the optimal height is given based on the height of the tallest job or the total area of all jobs [46,43].One of our main technical contributions is to show several additional lower bounds on the optimal load.These bounds may be helpful in other related geometric problems.In fact, these can be helpful to simplify some of the analyses of previous algorithms.Using these lower bounds, we show, intuitively, if there is a large amount of tall jobs (or wide jobs) we can obtain a good packing using Steinberg's algorithm.Otherwise, we start with the packing from AEPTAS and modify the packing to obtain a packing within (5/3 + ε)-factor of the optimal.This repacking utilizes novel insights about the structure of the packing that precedes it, leading to a less granular approach when repacking.

Related Work
Strip packing has also been studied under asymptotic approximation.The seminal work of Kenyon and Rémila [33] provided an APTAS with an additive term O(e max /ε 2 ), where e max is the height of the tallest rectangle.The latter additive term was subsequently improved to e max by Jansen and Solis-Oba [27].Pseudo-polynomial time algorithm for strip packing has received recent attention [38,18,2,21].Finally, Jansen and Rau [26] gave an almost tight pseudo-polynomial time (5/4 + ε)-approximation algorithm.Recently, Galvez et al. [14] gave a tight (3/2 + ε)-approximation algorithm for a special case when all rectangles are skewed (each has either width or height ≤ δD, where δ ∈ (0, 1] is a small constant).
A related problem is non-contiguous multiple organization packing [10], where the width of each rectangle represents a demand for a number of concurrent processors.This is similar to sliced strip packing, however, the slices need to be horizontally aligned to satisfy concurrency.Several important scheduling problems are related such as multiple strip packing [26], malleable task scheduling [22], parallel task scheduling [28], moldable task scheduling [23,24], etc.
Several geometric packing problems are well-studied in combinatorial optimization.In two-dimensional bin packing, we are given a set of rectangles and the goal is to pack all rectangles into the minimum number of unit square bins.This well-studied problem [5,25] is known to admit no APTAS [6], unless P=NP, and the present best approximation ratio is 1.406 [7].Another related problem is two-dimensional geometric knapsack [29,16], where each rectangle has an associated profit and we wish to pack a maximum profit subset of rectangles in a given square knapsack.The present best approximation ratio for the problem is 1.89 [15].These problems are also studied under guillotine cuts [8,35,34] where all jobs can be cut out by a recursive sequence of end-to-end cuts.There are several other important related problems such as maximum independent set of rectangles [1], unsplittable flow on a path [17], storage allocation problem [37], etc.We refer the readers to [13] for a recent survey of the area.

Preliminaries
Notation.We denote by OPT(I) (or just OPT) the optimal energy consumption peak.
For some set of jobs J we define work(J ) = i∈J p(i)e(i), the total processing time as p(J ) = i∈J p(i), as well as the total energy demand as e(J ) = i∈J e(i).With the additional notation of J P (i) = { i ∈ J | P (i) } as a restriction of J using the predicate P .E.g., we may express the energy demand time of jobs of J which have a processing time of at least D/2 by e(J p(i)≥D/2 ).Furthermore, given a set of jobs J , we denote p max (J ) := max i∈J p(i) and e max (J ) := max i∈J e(i) and write e max and p max if the set of jobs is clear from the context.We say a job i that is placed at σ(i) overlaps a point in time τ if and only if σ(i) ≤ τ < σ(i) + p(i).The set J (τ ) denotes the set of jobs that overlap the point in time τ .Additionally, we introduce segments S of the schedule which refer to time intervals and container C which can be seen as sub schedules.The starting point of a time interval S will be denoted by σ(S) and its endpoint as c(S).On the other hand, a container C has a length (time), which is denoted as p(C), and a bound on the energy demand e(C).If these containers are scheduled, the get a start point σ(C), which is added to the start point of any job scheduled in C.

Steinberg's Algorithm.
Steinberg's algorithm [46] will be a crucial subroutine in our algorithms.
▶ Theorem 3 (Steinberg [46]).Steinberg's algorithm packs a set of rectangular objects R into a rectangular container of height a and width b in polynomial time, if and only if the following inequalities hold: (Steinberg's Cond.)where x + = max{x, 0}, p max is the maximal width of a rectangle, and e max is the maximal height of a rectangle, e(r) represents the height of a rectangle and p(r) represents the width of a rectangle.

Finding a lower bound on OPT
In this section, we first bound the optimal schedule height from below and then use Steinberg's algorithm to handle some cases.Two obvious lower bounds are the height of the tallest job e max and the bound given by the total area of the jobs, i.e., OPT ≥ max{e max , work(J )/D}.Another simple lower bound is the total height of jobs wider than D/2, since they cannot be placed next to each other.This gives us the first lower bound on OPT and we call it T 1 := max{e max , work(J )/D, e(J p(i)>D/2 )}.In the following, we will present three more complex lower bounds.Note that we can find this smallest value in O(n log n) by starting with T = T 1 and as long as p(J e(i)≥1/3T ) + p(J e(i)≥2/3T ) > 2D or p(J e(i)>T /2 ) > D update T as follows: For l ∈ [0, 1], denote by e l the height of the smallest job in J e(i)>l•T and set T := min{3e 1/3 , (3/2)e 2/3 , 2e 1/2 }.This iteratively excludes one job from one of the three sets.We denote this lower bound as

Second bound
Next, we obtain a bound based on a set of jobs that do not overlap vertically in a given optimal schedule.▶ Lemma 7. Consider an optimal schedule and let J seq be a set of jobs such that no pair of jobs i, i ′ ∈ J seq overlaps vertically, i.e., σ(i)+p(i) ≤ σ(i ′ ) or σ(i ′ )+p(i ′ ) ≤ σ(i).Furthermore, define J w := J p(i)>(D−p(Jseq)/2) \ J seq .Then there exists a vertical line through the schedule that intersects a job in J seq and all the jobs in J w .
Proof.First note that (D − p(J seq )/2) ≥ D/2.Consider the vertical strip between p(J seq )/2 and (D − p(J seq ))/2.Each job in J w completely overlaps this strip.Furthermore, either the strip itself contains a job in J seq , in which case the claim is trivially true, or on each position on both sides of the strip there is a job from J seq .Assume the later case.Since the jobs in J w have a width strictly larger than (D − p(J seq )/2), there exists an σ > 0 such that the vertical line at (D − p(J seq )/2) + σ as well is overlapped by all the jobs in this set.Since this line intersects also a job from the set J seq , the claim follows.◀ ▶ Corollary 8. Let J seq be a set of jobs such that p(J seq ) ≤ D and consider J w := J p(i)>D−p(Jseq)/2 \ J seq .Furthermore let i ⊥ ∈ J seq be the job with the smallest height.
Proof.Consider an optimal solution.We have to consider two cases.In the first case, two jobs from the set J seq intersect the same vertical line.In this case, 2e(i ⊥ ) is obviously a lower bound on OPT.
On the other hand, if in any optimal schedule there does not exist a pair of jobs from J seq that overlap the same vertical line, we know by Lemma 7 that there exists a job in J seq that overlaps with all the jobs in J w and therefore OPT ≥ e(i ⊥ ) + e(J w ) in this case.◀ From Corollary 8, we derive a lower bound on OPT.For a given k ∈ [n], we define J k to be the set of the k jobs with the largest energy demand in J and J ′ k to be the set of the k jobs with the largest energy demand in J \ J p(i)>D/2 .Let i k and i ′ k be the jobs with the smallest height in J k and J ′ k , respectively.We define: and For this lower bound, we prove the following property.
▶ Lemma 9. Let T = max{T 1 , T 2 , T 3 }, w ∈ (0, 1/2) and h ∈ (1/2, 1] as well as J h := J e(i)≥hT and J w : Furthermore, note that J h = J e(i)≥e(j) for the job j with the smallest height in Therefore for the smallest job j ∈ J h , it holds that e(j) + e(J p(i)>D−p(J h )/2 ) ≤ T.

For contradiction assume that p(J
As a consequence

Third bound
▶ Lemma 11.Consider an optimal schedule and let J seq ⊆ J be a set of jobs such that no pair of jobs j, j ′ ∈ J seq overlaps vertically, i.e., σ(j Then there exists a vertical line through the schedule that intersects a job in J seq and a subset Proof.First, we consider the trivial cases.If a job from J seq overlaps the vertical line at D/2 the claim is trivially true, since all the jobs from J D overlap D/2.On the other hand, if all the jobs in J seq are left or right of D/2, it holds that p(J seq ) ≤ D/2 and one of the jobs has a distance of at most D/2 − p(J seq ) from D/2.This job has to be overlapped by all the jobs from J D since they have a width larger than D − p(J seq ).
Otherwise, consider the vertical line L l through the right border of the rightmost job from J seq that is left of D/2 and the vertical line L r through the left border of the leftmost job from J seq that is right of D/2.Note that L l and L r have a distance of at most (D − p(J seq )).Consider the set J D,l ⊆ J D that is intersected by the vertical line L l .Note that the residual jobs in J D,r := J D \ J D,l all overlap the vertical line at L l + (D − p(J seq )) ≥ L r and hence L r as well.Since J D,r ∪ J D,l = J D , one of the two sets has a height of at least e(J D )/2.Finally, note that there exists a small enough σ > 0 such that L l − σ and L r + σ overlap the same set of wide jobs as L l and L r as well as the corresponding job in J seq .◀ ▶ Corollary 12. Let J seq be a set of jobs such that p(J seq ) ≤ D and consider J D := J p(i)>(max{D−p(Jseq),D/2}) \ J seq .Furthermore let i ⊥ ∈ J seq be the job with the smallest height.Then it holds that min{e(i Proof.Consider an optimal solution.We have to consider two cases.In the first case, two jobs from the set J seq intersect the same vertical line.In this case, 2e(i ⊥ ) is obviously a lower bound on OPT.
On the other hand, if in any optimal schedule there does not exist a pair of jobs from J seq that overlap the same vertical line, we know by Lemma 11 that there exists a job in J seq that overlaps with a set J ′ D ⊆ J D such that e(J ′ D ) ≥ e(J D )/2 and therefore OPT ≥ e(i ⊥ ) + e(J D )/2 in this case.
Figure 1 Subfigure 1a shows one possible L-shaped schedule, where Jseq contains all the jobs with height larger than T /2 and JD contains all the jobs with width larger than D/2.Subfigure 1b shows a schedule in the case that p(J e(i)>(2/3)T ) ≥ (1 − w)D.Subfigure 1c shows a schedule in the case that e(J p(i)>(3/4)D ) ≥ (2/3)T .
Define J k as the set of the k jobs with largest energy demand, By Corollary 12, T 4 is a lower bound for OPT.
Given two disjoint sets of jobs J seq and J D , we say they are placed L-shaped, if the jobs i ∈ J D are placed such that σ(i) + p(i) = D, while the jobs in J seq are sorted by height and placed left-aligned tallest to the left, see Figure 1a.
Proof.Consider a vertical line L through the generated schedule.If L does not intersect a job from J seq , the intersected jobs have a height of at most e(J D ) ≤ T .Otherwise, let i L ∈ J seq and J W,L ⊆ J D be the jobs intersected by L and define J seq,L := J e(i)≥e(i L ) .Note that by definition of the schedule, it holds that
If p(J e(j)>(2/3)T ) ≥ (1 − w)D, there is a polynomial time algorithm to place all jobs inside a schedule with height at most (5/3 + ε)T .
Proof.We place jobs that are very wide or very tall in an ordered fashion, while the residual jobs will be placed using Steinberg's Algorithm, see Figure 1b.We define J D := J p(j)>(1/2+w)D \ J e(j)>T /2 .We place each job j ∈ J D such that σ(j) = D − p(j).All the jobs in J e(j)>T /2 are sorted by energy demand and placed left aligned, tallest first inside the schedule area.Let ρ := e(J D )/T and let e (1−2w)D denote the energy demand of the job in J e(j)>T /2 at position (1 − 2w)D.Then e (1−2w)D ≥ (2/3)T .By Lemma 9 and the choice of T , we know that e (1−2w)D + e(J D ) ≤ T ≤ OPT and hence ρ ≤ (1/3).Let L be a vertical line though the schedule, that is at or strictly left of (1/2 − w)D and intersects a job from J e(j)>T /2 and all the jobs from J D .By Lemma 13 at and left of L the peak energy demand of the schedule is bounded by (1 + ρ/2)T .On the other hand, right of L the energy demand of the schedule does not increase compared to L. As a consequence, the peak energy demand in the current schedule is bounded by (1 + ρ/2)T ≤ (7/6)T .Furthermore, we know that right of (1 − 2w)D the schedule has a peak energy demand of at most T .
Consider the set of jobs J e(j)∈((1/3)T,(1/2)T ] .By Lemma 6 we know p(J e(j)∈( we place all the jobs in J M := J e(j)∈((1/3)T,(1/2)T ] right-aligned next to each other inside the strip.Since they have an energy demand of at most (1/2)T and right of (1 − 2w)D the schedule has a peak energy demand of at most T , the peak energy demand of (5/3)T is not exceeded after adding these jobs.Define λ := p(J M )/D.Now at each point on the x-axis between 0 and a := (1 − λ)D the schedule has a height of at most (1 + ρ/2)T , and, therefore, we can use a height of b := (2/3 − ρ/2 + ε)T to place the residual jobs.Let J res denote the set of residual jobs that still have to be placed.Note that each job in J res has a height of at most (1/3)T and a width of at most (1/2 + w)D and the total area of these jobs can be bound by and we consider the set J M := J e(j)∈(((2/3+ε−ρ/2)/2)T,(1/2)T ] , instead of the set J e(j)∈((1/3)T,(1/2)T ] , and place it right-aligned.Again, we define λ := p(J M ).Now, each job in J res has a height of at most (1/3 + ε/2 − ρ/4)T and a width of at most (1/2 + w)D.The total area of these jobs can be bounded by Therefore, in both cases we use Steinberg's algorithm to place the jobs J res inside a rectangular container C of height (2/3 + ε − ρ)T and width (1 − λ)D, which in turn is positioned at σ(C) = 0. ◀

Second Steinberg Case
The condition is fulfilled, and we can use the free rectangular area to place the residual jobs.◀

General algorithm
This section inspects schedules generated by the AEPTAS from Theorem 19, more closely.
The AEPTAS generates a schedule that fits almost all jobs into an amount of work of peak energy demand T ≤ (1 + ε)OPT.Left out of the schedule is a set of jobs that has a very small total processing time, where each job can have an energy demand up to OPT.As such, this set of jobs can be fit into a strip of energy demand OPT and processing time γD for some γ > 0. Since we aim to generate a schedule of peak energy demand (5/3 + ε)OPT, it does not suffice to simply place this set atop the generated schedule, as this would result in a peak energy demand of 2OPT.Instead, we must find some area in the generated schedule, inside of which we can remove jobs such that an energy demand of OPT/3 for a processing time of λD is empty, where λ ∈ [0, 1] is a small constant depending on ε.Once we have achieved this, and placed the jobs removed by this procedure in a way that does not intersect this strip, we can then place the strip of energy demand OPT at exactly that place, resulting in a schedule of peak energy demand (5/3 + ε)OPT.If none of the previously mentioned cases (as in Theorem 14 and 15, that can be solved using Steinberg's algorithm) apply, then the following Theorem combined with Theorem 19 proves Theorem 2.
and a schedule σ (e.g.generated by the APTAS) where almost all jobs are placed such that the peak energy demand is T ≤ (1 + ε ′ )OPT, and the residual jobs inside an additional box C γ of energy demand T and processing time γD, we can find a restructured schedule that places all the jobs up to a schedule with peak energy demand of at most (5/3 + ε)OPT.
Proof.From the schedule σ, we will generate a new schedule σ ′ .Some jobs will be shifted to new starting positions σ ′ .Other Jobs j that are mentioned in this proof, keep their original starting positions, i.e., σ ′ (j) = σ(j).
If such a job does not exist, we search for segments that are not overlapped by jobs with energy demand larger than (2/3)T .We split the schedule into segments at the times
Let S l,k1 be the first such strip from the left, and S r,k2 the last (they might be the same) such that k 1 , k 2 ∈ {1, 2, 3, 4, 5} represent the index of the strips S 1 , . . ., S 5 .In the next step, we modify the start-and end-times of S l,k1 such that it starts at the end of a job with energy demand at least (2/3)T or at 0. We denote the shifted start times as σ ′ (•) and the shifted completion time as c ′ (•).If the start-time of S l,k1 , i.e. τ k−1 intersects a job j with e(j) ≥ (2/3)T , we define σ ′ (S l,k1 ) := σ(j) + p(j) ≤ c(S l,k1 ) − γD.Otherwise An illustration of the border shifting procedure.The original borders are indicated by τi−1 and τi.As τi−1 is not intersected by a huge job we shift σ(S ′ k ) to an earlier point in time, such that the huge job π1 ends at the exact same time.We then shift c(S ′ k ) by the same amount.The shifted c(S ′ k ) may intersect a huge job π2, indicated by the dotted line, and in such a case shift the border further such that c(S ′ k ) = σ(π2) holds.
if k 1 ̸ = 1, we find the last job j ending before σ(S l,k1 ) with e(j) ≥ (2/3)T and define σ ′ (S l,k1 ) := σ(j) + p(j) ≥ σ(S l,k1 ) − γD and shift the end-time of S l,k1 by the same amount.Note that, since S l,k1 is the first strip with at least γD time not occupied by jobs with energy demand larger than (2/3)T , the starting time of S l,k1 is reduced by at most γD, while the processing time of the segment is not increased.Finally, if the end-time of S l,k1 intersects a job j that has an energy demand larger than (2/3)T , we reduce it to c ′ (S l,k1 ) := σ(j) and call the modified segment S ′ l,k1 .These modifications never decreases the total time that is not overlapped by jobs with energy demand larger than (2/3)T in S l,k1 .For an illustration of this procedure, see Figure 3.We do the same but mirrored for S r,k2 resulting in a modified segment S ′ r,k2 .If D − c(S ′ r,k2 ) ≤ σ(S ′ l,k1 ), we mirror the schedule such that σ ′ (j) = D − c(j).We denote by S ′ k the segment in {S ′ l,k1 , S ′ r,k2 } that appears first in this new schedule, where k = min{k 1 , k 2 } represents the original number of the chosen segment.As a consequence of this mirroring if k ≥ 2, we ensured there exists a job j with e(j) > (2/3)T and c(S ′ k ) ≤ σ(j) ≤ D − σ(S ′ k ).Additionally, we know about the start and endpoints of this segment that We aim to remove jobs from S ′ k , such that the peak energy consumption reached inside S ′ k is bounded by (2/3)T .We categorize the jobs to be removed in three classes; first the set of jobs J cont that are wholly contained in S ′ k and have an energy demand less than (2/3)T , second the set of jobs that have an energy demand larger than (2/3)T , and finally the set of jobs intersecting one of the time points σ(S ′ k ) or c(S ′ k ).First, we remove J cont from the segment and schedule them inside a container that has an energy demand of at most (2/3)T and length at most p(S ′ k ).
▶ Lemma 17.The jobs J cont can be scheduled inside a container C cont of energy demand (2/3)T and processing time 3p(S ′ k ) ≤ D/2.
Proof.First note that work(J cont ) ≤ p(S ′ k )T , since the peak energy demand in σ is bounded by T .We place these jobs using Steinberg's algorithm.Recall that this procedure allows us to place a set of rectangles R into a container of size a • b as long as the following conditions are met: p max (J ) ≤ a, e max (J ) ≤ b, 2 • work(J ) ≤ (ab − (2e max (J ) − T ) + (2p max (J ) − D) + ).Setting our values for b = 3p(S ′ k ) and a = (2/3)T yields the desired property.Clearly no job wholly contained in a segment of processing time p(S ′ k ) can have a processing time greater than p(S ′ k ).Furthermore, the maximum energy demand of any job in J cont is (2/3)T .Finally, we have: In the next step, we consider the items with energy demand larger than (2/3)T .By construction of the strip, we know that the total processing time of jobs with energy demands larger than (2/3)T is bounded by p(S ′ k ) − γD.We remove all these jobs from the strip and combine them with the extra container C γ of energy demand at most T and processing time γD to a new container called C tall .It has an energy demand of at most T and a processing time of at most p(S ′ k ).After this step, the only jobs remaining inside the area of S ′ k are the jobs that overlap the borders of S ′ k .If the peak energy demand in S ′ k is lower than (2/3)T , we place the container C tall inside the strip S ′ k as well as the container C cont right of D/2 and are done.Otherwise, we have to remove jobs that overlap the borders of the strip S ′ k until the peak energy demand in S ′ k is bounded by (2/3)T .The jobs we choose to remove are dependent on the position of the strip.The following lemma helps to see how these jobs can be shifted without increasing the peak energy demand of the schedule too much.
▶ Lemma 18.Consider a schedule σ with peak energy demand bounded by T and a time τ , as well as a subset of jobs J Move ⊆ J (τ ) with e(J Move ) ≤ a • T for some a ∈ [0, 1].Let τ be the smallest value σ(j) for j ∈ J Move .Consider the schedule σ ′ , where all the jobs in J Move are delayed such that they end at D, i. e., σ ′ (j) = D − p(j) for all J Move and σ ′ (j) = σ(j) for all other jobs.
In the schedule σ ′ before of D/2 + τ /2, the peak energy demand is bounded by T , while after of D/2 + τ /2 the peak energy demand is bounded by (1 + a)T .
Proof.If the energy demand of the schedule σ ′ is larger than T at a position τ ′ , it has to be because one of the jobs in J Move overlaps it.Hence, that peak energy demand is bounded by (1 + a)T , since we shifted jobs with total energy demand bounded by aT .Let j be one of the shifted jobs.If σ ′ (j) > D/2 + τ /2, the energy demand of the schedule before of D/2 + τ /2 cannot be influenced by this job.Therefore, assume that D − p(j) = σ ′ (j) ≤ D/2 + τ /2.As a consequence, p(j) ≥ D/2 − τ /2.Since σ(j) ≤ τ it holds that σ(j) + p(j) ≥ D/2 + τ /2.Thus before time D/2 + τ /2, the job j overlaps its previous positions and cannot increase the peak energy demand above T .◀ We choose which of the overlapping jobs to shift depending if k = 1 or k ̸ = 1.Remember that none of the borders of S ′ k overlap a job that has an energy demand larger than (2/3)T , and assume for the following, that there is a point inside S ′ k where the total energy demand of overlapping jobs is larger than (2/3)T .

Case 1: k = 1
Consider the time τ = c(S ′ 1 ) ≤ D/8 and the set of jobs J (τ ) that are intersected by this line.We know that the total energy demand of jobs with processing time greater than (3/4)D is bounded by (2/3)T .Let J Move be the set of jobs generated as follows: Greedily take the jobs with the largest energy demand from J (τ ) \ J p(j)>(3/4)D , until either all the jobs from J (τ ) \ J p(j)>( 3 this process, we never exceed (2/3)T since, if there is a job with energy demand larger than (1/3)T in J (τ ) \ J p(j)>(3/4)D , we choose it first and immediately stop.We delay the jobs in J Move to new start positions σ ′ such that for each job j ∈ J Move we have that c ′ (j) := σ ′ (j) + p(j) = D. Note that σ ′ (j) ≥ (1/4)D for each j ∈ J Move and therefore no longer overlaps c(S ′ 1 ).Furthermore, we know by Lemma 18 that before D/2 the peak energy demand is bounded by T , while after D/2 the peak energy demand is bounded by (5/3)T .Furthermore, the peak energy demand inside S ′ 1 is bounded by (2/3)T .Since S ′ 1 has a processing time of at most D/8, we know by Lemma 17 that J cont can be placed inside a container C cont with energy demand at most (2/3)T and processing time bounded by 3D/8.Therefore, we can schedule this container at D/8 and know that it is finished before D/2.Finally, we schedule the container C tall at σ ′ (C tall ) = 0.The peak energy demand of the resulting schedule is bounded by (5/3)T .See Figure 4a for the repacking procedure.

Case 2: k ̸ = 1
In this case, the borders of the considered strip can be overlapped from both sides.Furthermore, we know that the left border of S ′ k is right of D/8 − γD ≥ γD.Consider the largest total energy demand of jobs that are intersected by any vertical line through S ′ k and denote this energy demand as T S ′ k .Since there is a job j l with energy demand larger than (2/3)T with σ(j l ) + p(j l ) = σ(S ′ k ), we know that the total energy demand of jobs intersecting σ(S ′ k ) can be at most (1/3)T .Next, consider the closest job j r that starts after c(S ′ k ) and has an energy demand larger than (2/3)T .By the choice of S ′ k , we know that such a job must exist and that σ(j r ) ≤ D − σ(S ′ k ), by the choice of S ′ k out of S ′ k1,l and S ′ k2,r .Furthermore, we know that the total energy demand of jobs intersecting the vertical line at σ(j r ) is bounded by (1/3)T .
Hence the jobs that overlap the vertical line at σ(j r ) and the jobs that overlap the vertical line at σ(S ′ k ) add a total energy demand of at most (2/3)T to T S ′ k .Let us now consider the jobs J M that overlap the time c(S ′ k ) but neither the time σ(S ′ k ) nor the time σ(j r ).Each of them has a processing time of at most Hence when delaying their start points such that σ ′ (j) = D − p(j), they no longer overlap the time c(S ′ k ) since p(S ′ k ) ≤ σ(S ′ k ) for each k ∈ {2, 3, 4, 5}.We greedily take jobs from J M that have the earliest starting point until we have all jobs from J M or we have a total energy demand of at least (1/3)T .If the total energy demand of the chosen jobs is larger than (2/3)T , the last job j v has an energy demand of at least (1/3)T .Since it has a processing time lower than (1 − 2γ)D, it has to have a processing time of at most γD.We remove this job and place it later, while we shift all the others to new positions σ ′ such that σ ′ (j) = D − p(j) for each of the taken jobs j.We call the set of shifted jobs J Move .Furthermore, since J Move has a total energy demand of at most (2/3)T and a starting point right of σ(S ′ k ), we know by Lemma 18 that the peak energy demand right of D/2 + σ(S ′ k )/2 is bounded by (5/3)T while left of D/2 + σ(S ′ k )/2 it is bounded by T .Let σ(j l ) be the starting time of the last taken job.Before σ(j l ) (in S ′ k ) there is no longer a job from J M , and, hence inside S ′ i left of σ(j l ), the peak energy demand is bounded by (2/3)T .On the other hand, after σ(j l ) (in S ′ k ) we either have removed jobs with total energy demand at least (1/3)T , or all the jobs from J M and hence the schedule there can have a total energy demand of at most (2/3)T as well.Therefore, we can place the container C tall inside S ′ k without increasing the energy demand above (5/3)T .It remains to place the container C cont and the job j v .For k ∈ {2, 3}, we set C cont at σ ′ (C cont ) = c(S ′ k ) and the job σ ′ (j v ) = 0, while for k ∈ {4, 5}, we set σ ′ (C cont ) = 0 and σ ′ (j v ) = c(S ′ k ).We will now see for each segment, that the peak energy demand of (5/3)T is not exceeded by this new schedule.
First note that p(j v ) ≤ γD ≤ D/8 − γD and hence does not intersect S ′ 2 , when scheduled at σ ′ (j v ) = 0. Similarly, it is more narrow than S ′ 5 and σ(S ′ 5 )/2, and hence fits right of S ′ 4 and S ′ 5 without increasing the schedule more than (5/3)T .It remains to place the container C cont and the job j v .For k ∈ {2, 3}, we set We will now see for each segment, that the peak energy demand of (5/3)T is not exceeded by this new schedule.

AEPTAS for NPDM
In this section, we will prove the following theorem.
There is an algorithm that places almost all jobs such that the peak energy demand is bounded by T ′ := (1 + O(ε))OPT and all residual jobs are placed either in a container C 1 with processing time λD and energy demand T ′ or in a container C 2 with processing time D and energy demand e max .The time complexity of this algorithm is bounded by The statement gives in fact two variants of the algorithm.The first variant where all residual jobs are placed in C 1 is used in our 5/3 + ε approximation algorithm, where the second variant with all residual jobs in C 2 can be used to obtain the AEPTAS.The described main algorithm follows the dual-approximation framework.We describe an algorithm that given a bound on the schedule peak energy demand T computes a schedule with peak energy demand (1 + O(ε))T ′ + e max or decides correctly that there is no schedule with peak energy demand at most T ′ .This algorithm then can be called in binary search fashion with values T between T ′ = max{T 1 , T 2 , T 3 , T 4 } and max{2work(J )/D, 2e max }, using only multiples of εT ′ .
Note that if e max ≤ O(ε 3 T ′ ), we can use the algorithm in [11] to find an (1

Classification of Jobs
Given two values δ and µ with µ < δ, we partition the jobs into five sets: large, horizontal, vertical, small, and medium sized jobs.
This can be done via a standard combination of arithmetic and geometric rounding [42].In the following we will dismiss the medium jobs from the schedule.

Profile for vertical jobs
Given an optimal schedule, we partition the schedule into 1/γ segments of processing time γD, for a constant γ ∈ O ε (1).Given a schedule of jobs J, we define profile of J to be {(x, y)|y = j∈J|σ(j)≤x≤σ(j)+p(j) e(j), 0 ≤ x ≤ D, }.Energy demand of profile of jobs J at time t is E J (t) := j∈J|σ(j)≤t≤σ(j)+p(j) e(j).Now consider the profile of large and horizontal jobs.Let J := J large ∪ J hor , We search for the segments where the maximal energy demand of the profile of large and horizontal jobs and the minimal energy demand of this profile differs more than εT , i.e., if in segment S := (t a , t b ), | max t∈S E J (t) − min t∈S E J (t)| ≥ εT , then we remove all vertical and small jobs from these segments fractionally, i.e., we slice jobs, which are cut by the borders of the segment.
▷ Claim 1.Let J rem be the set of removed vertical and small jobs.Then work(J rem ) is bounded by O(γ/εδ) • D • T .
Proof.Note that the energy demand of the profile of horizontal or large jobs only changes, when horizontal or large jobs end or start.The large and horizontal jobs have a total energy demand of at most T /δ since they have a processing time of at least δD and the total area of the schedule is bounded by T • D. Hence there can be at most 2(T /δ)/εT = O(1/εδ) segments, where the energy demand of the profile changes more than εT .As a result, the total area of the removed vertical jobs can be bounded by O(1/εδ)

Algorithm to place the vertical, small, and medium jobs
In the algorithm, we first round the energy demands of the vertical jobs to at most 1) sizes using Lemma 21 (geometric rounding).Afterward, we guess for each of the 1/γ segments the energy demand reserved for the vertical and small jobs rounding up to the next multiple of εT , adding at most one more εT to the energy demand of the schedule.There are at most O((1/ε) 1/γ ) possible guesses.Furthermore, we introduce one segment ⊤ of energy demand ⌈e(C k )/(εT )⌉•εT and processing time p(C k )/4 (k ∈ {1, 2}) for the set of removed vertical jobs.Let S ver be the set of all introduced segments, and for each s ∈ S ver let e s,ver be the energy demand reserved for vertical and small jobs.Furthermore, let S ver,e be the set of segments that have exactly energy demand e and let p(S ver,e ) be their total processing time.
To place the vertical jobs into the segments S ver , we use a configuration LP.Let C = {a ei : e i |e i ∈ {e(j)|j ∈ J ver }} be a configuration for vertical jobs, e(C) := i∈Jver a i e(i) be its energy demand, and C e be the set of configurations with energy demand at most e.Furthermore, for a given configuration C we denote by a e (C) the number of jobs contained in C that have an energy demand of e.Since each vertical job has a energy demand of at least δT , there are at most (1/ε) O(1/δ) different configurations.Consider the following linear program: s∈S C∈Ce s,ver The first equation ensures that the configurations and the jobs placed on top of the schedule do not exceed the available space, while the second equation ensures that each job is fully scheduled.A basic solution has at most (1/ε + |{e(j)|j ∈ J ver }| + 1) = (1/ε) 3 nonzero components.
We can solve the above linear program by guessing the set of non zero components and then solving the resulting LP in ((1/ε) O(1/δ) ) (1/ε) 3 time.
To place the vertical jobs, we first fill them greedily inside the configurations (slicing when the corresponding configuration slot is full) and afterward place the configurations inside the schedule, slicing the jobs at the segment borders.For each nonzero component we have one configuration that contains at most 2/δ fractional placed vertical jobs on top of each other, which have a total energy demand of at most 2T ′ .Additionally, for each segment we have the same amount of fractional jobs.Hence total area of fractionally placed jobs can be bounded by µD • 2T • ((1/ε) 3 + 1/γ).If we choose C 1 this can be bounded by O(µ/(λεδ))DT ≤ λDT /8, since µ = cεδλ 2 and otherwise by ∈ O(µD • T /(ε 5 δ)) ≤ DT /8, since µ = cε 5 δ for a suitable small constant c.We remove the fractionally placed jobs J f rac .
Next, we place the small jobs inside the empty area that can appear above each configuration for vertical jobs.Note that there are at most ((1/ε) O(1) + 1/γ) configurations and the free area inside these configurations has at least the size of the total area of the small jobs.As a consequence, we have at most 2/γ rectangular areas to place the small jobs, which have a total area, which is at least the size of the small jobs.We use the NFDH algorithm to place these jobs inside the boxes until no other job fits inside.
Assume we could not place all the small jobs inside these boxes.When considering the free amount of work in each box, there are three parts which contribute to it.First, each box can have a strip of free amount of work later on in the schedule which has a processing time of at most µD.The total free amount of work contributed by this strip is bounded by (2/γ)µD • 2T .Second, each box can have a strip of free amount of work of energy demand at most µT on the top, because otherwise another line of jobs would have fitted inside this box.Since there are no boxes on top of each other, we can bound the total free amount of work which is a result of this strip by µT • D. Finally, there can be free amount of work between the shelves of the jobs generated by the NFDH algorithm.This total free amount of work is bounded by the energy demand of the tallest job times the processing time of the widest box, i.e. µT • γD.Hence the total free amount of work inside the boxes is bounded by 5µD • T • γ + D • µT .Since γ ∈ O(1/ε 5 δ) and we have chosen µ ≤ cδε 6 for a suitable small constant c ∈ Q, the total amount of work of the residual small jobs J small,res , which could not be placed is bounded by εT D.
We place the residual small jobs J small,res on top of the schedule using NFDH.This adds an energy demand of at most 2εT to the schedule.Next we place the medium jobs.We start all the medium jobs, that have a processing time larger than p(C k )/4 with Steinberg's algorithm inside a box of energy demand at most O(ε)T and processing time D. This is possible since they have processing time in (εD, D] and therefore each has an energy demand of at most O(ε)T because their total work is bounded by (ε 2 /4)DT .The residual jobs (that might have a processing time larger than εT ) are placed inside the first half of the container using Steinberg's algorithm.The later half of the container is filled with the extra box for vertical items defined for the LP and the fractionally scheduled jobs.The extra box has a width of at most p(C k )/4.Since the fractionally placed vertical jobs J f rac have an area of at most e(C k ) • p(C k )/8 and each has a width of at most µD < p(C k )/8, we can use Steinberg's algorithm to place them inside the last quarter of the container C k .

Placement of horizontal jobs
In this section, we first reduce the number of possible starting points for horizontal jobs and then use a linear program to place the jobs in the schedule.
First step: use geometric grouping to reduce the number of processing times of horizontal jobs.At a loss of at most 2εT in the approximation ratio, we can reduce the number of processing times of horizontal jobs to O(log(1/δ)/ε) using geometric grouping (see [32, Theorem 2] by Karmarkar and Karp).These rounded jobs can be placed fractionally instead of the original jobs and an extra box of energy demand at most O(ε)T .Remember, we know the profile of large and horizontal jobs with precision εT for the segments of processing time γD.In the next step, we will alter the starting points of the large and fractionally placed horizontal jobs without exceeding the given profile.▷ Claim 3. Without loss in the approximation ratio, we can reduce the number of different starting points of rounded horizontal and large jobs to (1/ε) (1/ε) O(1/ε) .
Proof.Consider the large and horizontal jobs starting in the first segment.Since this segment has a processing time of γD ≤ δD, there can be no job ending in this segment.Hence this segment is maximally filled at the point γD.We can shift the start point of each job in this segment to 0 and we will not change the maximal energy demand of this segment.Now consider a job i ∈ J hor ∪ J large starting in the second segment.If there is no horizontal or large job ending before the start of i, we can shift the start point of i to γD without changing the maximal filling energy demand in this segment.However, if there is a job j ∈ J hor ∪ J large ending before i in this segment, we can not shift this job to γD since then i and j overlap, which they did not before.This could change the maximal energy demand of the profile in this segment.Nevertheless, if j is the last job ending before i, we can shift i to the left, such that i starts at the endpoint of j.
Proof.We partition the set of horizontal jobs by their processing time into O(log(1/δ)) sets J l hor := {i ∈ J hor |D/2 l < p(i) ≤ D/2 l−1 }.For each of these sets, we will reduce the number of starting positions to 2 l /ε 2 .We partition the schedule into 2 l segments of processing time D/2 l .Each job from the set J l hor has a processing time larger than D/2 l and hence it starts in an other segment as it ends.We consider for each segment all the horizontal jobs of the set J l hor ending in this segment and sort them by increasing starting position.Let e l,i be the energy demand of the stack of jobs in J l hor ending in the i-th segment.We partition the stack into 1/ε layers of energy demand εe l,i and slice the horizontal jobs overlapping the layer borders.We remove all the jobs in the bottom most layer and shift the jobs from the layers above to the left, such that they start at the latest original start position from the layer below.We repeat this procedure for each segment.By this shift, we reduce the total number of starting positions from jobs from the set J l hor to 2 l /ε.The total energy demand of the jobs we removed is bounded by εe(J l hor ).Since these jobs have a processing time of at most D/2 l−1 , we can schedule 2 l−1 of these jobs after one an other (horizontally), without violating the deadline.Hence, when scheduling these jobs fractionally, we add at most εe(J l hor )/2 l−1 to the schedule.Note that since all the jobs in set J l hor have a processing time of at least D/2 l , it holds that ⌈log(1/δ)⌉ l=1 e(J l hor )/2 l ≤ T and, hence, we add at most ⌈log(1/δ)⌉ l=1 εe(J l hor )/2 l−1 ≤ 2εT to the energy demand of the schedule, when scheduling the removed horizontal jobs.

Algorithm to place horizontal and large jobs
To place the jobs in J hor ∪J large , we first guess the starting positions of the large jobs J large in O(|S hor,large | |J large | ) = (1/ε) (1/ε) O(1/ε) .Note that this guess affects the energy demand that is left for horizontal jobs.Next we guess which O(1/εδ) starting points in S hor,large will be used after the shifting due to Claim 4.There are at most |S hor,large | O(1/εδ) = (1/ε) (1/ε) O(1/ε) possible guesses total.We call the set of guessed starting points Shor,large .For each starting point in Shor,large , we calculate the residual total energy demand, that is left after the guess for the large jobs.For a given s ∈ Shor,large let e s,hor be this residual total energy demand.Consider the following linear program for horizontal jobs: and finally T 3 = max{T 3,a , T 3,b }.Note that J ′ k and J p(i)>D−p(J ′ k )/2 are disjoint, since J ′ k contains only jobs with width at most D/2 and J p(i)>D−p(J ′ k )/2 contains only jobs width width larger than D/2, and hence, by Corollary 8, T 3 is a lower bound on OPT.

Figure 4
Figure4 Illustration of the steps in the proof of Theorem 16.Note that the set J Move is delayed such that the jobs end at D. The containers C tall and Ccont are placed such that they do not intersect.For 4b and 4c, the jobs jv are placed in the same manner, and the job jr is denoted.
• (γD • T ).◀ ▷ Claim 2 (Size of γ).In the case of container C 1 , we can choose γ ∈ O(εδλ) such that we can schedule the removed vertical jobs fractionally inside a container C 1,1/4 of processing time p(C 1 )/4 and energy demand e(C 1 ).Otherwise, we can choose γ ∈ O(ε 4 δ) such that we can schedule the removed vertical jobs fractionally inside a container C 2,1/4 of processing time p(C 2 )/4 and energy demand e(C 2 ).Let k ∈ {1, 2} depending on the chosen container.First we place all the jobs J rem,tall , i.e., jobs in J rem with energy demand larger than e(C k,1/4 )/2 next to each other.The total processing time of these jobs is bounded by 2 • work(J rem,tall )/e(C k,1/4 ).Next, we place the residual jobs J rem,res := J rem \ J rem,tall , which have an energy demand of at most e(C k,1/4 )/2.We take slices of processing time 1 of the jobs and place them on top of each other until the energy demand e(C k,1/4 )/2 is reached.Since each job has an energy demand of at most e(C k,1/4 )/2 the energy demand e(C k,1/4 ) is not exceeded.The total processing time of this schedule is bounded by 2work(J rem,res )/e(C k,1/4 ) + 1 ≤ O(γ/(εδ) • D • T )/e(C k,1/4 ).Hence, for C 1,1/4 the total processing time is bounded by O(γ/(εδ) • D • T )/T = O(γ/(εδ))D.Hence, when choosing γ ∈ O(λεδ) for a suitable constant, the total processing time of this schedule is bounded by p(C 1 )/4.Otherwise, for container C 2,1/4 the total processing time is bounded by O((γ/(εδ) • D • T )/ε 3 T ) = O(γ/ε 4 δ)D.Hence, when choosing γ ∈ O(ε 4 δ) for a suitable constant, the total processing time of this schedule is bounded by p(C 2 )/4.◀