ArticleslgStudy

computer science

Multifit algorithm

Multifit algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Multifit algorithm rather than just read about it. In short: The multifit algorithm is an algorithm for multiway number partitioning, originally developed for the problem of identical-machines scheduling. It was developed by Coffman, Garey and Johnson.

Key takeaways

  • Multifit algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Multifit algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Multifit algorithm from memory before moving on to harder problems.

Reference excerpt

The multifit algorithm is an algorithm for multiway number partitioning, originally developed for the problem of identical-machines scheduling. It was developed by Coffman, Garey and Johnson. Its novelty comes from the fact that it uses an algorithm for another famous problem - the bin packing problem - as a subroutine.

The algorithm 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.

Let L := max ( sum(S) / n, max(S) ). Note, with bin-capacity smaller than L, every packing must use more than n bins. Let U := max ( 2 sum(S) / n, max(S) ). Note, with bin-capacity at least U, FFD uses at most n bins. Proof: suppose by contradiction that some input si did not fit into any of the first n bins. Clearly this is possible only if i ≥ n+1. If si > C/2, then, since the inputs are ordered in descending order, the same inequality holds for all the first n+1 inputs in S. This means that sum(S) > (n+1)C/2 > n U/2, a contradiction to the definition of U. Otherwise, si ≤ C/2. So the sum of each of the first n bins is more than C/2. This again implies sum(S) > n C/2 > n U/2, contradiction. Iterate k times (where k is a precision parameter): Let C := (L+U)/2. Run FFD on S with capacity C. If FFD needs at most n bins, then decrease U by letting U := C. If FFD needs more than n bins, then increase L by letting L := C. Finally, run FFD with capacity U. It is guaranteed to use at most n bins. Return the resulting scheduling.

Performance 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 OPT(S,n) be the smallest capacity such that S can be packed into n bins of this capacity. Note that OPT(S,n) is the value of the optimal solution to the original scheduling instance. Let rn be the smallest real number such that, for every input S, FFD with capacity rn⋅OPT(S,n) uses at most n bins.

Upper bounds Coffman, Garey and Johnson prove the following upper bounds on rn:

rn≤8/7≈1.14 for n = 2; rn≤15/13≈1.15 for n = 3; rn≤20/17≈1.176 for n = 4,5,6,7; rn≤122/100=1.22 for all n ≥ 8. 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<rn⋅OPT(S,n). Initially, the difference U−L is at most sum(S) / n, which is at most OPT(S,n). After the MultiFit algorithm runs for k iterations, the difference shrinks k times by half, so U−L≤(1/2)k⋅OPT(S,n). Therefore, U≤(rn+(1/2)k)⋅OPT(S,n). Therefore, the scheduling returned by MultiFit has makespan at most rn+(1/2)k times the optimal makespan. When k is sufficiently large, the approximation factor of MultiFit can be made arbitrarily close to rn, 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, and later, at most 13/11≈1.182. The original proof of this missed some cases; presented a complete and simpler proof. The 13/11 cannot be improved: see lower bound below.

Lower bounds For n=4: the following shows that rn≥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:

9, 4, 4 7, 6, 4 5, 4, 4, 4 5, 4, 4, 4 But if we run FFD with bin capacity smaller than 20, then the filled bins are:

9,7 [4 does not fit] 6,5,5 [4 does not fit] 4,4,4,4 [4 does not fit] 4,4,4,4 4 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 following shows that rn≥13/11, which is tight. The inputs can be packed into 13 bins of capacity 66 as follows:

40,13,13 {8 times} 25,25,16 {3 times} 25,24,17 {2 times} But if we run FFD with bin capacity smaller than 66*13/11 = 78, then the filled bins are:

40,25 {8 times} 24, 24, 17 17, 16, 16, 16 13, 13, 13, 13, 13 {3 times} 13 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.

Performance with uniform machines MultiFit can also be used in the more general setting called uniform-machines scheduling, where machines may have different processing speeds. When there are two uniform machines, the approximation factor is 6/2. When MultiFit is combined with the LPT algorithm, the ratio improves to 2+1/2.

Performance for maximizing the smallest sum 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:"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."

Proof idea

Minimal counterexamples The upper bounds on rn are proved by contradiction. For any integers p ≥ q, if rn>p/q, then there exists a (p/q)-counterexample, defined as an instance S and a number n of bins such that

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Multifit algorithm

Start with the simplest possible case. Write down what Multifit algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Multifit algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Multifit algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Multifit algorithm

In research
Multifit algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Multifit algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Multifit algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bin packing, Number partitioning, Optimal scheduling, so understanding it makes those chapters shorter.
In everyday life
Look for Multifit algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Multifit algorithm” →

How to study Multifit algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Multifit algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Multifit algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Multifit algorithm in simple terms?

The multifit algorithm is an algorithm for multiway number partitioning, originally developed for the problem of identical-machines scheduling. It was developed by Coffman, Garey and Johnson.

Why does Multifit algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Multifit algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Multifit algorithm.

Tags

  • Bin packing
  • Number partitioning
  • Optimal scheduling

Keep exploring