Longest-processing-time-first (LPT) is a greedy algorithm for job scheduling. The input to the algorithm is a set of jobs, each of which has a specific processing-time. There is also a number m specifying the number of machines that can process the jobs. The LPT algorithm works as follows:

  1. Order the jobs by descending order of their processing-time, such that the job with the longest processing time is first.
  2. Schedule each job in this sequence into a machine in which the current load (= total processing-time of scheduled jobs) is smallest.

Step 2 of the algorithm is essentially the list-scheduling (LS) algorithm. The difference is that LS loops over the jobs in an arbitrary order, while LPT pre-orders them by descending processing time.

LPT was first analyzed by Ronald Graham in the 1960s in the context of the identical-machines scheduling problem.[1] Later, it was applied to many other variants of the problem.

LPT can also be described in a more abstract way, as an algorithm for multiway number partitioning. The input is a set S of numbers, and a positive integer m; the output is a partition of S into m subsets. LPT orders the input from largest to smallest, and puts each input in turn into the part with the smallest sum so far.

Examples

If the input set is S = {4, 5, 6, 7, 8} and m = 2, then the resulting partition is {8, 5, 4}, {7, 6}. If m = 3, then the resulting 3-way partition is {8}, {7, 4}, {6, 5}.

Properties

LPT might not find the optimal partition. For example, in the above instance the optimal partition {8,7}, {6,5,4}, where both sums are equal to 15. However, its suboptimality is bounded both in the worst case and in the average case; see Performance guarantees below.

The running time of LPT is dominated by the sorting, which takes O(n log n) time, where n is the number of inputs.

Performance guarantees: identical machines

When used for identical-machines scheduling, LPT attains the following approximation ratios.

Worst-case maximum sum

In the worst case, the largest sum in the greedy partition is at most times the optimal (minimum) largest sum.[2][a]

A more detailed analysis yields a factor of times the optimal (minimum) largest sum.[1][3] (for example, when m =2 this ratio is ).[b]

The factor is tight. Suppose there are inputs (where m is even): . Then the greedy algorithm returns:

with a maximum of , but the optimal partition is:

with a maximum of .

Input consideration

An even more detailed analysis takes into account the number of inputs in the max-sum part.

  1. In each part of the greedy partition, the j-th highest number is at most .[4]
  2. Suppose that, in the greedy part P with the max-sum, there are L inputs. Then, the approximation ratio of the greedy algorithm is .[3] It is tight for L≥3 (For L=3, we get the general factor ). Proof.[4] Denote the numbers in P by x1,...,xL. Before xL was inserted into P, its sum was smallest. Therefore, the average sum per part is at least the sum x1+...+xL-1 + xL/m. The optimal max-sum must be at least the average sum. In contrast, the greedy sum is x1+...+xL-1+xL. So the difference is at most (1-1/m)xL, which by (1) is at most (1-1/m)*OPT/L. So the ratio is at most (1 + 1/L - 1/Lm).

Worst-case minimum sum

In the worst case, the smallest sum in the returned partition is at least times the optimal (maximum) smallest sum.[5]

Proof

The proof is by contradiction. We consider a minimal counterexample, that is, a counterexample with a smallest m and fewest input numbers. Denote the greedy partition by P1,...,Pm, and the optimal partition by Q1,...,Qm. Some properties of a minimal counterexample are:

The proof that a minimal counterexample does not exist uses a weighting scheme. Each input x is assigned a weight w(x) according to its size and greedy bundle Pi:

This weighting scheme has the following properties:

Upper bound on the ratio

A more sophisticated analysis shows that the ratio is at most (for example, when m=2 the ratio is 5/6).[6][7]

Tightness and example

The above ratio is tight.[5]

Suppose there are 3m-1 inputs (where m is even). The first 2m inputs are: 2m-1, 2m-1, 2m-2, 2m-2, ..., m, m. The last m-1 inputs are all m. Then the greedy algorithm returns:

with a minimum of 3m-1. But the optimal partition is:

with a minimum of 4m-2.

Restricted LPT

There is a variant of LPT, called Restricted-LPT or RLPT,[8] in which the inputs are partitioned into subsets of size m called ranks (rank 1 contains the largest m inputs, rank 2 the next-largest m inputs, etc.). The inputs in each rank must be assigned to m different bins: rank 1 first, then rank 2, etc. The minimum sum in RLPT is at most the minimum sum at LPT. The approximation ratio of RLPT for maximizing the minimum sum is at most m.

