The input to the algorithm is a set S of numbers, and a parameter n. The required output is a partition of S into n subsets, such that the largest subset sum (also called the makespan) is as small as possible.
The algorithm uses as a subroutine, an algorithm called first-fit-decreasing bin packing (FFD). The FFD algorithm takes as input the same set S of numbers, and a bin-capacity c. It heuristically packs numbers into bins such that the sum of numbers in each bin is at most C, aiming to use as few bins as possible. Multifit runs FFD multiple times, each time with a different capacity C, until it finds some C such that FFD with capacity C packs S into at most n bins. To find it, it uses binary search as follows.
Multifit is a constant-factor approximation algorithm. It always finds a partition in which the makespan is at most a constant factor larger than the optimal makespan. To find this constant, we must first analyze FFD. While the standard analysis of FFD considers approximation w.r.t. number of bins when the capacity is constant, here we need to analyze approximation w.r.t. capacity when the number of bins is constant. Formally, for every input size S and integer n, let O P T ( S , n ) {\displaystyle OPT(S,n)} be the smallest capacity such that S can be packed into n bins of this capacity. Note that O P T ( S , n ) {\displaystyle OPT(S,n)} is the value of the optimal solution to the original scheduling instance.
Let r n {\displaystyle r_{n}} be the smallest real number such that, for every input S, FFD with capacity r n ⋅ O P T ( S , n ) {\displaystyle r_{n}\cdot OPT(S,n)} uses at most n bins.
Coffman, Garey and Johnson prove the following upper bounds on r n {\displaystyle r_{n}} :2
During the MultiFit algorithm, the lower bound L is always a capacity for which it is impossible to pack S into n bins. Therefore, L < r n ⋅ O P T ( S , n ) {\displaystyle L<r_{n}\cdot OPT(S,n)} . Initially, the difference U − L {\displaystyle U-L} is at most sum(S) / n, which is at most O P T ( S , n ) {\displaystyle OPT(S,n)} . After the MultiFit algorithm runs for k iterations, the difference shrinks k times by half, so U − L ≤ ( 1 / 2 ) k ⋅ O P T ( S , n ) {\displaystyle U-L\leq (1/2)^{k}\cdot OPT(S,n)} . Therefore, U ≤ ( r n + ( 1 / 2 ) k ) ⋅ O P T ( S , n ) {\displaystyle U\leq (r_{n}+(1/2)^{k})\cdot OPT(S,n)} . Therefore, the scheduling returned by MultiFit has makespan at most r n + ( 1 / 2 ) k {\displaystyle r_{n}+(1/2)^{k}} times the optimal makespan. When k {\displaystyle k} is sufficiently large, the approximation factor of MultiFit can be made arbitrarily close to r n {\displaystyle r_{n}} , which is at most 1.22.
Later papers performed a more detailed analysis of MultiFit, and proved that its approximation ratio is at most 6/5=1.2,3 and later, at most 13/11≈1.182.4 The original proof of this missed some cases; 5 presented a complete and simpler proof. The 13/11 cannot be improved: see lower bound below.6
For n=4: the following7 shows that r n ≥ 20 / 17 {\displaystyle r_{n}\geq 20/17} , which is tight. The inputs are 9,7,6,5,5, 4,4,4,4,4,4,4,4,4. They can be packed into 4 bins of capacity 17 as follows:
But if we run FFD with bin capacity smaller than 20, then the filled bins are:
Note that the sum in each of the first 4 bins is 16, so we cannot put another 4 inside it. Therefore, 4 bins are not sufficient.
For n=13: the following8 shows that r n ≥ 13 / 11 {\displaystyle r_{n}\geq 13/11} , which is tight. The inputs can be packed into 13 bins of capacity 66 as follows:
But if we run FFD with bin capacity smaller than 66*13/11 = 78, then the filled bins are:
Note that the sum in each of the first 13 bins is 65, so we cannot put another 13 inside it. Therefore, 13 bins are not sufficient.
MultiFit can also be used in the more general setting called uniform-machines scheduling, where machines may have different processing speeds.9 When there are two uniform machines, the approximation factor is 6 / 2 {\displaystyle {\sqrt {6}}/2} . When MultiFit is combined with the LPT algorithm, the ratio improves to 2 + 1 / 2 {\displaystyle {\sqrt {2}}+1/2} .
A dual goal to minimizing the largest sum (makespan) is maximizing the smallest sum. Deuermeyer, Friesen and Langston claim that MultiFit does not have a good approximation factor for this problem:10
"In the solution of the makespan problem using MULTIFIT, it is easy to construct examples where one processor is never used. Such a solution is tolerable for the makespan problem, but is totally unacceptable for our problem [since the smallest sum is 0]. Modifications of MULTIFIT can be devised which would be more suitable for our problem, but we could find none which produces a better worst-case bound than that of LPT."
The upper bounds on r n {\displaystyle r_{n}} are proved by contradiction. For any integers p ≥ q, if r n > p / q {\displaystyle r_{n}>p/q} , then there exists a (p/q)-counterexample, defined as an instance S and a number n of bins such that
If there exists such a counterexample, then there also exists a minimal (p/q)-counterexample, which is a (p/q)-counterexample with a smallest number of items in S and a smallest number of bins n. In a minimal (p/q)-counterexample, FFD packs all items in S except the last (smallest) one into n bins with capacity p. Given a minimal (p/q)-counterexample, denote by P1,...,Pn the (incomplete) FFD packing into these n bins with capacity p, by Pn+1 the bin containing the single smallest item, and by Q1,...,Qn the (complete) optimal packing into n bins with capacity q. The following lemmas can be proved:
From the above lemmas, it is already possible to prove a loose upper bound r n ≤ 5 / 4 = 1.25 {\displaystyle r_{n}\leq 5/4=1.25} . Proof. Let S, n be a minimal (5/4)-counterexample. The above lemmas imply that -
To prove tighter bounds, one needs to take a closer look at the FFD packing of the minimal (p/q)-counterexample. The items and FFD bins P1,...,Pn are termed as follows:
The following lemmas follow immediately from these definitions and the operation of FFD.
In a minimal counterexample, there are no regular 1-bins (since each bin contains at least 2 items), so by the above lemmas, the FFD bins P1,...,Pn are ordered by type:
The upper bound r n ≤ 1.22 {\displaystyle r_{n}\leq 1.22} 11 is proved by assuming a minimal (122/100)-counterexample. Each item is given a weight based on its size and its bin in the FFD packing. The weights are determined such that the total weight in each FFD bin is at least x, and the total weight in almost each optimal bin is at most x (for some predetermined x). This implies that the number of FFD bins is at most the number of optimal bins, which contradicts the assumption that it is a counterexample.
By the lemmas above, we know that:
If D>4, the size of each item is larger than 26, so each optimal bin (with capacity 100) must contain at most 3 items. Each item is smaller than 56-2D and each FFD bin has a sum larger than 100-D, so each FFD bin must contain at least 3 items. Therefore, there are at most n FFD bins - contradiction. So from now on, we assume D≤4. The items are assigned types and weights as follows.
Note that the weight of each item is at most its size (the weight can be seen as the size "rounded down"). Still, the total weight of items in every FFD bin is at least 100-D:
The total weight of items in most optimal bins is at most 100-D:
The upper bound r n ≤ 13 / 11 ≈ 1.182 {\displaystyle r_{n}\leq 13/11\approx 1.182} 12 is proved by assuming a minimal ((120-3d)/100)-counterexample, with some d<20/33, and deriving a contradiction.
MultiFit is not monotone in the following sense: it is possible that an input decreases while the max-sum in the partition returned by MultiFit increases. As an example,13: Fig.4 suppose n=3 and the input numbers are:
44, 24, 24, 22, 21, 17, 8, 8, 6, 6.
FFD packs these inputs into 3 bins of capacity 60 (which is optimal):
But if the "17" becomes "16", then FFD with capacity 60 needs 4 bins:
so MultiFit must increase the capacity, for example, to 62:
This is in contrast to other number partitioning algorithms - List scheduling and Longest-processing-time-first scheduling - which are monotone.14
Multifit has been extended to the more general problem of maximin-share allocation of chores.15 In this problem, S is a set of chores, and there are n agents who assign potentially different valuations to the chores. The goal is to give to each agent, a set of chores worth at most r times the maximum value in an optimal scheduling based on i's valuations. A naive approach is to let each agent in turn use the MultiFit algorithm to calculate the threshold, and then use the algorithm where each agent uses his own threshold. If this approach worked, we would get an approximation of 13/11. However, this approach fails due to the non-monotonicity of FFD.
Here is an example.16: Ex.5.2 Suppose there are four agents, and they have valuations of two types:
Both types can partition the chores into 4 parts of total value 75. Type A:
Type B:
If all four agents are of the same, then FFD with threshold 75 fills the 4 optimal bins. But suppose there is one agent of type B, and the others are of type A. Then, in the first round, the agent of type B takes the bundle 51, 24 (the other agents cannot take it since for them the values are 51,25 whose sum is more than 75).In the following rounds, the following bundles are filled for the type A agents:
so the last two chores remain unallocated.
Using a more sophisticated threshold calculation, it is possible to guarantee to each agent at most 11/9≈1.22 of his optimal value if the optimal value is known, and at most 5/4≈1.25 of his optimal value (using a polynomial time algorithm) if the optimal value is not known.17
Using more elaborate arguments, it is possible to guarantee to each agent the same ratio of MultiFit.18
Coffman, Jr., E. G.; Garey, M. R.; Johnson, D. S. (1978-02-01). "An Application of Bin-Packing to Multiprocessor Scheduling". SIAM Journal on Computing. 7 (1): 1–17. doi:10.1137/0207001. ISSN 0097-5397.{{cite journal}}: CS1 maint: multiple names: authors list (link) https://epubs.siam.org/doi/abs/10.1137/0207001 ↩
Friesen, Donald K. (1984-02-01). "Tighter Bounds for the Multifit Processor Scheduling Algorithm". SIAM Journal on Computing. 13 (1): 170–181. doi:10.1137/0213013. ISSN 0097-5397. https://epubs.siam.org/doi/abs/10.1137/0213013 ↩
Yue, Minyi (1990-12-01). "On the exact upper bound for the multifit processor scheduling algorithm". Annals of Operations Research. 24 (1): 233–259. doi:10.1007/BF02216826. ISSN 1572-9338. S2CID 120965788. https://doi.org/10.1007/BF02216826 ↩
Cao, Feng (1995), Du, Ding-Zhu; Pardalos, Panos M. (eds.), "Determining the Performance Ratio of Algorithm Multifit for Scheduling", Minimax and Applications, Nonconvex Optimization and Its Applications, vol. 4, Boston, MA: Springer US, pp. 79–96, doi:10.1007/978-1-4613-3557-3_5, ISBN 978-1-4613-3557-3, retrieved 2021-08-23 978-1-4613-3557-3 ↩
Huang, Xin; Lu, Pinyan (2021-07-18). "An Algorithmic Framework for Approximating Maximin Share Allocation of Chores". Proceedings of the 22nd ACM Conference on Economics and Computation. EC '21. New York, NY, USA: Association for Computing Machinery. pp. 630–631. arXiv:1907.04505. doi:10.1145/3465456.3467555. ISBN 978-1-4503-8554-1. S2CID 195874333. 978-1-4503-8554-1 ↩
Burkard, R. E.; He, Y. (1998-09-01). "A note on MULTIFIT scheduling for uniform machines". Computing. 61 (3): 277–283. doi:10.1007/BF02684354. ISSN 1436-5057. S2CID 37590584. https://doi.org/10.1007/BF02684354 ↩
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. /wiki/Doi_(identifier) ↩
Segal-Halevi, Erel (2021-10-17), On Monotonicity of Number-Partitioning Algorithms, arXiv:2110.08886 /wiki/ArXiv_(identifier) ↩
Huang, Xin; Segal-Halevi, Erel (2023-12-13), A Reduction from Chores Allocation to Job Scheduling, arXiv:2302.04581 /wiki/ArXiv_(identifier) ↩