Average-case maximum sum

In the average case, if the input numbers are distributed uniformly in [0,1], then the largest sum in an LPT schedule satisfies the following properties:

General objectives

Let Ci (for i between 1 and m) be the sum of subset i in a given partition. Instead of minimizing the objective function max(Ci), one can minimize the objective function max(f(Ci)), where f is any fixed function. Similarly, one can minimize the objective function sum(f(Ci)). Alon, Azar, Woeginger and Yadid[12] prove that, if f satisfies the following two conditions:

  1. A strong continuity condition called Condition F*: for every ε>0 there exists δ>0 such that, if |y-x|<δx, then |f(y)-f(x)|<εf(x).
  2. Convexity.

Then the LPT rule has a finite approximation ratio for minimizing sum(f(Ci)).

Adaptations to other settings

Besides the simple case of identical-machines scheduling, LPT has been adapted to more general settings.

Uniform machines

In uniform-machines scheduling, different machines may have different speeds. The LPT rule assigns each job to the machine on which its completion time will be earliest (that is, LPT may assign a job to a machine with a larger current load, if this machine is so fast that it would finish that job earlier than all other machines).[13]

Cardinality constraints

In the balanced partition problem, there are constraints on the number of jobs that can be assigned to each machine. A simple constraint is that each machine can process at most c jobs. The LPT rule assigns each job to the machine with the smallest load from among those with fewer than c jobs. This rule is called modified LPT or MLPT.

Another constraint is that the number of jobs on all machines should be rounded either up or down. In an adaptation of LPT called restricted LPT or RLPT, inputs are assigned in pairs - one to each machine (for m=2 machines).[9] The resulting partition is balanced by design.

Kernel constraints - non-simultaneous availability

In the kernel partitioning problem, there are some m pre-specified jobs called kernels, and each kernel must be scheduled to a unique machine. An equivalent problem is scheduling when machines are available in different times: each machine i becomes available at some time ti 0 (the time ti can be thought of as the length of the kernel job).

A simple heuristic algorithm, called SLPT,[21] assigns each kernel to a different subset, and then runs the LPT algorithm.

Online settings

Often, the inputs come online, and their sizes becomes known only when they arrive. In this case, it is not possible to sort them in advance. List scheduling is a similar algorithm that takes a list in any order, not necessarily sorted. Its approximation ratio is .

A more sophisticated adaptation of LPT to an online setting attains an approximation ratio of 3/2.[25]

Implementations

See also

Notes

  1. ^ Proof. Normalize the input items such that OPT=1. This implies that the sum of all items is at most m. Partition the items into large (more than 2/3), medium (between 1/3 and 2/3), and small (less than 1/3). Let their numbers be nL, nM and nS. In each optimal partition, each part contains at most one large item, so nL ≤ m. Moreover, each optimal part cannot contain both a large and a medium item, or three medium items; so nM ≤ 2(m-nL). The operation of the greedy algorithm can be partitioned into three phases: 1. Allocating the large items - each of which is put in a different bin. Since nL ≤ m, when this phase completes, each bin contains at most one item, so the max-sum is at most 1. 2. Allocating the medium items. The first m-nL ones are put in empty bins, and the next m-nL ones (if any) are added into the same bins. Since nM ≤ 2(m-nL), when this phase completes, each bin contains either one large item - with sum at most 1, or at most two medium items - with sum at most 4/3. 3. Allocating the small items. Each item is added into the bin with the smallest sum. The smallest sum is at most the average sum, which is at most 1. Hence, once a small item is added, the new sum becomes at most 4/3.
  2. ^ Proof. The previous proof can be refined in two ways. First, one can prove that, once all large and medium items are allocated, the sum in each bin is at most 1. If there are at most m-nL medium items, then each large and medium item is placed in a separate bin, so the sum is clearly at most 1. Otherwise, denote the first m-nL medium items by top-medium items, and the others (at most m-nL) by bottom-medium items. Assume first that item #m is larger than 1/2. This means that the items #1,...,#m are all larger than 1/2, so each must be in a different optimal part. Each of the bottom-medium items (items #m+1,...#nM) must fit into an optimal part with exactly one of the items #1,...,#m . Let us call two items matchable if their sum is at most 1, so that they can fit into the same optimal part. By Hall's theorem, each subset of k bottom-medium items must be matchable to at least k of the items #1,...,#m. In particular, the item #m+1 must be matchable to item #m; items #m+1 and #m+2 must be matchable to item #m-1; and in general, item #m+k must be matchable to item #'m-k+1. LPT indeed puts item #m+k in the same bin as #'m-k+1, so the sum of each bin is at most 1. Second, one can prove that, when allocating the small inputs, the sum of every new bin is at most 4/3-1/(3m). There are two cases: 1. If the current smallest sum is at most 1-1/(3m), then the new sum - after adding one small input - is at most 1-1/(3m)+1/3 = 4/3-1/(3m). 2. Otherwise, all sums are larger than 1-1/(3m), so the sum of the m-1 largest bins is larger than m-1-1/3+1/(3m) = m-(4/3-1/(3m)). Since the total sum of all inputs is at most m, the new sum must be less than 4/3-1/(3m).

References

  1. ^ a b Graham, R. L. (March 1969). "Bounds on Multiprocessing Timing Anomalies". SIAM Journal on Applied Mathematics. 17 (2): 416–429. CiteSeerX 10.1.1.90.8131. doi:10.1137/0117039. JSTOR 2099572. NAID 30006801878 ProQuest 917998761.
  2. ^ Xiao, Xin (2017-04-01). "A Direct Proof of the 4/3 Bound of LPT Scheduling Rule". Proceedings of the 2017 5th International Conference on Frontiers of Manufacturing Science and Measuring Technology (FMSMT 2017). Atlantis Press. pp. 486–489. doi:10.2991/fmsmt-17.2017.102. ISBN 978-94-6252-331-9.
  3. ^ a b Coffman, E. G.; Sethi, Ravi (1976-03-29). "A generalized bound on LPT sequencing". Proceedings of the 1976 ACM SIGMETRICS conference on Computer performance modeling measurement and evaluation - SIGMETRICS '76. SIGMETRICS '76. New York, NY, USA: Association for Computing Machinery. pp. 306–310. doi:10.1145/800200.806205. ISBN 978-1-4503-7497-2. S2CID 16980306.
  4. ^ a b Chen, Bo (1993-10-01). "A note on LPT scheduling". Operations Research Letters. 14 (3): 139–142. doi:10.1016/0167-6377(93)90024-B. ISSN 0167-6377.
  5. ^ a b Deuermeyer, Bryan L.; Friesen, Donald K.; Langston, Michael A. (June 1982). "Scheduling to Maximize the Minimum Processor Finish Time in a Multiprocessor System". SIAM Journal on Algebraic and Discrete Methods. 3 (2): 190–196. doi:10.1137/0603019.
  6. ^ Csirik, János; Kellerer, Hans; Woeginger, Gerhard (June 1992). "The exact LPT-bound for maximizing the minimum completion time". Operations Research Letters. 11 (5): 281–287. doi:10.1016/0167-6377(92)90004-M.
  7. ^ Wu, Bang Ye (December 2005). "An analysis of the LPT algorithm for the max–min and the min–ratio partition problems". Theoretical Computer Science. 349 (3): 407–419. doi:10.1016/j.tcs.2005.08.032.
  8. ^ Walter, Rico (2013-01-01). "Comparing the minimum completion times of two longest-first scheduling-heuristics". Central European Journal of Operations Research. 21 (1): 125–139. doi:10.1007/s10100-011-0217-4. ISSN 1613-9178. S2CID 254144745.
  9. ^ a b c Coffman, E. G.; Frederickson, G. N.; Lueker, G. S. (1984-05-01). "A Note on Expected Makespans for Largest-First Sequences of Independent Tasks on Two Processors". Mathematics of Operations Research. 9 (2): 260–266. doi:10.1287/moor.9.2.260. ISSN 0364-765X.
  10. ^ Frenk, J.B.G.; Kan, A.H.G.Rinnooy (June 1986). "The rate of convergence to optimality of the LPT rule". Discrete Applied Mathematics. 14 (2): 187–197. doi:10.1016/0166-218X(86)90060-0. hdl:1765/11698.
  11. ^ Frenk, J. B. G.; Rinnooy Kan, A. H. G. (1987-05-01). "The Asymptotic Optimality of the LPT Rule". Mathematics of Operations Research. 12 (2): 241–254. doi:10.1287/moor.12.2.241. ISSN 0364-765X. S2CID 31770203.
  12. ^ Alon, Noga; Azar, Yossi; Woeginger, Gerhard J.; Yadid, Tal (1998). "Approximation schemes for scheduling on parallel machines". Journal of Scheduling. 1 (1): 55–66. doi:10.1002/(SICI)1099-1425(199806)1:1<55::AID-JOS2>3.0.CO;2-J. ISSN 1099-1425.
  13. ^ a b Gonzalez, Teofilo; Ibarra, Oscar H.; Sahni, Sartaj (1977-03-01). "Bounds for LPT Schedules on Uniform Processors". SIAM Journal on Computing. 6 (1): 155–166. doi:10.1137/0206013. ISSN 0097-5397.
  14. ^ Mireault, Paul; Orlin, James B.; Vohra, Rakesh V. (1997-02-01). "A Parametric Worst Case Analysis of the LPT Heuristic for Two Uniform Machines". Operations Research. 45 (1): 116–125. doi:10.1287/opre.45.1.116. ISSN 0030-364X.
  15. ^ Koulamas, Christos; Kyparisis, George J. (2009-07-01). "A modified LPT algorithm for the two uniform parallel machine makespan minimization problem". European Journal of Operational Research. 196 (1): 61–68. doi:10.1016/j.ejor.2008.02.008. ISSN 0377-2217.
  16. ^ Kellerer, Hans; Woeginger, Gerhard (1993-09-07). "A tight bound for 3-partitioning". Discrete Applied Mathematics. 45 (3): 249–259. doi:10.1016/0166-218X(93)90013-E. ISSN 0166-218X.
  17. ^ Babel, Luitpold; Kellerer, Hans; Kotov, Vladimir (1998-02-01). "The m-partitioning problem". Mathematical Methods of Operations Research. 47 (1): 59–82. doi:10.1007/BF01193837. ISSN 1432-5217. S2CID 5594197.
  18. ^ Dell'Amico, Mauro; Martello, Silvano (2001). "Bounds for the cardinality constrained P∥Cmax problem". Journal of Scheduling. 4 (3): 123–138. doi:10.1002/jos.68. ISSN 1099-1425.
  19. ^ Chen, Shi Ping; He, Yong; Lin, Guohui (2002-03-01). "3-Partitioning Problems for Maximizing the Minimum Load". Journal of Combinatorial Optimization. 6 (1): 67–80. doi:10.1023/A:1013370208101. ISSN 1573-2886. S2CID 9053629.
  20. ^ Tsai, Li-Hui (1992-02-01). "Asymptotic Analysis of an Algorithm for Balanced Parallel Processor Scheduling". SIAM Journal on Computing. 21 (1): 59–64. doi:10.1137/0221007. ISSN 0097-5397.
  21. ^ Chen, S. -P.; He, Y.; Yao, E. -Y. (1996-09-01). "Three-partitioning containing kernels: Complexity and heuristic". Computing. 57 (3): 255–271. doi:10.1007/BF02247409. ISSN 1436-5057. S2CID 21935917.
  22. ^ Lee, Chung-Yee (1991-01-07). "Parallel machines scheduling with nonsimultaneous machine available time". Discrete Applied Mathematics. 30 (1): 53–61. doi:10.1016/0166-218X(91)90013-M. ISSN 0166-218X.
  23. ^ Lin, Guo-Hui; Yao, En-Yu; He, Yong (1998-03-01). "Parallel machine scheduling to maximize the minimum load with nonsimultaneous machine available times". Operations Research Letters. 22 (2): 75–81. doi:10.1016/S0167-6377(97)00053-9. ISSN 0167-6377.
  24. ^ Shen, Lixin; Wang, Dan; Wang, Xiao-Yuan (2013-04-01). "Parallel-machine scheduling with non-simultaneous machine available time". Applied Mathematical Modelling. 37 (7): 5227–5232. doi:10.1016/j.apm.2012.09.053. ISSN 0307-904X.
  25. ^ Chen, Bo; Vestjens, Arjen P. A. (1 November 1997). "Scheduling on identical machines: How good is LPT in an on-line setting?" (PDF). Operations Research Letters. 21 (4): 165–169. doi:10.1016/S0167-6377(97)00040-0.