Manuscript Offprint
arXiv:2611.09267Load Balancing with Item Fragmentation and More Bins than Items: Linear-Time and Exact
Abstract
We study a fundamental load-balancing problem in which items of strictly positive integer sizes with total size must be assigned to bins, with items allowed to be divided into integer-size fragments across bins. Each bin must receive a load of either or , ensuring that the loads of any two bins differ by at most one unit. Under this constraint, the objective is to minimize the maximum number of distinct item fragments placed into any single bin. This problem is NP-hard and there exists an -approximation algorithm that runs in time [Kobert et al., 2014]. The existing algorithm is employed by several widely used production codes for phylogenetic reconstruction.
Here, we focus on the case , that is, bins are at least as numerous as items. This setting arises pervasively in modern parallel and distributed systems, as well as in iterative algorithms that rebalance their workload at every step. In this context, bins are machines or machine cores, and items represent computational tasks (jobs). Our central contribution is a remarkably simple -time algorithm that computes an optimal assignment in this setting; this assignment is encoded using space. In particular, we prove that an optimum always exists in which every bin receives at most two fragments and provide a characterization of when one fragment per bin suffices. Our result strictly improves the -approximation of Kobert et al. in the many-bins setting and, together with it, yields a strongly polynomial-time -approximation algorithm for the general setting, as it removes the dependency on the number of bins.
1 Introduction
Balancing work across processing units is a fundamental problem in parallel and distributed computing, from early multiprocessors [Gra69, Cyb89] to modern many-core systems [ST19, LSS22]. As processor core counts grow, efficient utilization becomes increasingly important: a system draws substantial power whether its cores are busy or idle [BH07], so unused cores waste capacity, whereas shorter runtimes reduce total energy use [WL08]. The problem is becoming more acute as datasets grow across disciplines, increasing the work to be balanced: from large-scale simulations in high-performance and scientific computing [KK98, BD97, VGR03], through web-scale queries and MapReduce jobs in data systems [DG08, GARK11, KTR12] and rising traffic in communication networks [KSV03, CMSM+15], to billion-parameter models shared across accelerators in machine learning [LAP+14, MHH+22]. In such settings, the workload is often divisible and should be distributed evenly, while each processing unit may incur an overhead for every distinct (potentially fragmented) work unit it handles, motivating us to minimize the number of distinct units.
This led us to study the following problem, which has been introduced and studied in [KFAS14]. Given items (jobs) of strictly positive integer sizes and total size , assign them to bins (processors), with items allowed to be divided into integer-size fragments across bins. The load between bins must be as balanced as possible, that is, a load of either or . Under this constraint, the objective is to minimize the maximum number of distinct item fragments placed into any single bin.
A concrete application of balancing divisible load while limiting per-processor fragmentation arises in statistical phylogenomics [KYT20]. The input is a multiple sequence alignment, which can be viewed as a matrix: its rows correspond to taxa and its columns to homologous positions in their molecular sequences. Each column is called an alignment site. The alignment sites are typically grouped into partitions, with the sites in each partition analyzed under the same evolutionary model. For a fixed candidate phylogenetic tree, likelihood calculations at different sites are mutually independent, and their repeated evaluation dominates the cost of maximum-likelihood and Bayesian inference [Fel81]. Alignment sites can therefore be distributed across processors. Under the standard uniform-site cost model, assigning approximately the same number of sites to every processor balances the arithmetic workload. However, a processor also incurs partition-specific overhead for every partition from which it receives at least one site. The goal is thus to balance the number of sites while minimizing the maximum number of distinct partitions handled by any processor. Kobert et al. [KFAS14] formalized this task as the divisible load balance problem, which we will call here Load Balancing with Item Fragmentation (LBIF). In this formulation, the items are the partitions, the size of an item is its number of sites, and the bins are the processors. A partition may be divided among several processors, and each processor receives either or sites, where is the total number of sites and is the number of processors. The objective is to minimize the maximum number of partitions assigned to any one processor. Kobert et al. proved the problem to be NP-hard and gave an -approximation running in time for partitions (items). Their algorithm is implemented in widely used phylogenetic software, including RAxML-NG [KDF+19] and ExaBayes [AKS14]. A related, data-dependent variant arises from the site-repeats optimization [KSF17]. For a node of the phylogenetic tree, a site's subcolumn is its alignment column restricted to the taxa in the subtree rooted at that node. If two sites in the same partition have identical subcolumns, the intermediate likelihood at the root of that subtree is the same for both and needs to be computed only once. Consequently, workload is not determined by site count alone, and gives another variation of the load-balancing problem [SKFS16, MFS17].
In this paper, we study the case in which there are at least as many bins as items. In practice, bins may far outnumber items: a modern server may provide hundreds of cores, and a cluster many more, while potentially only a handful of large, divisible jobs are active at a time. The algorithm of Kobert et al. applies in this regime, but remains an approximation: it returns an assignment of value at most and does not necessarily attain OPT. Moreover, its running time depends on the number of bins. Since may be arbitrarily large relative to , this bound may not be polynomial in . In response, we show that, for every , an optimal assignment in which every bin receives at most two fragments always exists. Furthermore, we construct such an assignment in time using space, and give an -time arithmetic test that determines whether the optimum is one or two. Combined with the algorithm of Kobert et al. for , our result yields an -approximation for every that runs in time and is therefore strongly polynomial. Additionally, our algorithm is so simple that it is easy to implement, making it amenable to practical adoption (e.g., in the existing software [AKS14, KDF+19]). The running time is also beneficial when assignments must be recomputed frequently. This occurs, for example, in fault-tolerant likelihood evaluation, where data are redistributed whenever processors fail or become available [HKH⁺21]. Another application arises in Metropolis-coupled MCMC for Bayesian phylogenetic inference, which runs several interacting chains at different temperatures in parallel [ADHR04]. When the available cores outnumber the chains, the likelihood computation within each chain can be divided across independent alignment sites. Treating chains as divisible items and cores as bins yields a many-bins instance in which per-step work is balanced while the maximum number of chains handled by any core is minimized.
Related work. Apart from the above-mentioned work motivating our study, we mention here literature on multiprocessor scheduling and bin packing. Load balancing is the most common target in classical multiprocessor scheduling, often under the name of makespan minimization. Indeed, the first theoretical results date back to the sixties [Gra66, Gra69]. The general problem on identical machines is NP-hard [Kar72]. However, preemptive jobs make the problem easy [McN59], and splittable (divisible) jobs, dividing jobs across identical machines without further constraints makes the problem trivial. Our problem is complicated by the objective of minimizing the maximum number of job fragments.
Other works on splittable (divisible) scheduling [KSV03, Ev06, CMSM⁺15, DJ19] divide jobs into fragments across identical or unrelated machines to minimize the makespan, but with the number of fragments bounded [KSV03, Ev06] or penalized, for instance, through (batch) setup times [CMSM⁺15, DJ19]. As its name suggests, there is also a relation to bin packing with item fragmentation. In early work on this problem [MR01, STY08, SY07], as well as in later publications [BGW19, CC14, Eki21], fragmentation comes at a price: increasing cost or size.
None of these related results are applicable in our setting, which fixes an exact load for every bin and minimizes the maximum number of fragments per bin, rather than the number of bins or the makespan.
LOAD BALANCING WITH ITEM FRAGMENTATION (LBIF) Input: A multiset , with , for all , and an integer . Output: The minimum value of over all matrices subject to:
- , for all .
- , for all , where .
We refer to the integers and as the load and the combinatorial load, respectively.
Items
Bins (load )

Figure 1: A simple example of an LBIF instance with items and bins and a solution with optimal combinatorial load 2: bin 2 contains fragments of both items.
To explain the LBIF problem informally and to streamline the presentation, we associate each element of the multiset S with an item and the integer B with the number of available bins. We are given N items of strictly positive integer size with total size . We must assign the items to bins, where items may be fragmented across bins. Each bin must receive a load of either or , ensuring that the loads of any two bins differ by at most one unit. Under this balancing constraint, the objective is to minimize the maximum number of item fragments placed into any single bin. See Figure 1 for an example. For simplicity of presentation, we use both for the item index and for its size if the meaning is clear from context. Otherwise, we use the index explicitly to avoid confusion.
The following results are known for LBIF.
Theorem 1.1 (Kobert et al. [KFAS14]). LBIF is NP-hard.
Theorem 1.2 (Kobert et al. [KFAS14]). There exists an (OPT + 1)-approximation algorithm for LBIF that runs in time.
From a theory standpoint, one would like a strongly polynomial-time approximation algorithm for LBIF. When , the -time (OPT + 1)-approximation algorithm of Kobert et al. [KFAS14] runs in polynomial time. In particular, when , their algorithm runs in time. We are thus motivated to study the regime . We denote the set of LBIF instances with by LBIF.
Our central contribution is an exact algorithm for LBIF that runs in the optimal time. Such a solution always has a combinatorial load of at most 2.
Theorem 1.3. There exists an algorithm for LBIF that runs in time and always returns an exact solution with combinatorial load at most 2. In particular, the assignment is output in a representation using space.
Proving Theorem 1.3 will be the focus of this paper. Combined with Theorem 1.2, Theorem 1.3 yields a strongly polynomial-time approximation algorithm for LBIF.
Corollary 1.4. There exists an (OPT + 1)-approximation algorithm for LBIF that runs in time.
Proof. After reading the item sizes, we compare with in time and run exactly one of the following two algorithms on the unchanged input. When , apply Theorem 1.2; its running time is because . When , apply Theorem 1.3; it returns an optimal assignment, which is in particular an (OPT + 1)-approximation, in time. The result follows.
1.2 Paper Organization and Overview of the Algorithm
We prove Theorem 1.3 by designing and analyzing an algorithm to solve LBIF in time and space. The overall algorithm works in several phases, each described as a simple algorithm. First, we check whether a solution with OPT = 1 exists. If so, we construct such an assignment. The characterization and algorithm for this case are deferred to Section 3. If no OPT = 1 solution exists, we apply the algorithm presented in Section 2. This algorithm is guaranteed to produce a solution with OPT . Running these two phases in sequence guarantees an optimal solution. Section 4 concludes the paper with some final remarks.
For the remainder of this paper, we assume . The special case is trivial to solve by simply assigning one element of size 1 to a total of bins.
2 Combinatorial Load at Most Two
In this section, we present an algorithm that always (i.e., for any input instance of LBIF) produces an assignment with combinatorial load at most 2. We first present the algorithm in Section 2.1 and analyze the behavior in Section 2.2.
Let be the average target load per bin rounded up. By simple calculation, is then the number of bins requiring target load . Indeed, since , we have , which implies , so . The multiset of strictly positive integers initially consists of the sizes of the items to be assigned. During the algorithm, we assign items or fragments of items from to bins and update each to always represent the size of the fragment of item that is still to be assigned. To facilitate the exposition, we define similarly as the multiset of target bin loads. We remove elements from once their corresponding bins are completely filled. We write and for the multisets consisting of elements in with value and , respectively. Elements of and elements of are called -bins and -bins, respectively. In the algorithm, we only keep track of their cardinalities and , respectively. Therefore, updating these numbers is easily done with constant overhead.
2.1 The Algorithm
Overview. The algorithm for constructing a solution with combinatorial load at most 2 is split into two parts. First, in Algorithm 1, we iterate over the items that are guaranteed to fill any bin completely, possibly filling more than one bin at a time. Afterwards, Algorithm 2 fills the remaining bins with fragments from at most two items. Full bins are removed from , and is updated on the fly by removing the fragments of the items used. Algorithm 1 is applied when , whereas Algorithm 2 is applied when . We will show that we run Algorithm 1 until , and from then on only run Algorithm 2.
Inside the algorithms, we maintain a partition of into and . The latter is the multiset of items that can each fill any bin completely. Since all sizes are integers, every item belongs to exactly one of the two multisets; in particular, an item of size exactly is small, even though it can fill an -bin on its own. The multisets , and will be updated in time as item fragments are consumed and produced. We assume that values reaching zero are automatically removed from these multisets.
The formal problem definition represents an assignment by a matrix . In the algorithms, we encode this matrix as a collection of records, also denoted by . Each record is a quadruple , where denotes the number of fragments of size from the item with index , and is either a bin index or the symbol . If is a bin index, then , and the record assigns one fragment of size from item to bin . The fragment need not fill the bin by itself. If several records have the same bin index , their fragments are assigned to the same bin, and their sizes together equal its target load. If , the record represents a batch of fragments of size from item . Each fragment is placed in a distinct empty bin whose target load is , such that each of these bins is filled by a single fragment. The record assigns a total size of from item . If , the remaining size stays in . The bin indices are omitted because bins with the same target load are interchangeable.
Every record stored in has . If the algorithm computes a multiplicity of zero, no record is added. Algorithm 1 uses only records with , whereas Algorithm 2 uses explicit bin indices to indicate which fragments are placed together.
2.1.1 The Case : Filling Empty Bins with Large Items
To keep the running time bounded by rather than , each iteration of the while loop in Algorithm 1 processes one large item. In that iteration, the item may be divided into fragments that fill several bins. Rather than recording a separate assignment for every bin, the algorithm adds at most two records to : one representing all -bins filled from the selected item and one representing all -bins filled from it.
In each iteration, Algorithm 1 selects an item from . It first fills as many -bins as possible. Once no such bins remain, it proceeds to fill the -bins. Concretely, Step 1 assigns fragments of size of item to as many -bins, and Step 2 then assigns fragments of size of the residual item to as many -bins, where
and , and in the definition of refer to the values after Step 1.
The first term in each of the definitions of and limits the assignment according to the remaining size of item . The second limits it according to the number of available bins of the relevant target load. The third, , prevents the number of remaining bins from falling below the number of remaining items. Each positive value or is stored in a single record, irrespective of how many bins it represents.
As we will argue in Observation 2.3, an item in is available as long as . Hence, each iteration fills at least one bin and removes at most one item. The algorithm continues until , at which point Algorithm 2 is applied to the remaining items and bins, together with the partial assignment .
Input: , bin target loads , target load while do Pick an item ▶ Step 1: fill entirely as many empty -bins as possible -fragments of into distinct -bins ; remove bins from if then remove from else reclassify into or ▶ Step 2: fill entirely as many empty -bins as possible -fragments of into distinct -bins ; remove bins from if then remove from else reclassify into or end return
Algorithm 1: The case : fill empty bins with whole fragments of a large item.
2.1.2 The Case : Filling a Bin with One Small Item and (a Fragment of) One Large Item
Once we have reached the point where , we continue to fill the bins one by one. In broad terms, in each iteration of Algorithm 2, exactly one bin and one item in will be removed by filling the bin with the item in complemented (if required) with a fragment of an item in . More precisely, an iteration picks any , any , and any remaining bin with target load , places into bin , and fills the residual capacity with a fragment of size of . Once or are empty, we can continue with a simple matching of items to bins (Observation 2.4). By this process, we can ensure that at most two items are assigned to any bin.
Notably, while is fully assigned and removed and is fully filled and removed in Algorithm 2, the item will never be fully removed in Step 3. Thus, is maintained.
2.2 Analysis
We will now show that Algorithm 1 and Algorithm 2 together do in fact compute a solution to any instance of LBIF with with combinatorial load of at most 2. The heart of our correctness proof is to show that the following invariants are maintained at every step:
Invariant 1. Before and after every iteration of Algorithms 1 and 2,
Invariant 2. Before and after every iteration of Algorithms 1 and 2,
Lemma 2.1. Invariants 1 and 2 hold before the start of the algorithm.
Proof. By the definition of , and , we have , so Invariant 1 holds initially. By the definition of the problem, Invariant 2 also holds initially.
Lemma 2.2. Algorithm 1 preserves Invariants 1 and 2.
Proof. Invariant 1: Step 1 removes bins of target load and reduces by . Step 2 removes bins of target load and reduces by . In both steps, the total remaining item size and the total
Input: , target loads with , target load , partial assignment while and do
► Step 1: pick a small item, a large item, and a bin
Pick any with index , any with index , and any
//
► Step 2: pack bin with and an -fragment of
Remove from ; remove from
► Step 3: update the residual large item
Replace by in
Reclassify the residual into or
end
while do
► Step 4: once or is empty, match the elements exactly
Pick any with index , and any
// exact-fit deposits
Remove from ; remove from
end
return
Algorithm 2: The case : fill each bin with one small item and possibly part of one large item.
remaining target load decrease by the same amount, preserving Invariant 1. Invariant 2: The factor in the calculation of and in Algorithm 1 ensures that the case cannot occur. Thus, Invariant 2 is preserved.
With the following observation, we can see that Algorithm 1 must terminate with . That is, while , there must be an element causing another iteration of Algorithm 1.
Observation 2.3. While , .
Proof. Assume . Then every satisfies . Thus, since ,
which contradicts Invariant 1. Hence, .
The following observation justifies the use of Step 4 in Algorithm 2.
Observation 2.4. While Invariant 1 holds, , and either or , then and for any pair of , .
Proof. Assume . We will show by contradiction that for any . Assume there exists an with . We obtain
which contradicts Invariant 1. Thus, for all . Now assume there exists a with size . That is, . We obtain
which again contradicts Invariant 1, proving our observation for the case . The argument for is analogous.
We use Observation 2.4 to prove the validity of the invariants for Algorithm 2 in the following lemma.
Lemma 2.5. Algorithm 2 preserves Invariants 1 and 2.
Proof. Invariant 1: Steps 2 and 3 of Algorithm 2 remove a bin of target load from , and item fragments of total size from . Thus, each iteration of the first while loop removes equal total values from and , preserving Invariant 1. Consequently, the invariant holds upon termination of the first while loop. By Observation 2.4, the first execution of Step 4 therefore removes identical values from and , preserving Invariant 1. The same reasoning applies inductively to every subsequent execution of Step 4.
Invariant 2: Step 2 removes one item from and one bin from . The item will not be removed, as for the remaining size, , we have: . Step 4 trivially removes one item and one bin per iteration. Thus, Invariant 2 is preserved in either case.
We observe that once we switch from Algorithm 1 to Algorithm 2, we will remain in Algorithm 2 until the end as in each iteration of Algorithm 2, we either solve the problem completely or remove exactly one element from and one from .
Lemma 2.6. Algorithm 1 and Algorithm 2 terminate with a valid assignment.
Proof. This follows directly from the invariants, Observations 2.3 and 2.4 and from the fact that, in every iteration, at least one bin is completely filled.
Lemma 2.7. In Algorithm 1 and Algorithm 2, any bin is filled with at most 2 item fragments in total.
Proof. Each bin is always assigned only one item (in Algorithm 1 or Step 4 of Algorithm 2) or one small item and part of one large item (in Step 2 of Algorithm 2).
Lemma 2.8. For any and , Algorithm 1 and Algorithm 2 construct an assignment with combinatorial load at most 2 in time using space.
Proof. The overarching algorithm consists of two phases: Algorithm 1 (while ) and Algorithm 2 (once ). All operations in both phases trivially take time. In each iteration of Algorithm 1, the cardinality of is reduced by one or the algorithm terminates. Thus Algorithm 1, goes through at most iterations. In Algorithm 2, in each iteration of either loop, the cardinality of is reduced by one. Thus, the total number of iterations in Algorithm 1 and Algorithm 2 together is bounded by , yielding total time.
The only non-constant space requirement comes from the assignment . Since at most two quadruples are added to during any iteration of either algorithm, and as argued before, the overall algorithm has iterations, the algorithm uses space.
The validity of the resulting assignment from the entire algorithm and its combinatorial load follow from Lemmas 2.6 and 2.7.
3 Combinatorial Load Exactly One
In the previous section, we presented an algorithm that finds an assignment with combinatorial load at most 2, for any instance. This is sufficient for Corollary 1.4, i.e., providing a strongly polynomial-time (OPT + 1)-approximation algorithm for LBIF (regardless of and ). However, our ultimate goal is Theorem 1.3: an exact algorithm for . Since Section 2 focused on providing an assignment with combinatorial load at most 2, all that remains is to provide a method for detecting whether an assignment with combinatorial load exactly 1 exists, and if so, constructing one. Recall the notation for the target load rounded up and for the number of bins with target load . As before, the trivial case is omitted.
The following observation is crucial for the design of our algorithm.
Observation 3.1. For any instance with OPT = 1, the size of each item must be representable as
where are the number of bins of target load and filled by fragments from , respectively. Furthermore, the number of -fragments must be of the form
for some integer .
Proof. The first part, , is trivial, as for any assignment with combinatorial load 1, any item must be assigned exactly to a combination of bins (each with target load or ). For the second part of the observation, broadly speaking, the argument boils down to the fact that after assigning all -sized fragments of to bins of target load , any remainder of , though possibly a remainder of 0, must be divisible by in order to fill up bins with target load exactly.
Let us first consider the minimal number of -sized fragments an item must contain in its decomposition into fragments such that the item size is divisible by ; i.e., the smallest number such that . Choosing , we obtain:
By the definition of , we have . Thus, is the smallest non-negative number that satisfies . For the term , we analyze the remaining item size after fragments of size have been assigned to as many -bins and removed. Let the remaining size to be distributed from item be denoted by . That is, , where . By the argument above, . Trivially, . Hence, must hold as well. Since and are coprime and thus, do not share a prime factor, it must be that for any OPT = 1 solution and can thus be written in the form .
Based on Observation 3.1, we describe an algorithm (see Algorithm 3 for pseudocode) that detects whether OPT = 1 and, if so, produces such an assignment. The algorithm proceeds in three steps, which we detail next. It uses the following quantities. For each item , is the number of forced fragments of size from Observation 3.1, and is their total number. The counter is the number of -bins that are still empty after the forced fragments have been placed; initially, . Finally, is the number of blocks of fragments of size each that Step 2 takes from item ; it plays the role of in Observation 3.1.
Step 1 iterates over all items in , computing . If , the algorithm correctly returns FAIL. If , we assign these fragments to empty bins of target load , each fragment filling one bin entirely. We deduct from . By construction, the updated size is now non-negative and divisible by .
The algorithm computes the total number . Recall that is the number of available bins with target load . If , a valid OPT = 1 packing is impossible, and the algorithm correctly returns FAIL. Otherwise, after depositing the forced fragments, empty bins of target load remain.
By Observation 3.1, any additional fragments of size extracted from an item must be extracted in blocks of fragments in order to preserve the item's divisibility by . Let us call such blocks full blocks. Therefore, the total number of remaining -bins across the entire instance must be a multiple of . If it is not, the algorithm correctly returns FAIL. If it is, then we proceed to Step 2.
Step 2 greedily fills the remaining bins with target load using full blocks. As verified, r is a multiple of . The algorithm iterates through the remaining available items. The loop terminates early when all -bins are filled.
We compute the number of full blocks that can be extracted from the remaining item size , i.e., after having extracted the fragments of size . Since each full block has total size , no more than
Input: , bin target loads , target load
► Step 1: forced -fragments foreach do if then return FAIL // ()-fragments of into distinct -bins end if then return FAIL if then return FAIL
► Step 2: bulk-fill remaining -bins in blocks of fragments foreach with while do // ()-fragments of into distinct -bins end if then return FAIL
► Step 3: fill the -bins foreach with do // -fragments of into distinct -bins end return
Algorithm 3: Combinatorial load of 1: Test whether an assignment with combinatorial load 1 exists, and if so, construct such assignment by decomposing the items into and fragments of size and , resp.
blocks can be extracted from . Moreover, in Step 2 we only fill the as of yet remaining empty -bins, and each block fills of them. Thus, no more than blocks are needed. Hence, .
In each iteration with , we take the minimum of these two values as and extract exactly fragments of size from item . These are assigned to the available distinct -bins. Then we deduct the deposited size from the item and decrease the number of remaining empty -bins by the exact number of bins we just filled. After iterating through all items, if , it means we exhausted all available item sizes but failed to fill all the -bins, in which case the algorithm returns FAIL. Otherwise, it proceeds to Step 3.
In Step 3, all -bins have already been filled. Furthermore, the remaining size of every item is guaranteed to be a multiple of . Therefore, it can be sliced into an exact integer number of -fragments, each of which we assign to a yet-empty -bin, thereby filling the bins with target load .
Lemma 3.2. For any instance with , Algorithm 3 checks whether OPT = 1 in time. If OPT = 1, an assignment with this value is constructed in time using space.
Proof. We first prove that Algorithm 3 returns a valid assignment with combinatorial load 1 if and only if such an assignment exists.
() We show that the algorithm returns a valid OPT = 1 assignment.
By construction, the algorithm assigns fragments of size only to -bins (Steps 1 and 2), and fragments of size only to -bins (Step 3). In Step 1, fragments are extracted from . The condition guarantees that is large enough to extract all fragments from it. In Step 2, full blocks of size are extracted. The condition similarly guarantees that, after removing the forced fragments, is large enough to contain blocks. Thus, all fragment sizes are valid. Furthermore, because at the end of Step 2, all bins of target load are completely filled. At the start of Step 3, the remaining size of every item is divisible by because, after subtracting the forced fragments to make the remainder divisible by (Step 1), we have only subtracted multiples of (Step 2). Therefore, Step 3 partitions the remaining item sizes into fragments of size . Since the total size is preserved and the -bins are full, the remaining total item size fills the remaining bins of target load . Thus, the maximum combinatorial load is exactly 1.
(⇐) If an OPT = 1 assignment exists, we must show the algorithm does not return FAIL.
By Observation 3.1, any valid OPT = 1 assignment must allocate exactly fragments of size from item . Therefore, every item must have a total size of at least ; otherwise, no such assignment could exist. Consequently, the check in Step 1 will correctly pass. The total number of forced fragments of size , , represents the minimum number of -bins required. If , no valid assignment can exist, so the algorithm passes this check. Furthermore, by Observation 3.1, the remaining bins of target load must be filled in blocks of of them to preserve the divisibility by of the items. This implies that must be divisible by . Thus, the check will also pass.
In Step 2, because is a multiple of and OPT = 1 guarantees that the number of fragments of size is sufficient to fill all remaining empty bins with target load , the full-block filling strategy fills all these bins. Thus, the algorithm will not fail in Step 2.
Finally, we analyze the complexity. Each item is processed a constant number of times, and all arithmetic operations are constant-time. Clearly, the calculation of line is dominated by the preceding loop. Therefore, the total running time is . The output assignment stores only one quadruple per deposited block, so it uses space.
The correctness of Algorithm 3 directly yields the following characterization.
Corollary 3.3. For any instance,
Here, is the number of -bins.
Lemmas 2.8 and 3.2 prove Theorem 1.3: we first run Algorithm 3 on a copy of the item sizes. If it returns an assignment, this assignment has combinatorial load 1 and is optimal. Otherwise, OPT 2 and we run Algorithm 1 followed by Algorithm 2 on the original item sizes, which by Lemma 2.8 yields combinatorial load at most 2, which is again optimal. Both phases take time and space.
4 Concluding Remarks
The main contributions of this paper are twofold.
From the results perspective, Theorem 1.3 and Corollary 1.4 improve on the widely used algorithm of Kobert et al. [KFAS14], and they may inspire improvements in other settings in parallel and distributed systems or in iterative algorithms that rebalance their workload at every step. In particular, Theorem 1.3 establishes that the otherwise NP-hard problem has a linear-time solution under assumptions that naturally arise in high-performance computing. Furthermore, the simplicity of the presented algorithm makes it readily applicable within existing scheduling frameworks.
From an educational perspective, our paper may serve as material for a class on mathematical optimization, showcasing a remarkably simple and optimal algorithm obtained through combinatorial insight. In particular, our algorithm makes no use of advanced data structures: it only uses standard arithmetic and set operations, making it especially suitable as teaching material since students can focus on the underlying ideas rather than on implementation details.
Declarations
We used an LLM to produce the TikZ code for Figure 1 based on a textual description we provided. Furthermore, LLMs generated feedback on the stylistic polishing of the final manuscript, which we then implemented ourselves where we thought it was useful. All technical content and ideas were developed and written by us, the human authors. We assume responsibility for all content.
References
[ADHR04] Gautam Altekar, Sandhya Dwarkadas, John P. Huelsenbeck, and Fredrik Ronquist. Parallel Metropolis coupled Markov chain Monte Carlo for Bayesian phylogenetic inference. Bioinformatics, 20(3):407–415, 02 2004. doi:10.1093/bioinformatics/btg427.
[AKS14] Andre J. Aberer, Kassian Kobert, and Alexandros Stamatakis. ExaBayes: Massively parallel Bayesian tree inference for the whole-genome era. Molecular Biology and Evolution, 31(10):2553–2556, 2014. doi:10.1093/molbev/msu236.
[BD97] Jacek Blazewicz and Maciej Drozdowski. Distributed processing of divisible jobs with communication startup costs. Discret. Appl. Math., 76(1-3):21–41, 1997. doi:10.1016/S0166-218X(96)00115-1.
[BGW19] Luca Bertazzi, Bruce Golden, and Xingyin Wang. The bin packing problem with item fragmentation: A worst-case analysis. Discrete Applied Mathematics, 261:63–77, 2019. doi:10.1016/j.dam.2018.08.023.
[BH07] Luiz André Barroso and Urs Hölzle. The case for energy-proportional computing. Computer, 40(12):33–37, 2007. doi:10.1109/MC.2007.443.
[CC14] Marco Casazza and Alberto Ceselli. Mathematical programming algorithms for bin packing problems with item fragmentation. Computers & Operations Research, 46:1–11, 2014. doi:10.1016/j.cor.2013.12.008.
[CMSM+15] José R. Correa, Alberto Marchetti-Spaccamela, Jannik Matuschke, Leen Stougie, Ola Svensson, Víctor Verdugo, and José Verschae. Strong LP formulations for scheduling splittable jobs on unrelated machines. Mathematical Programming, 154:305–328, 2015. doi:10.1007/s10107-014-0831-8.
[Cyb89] George Cybenko. Dynamic load balancing for distributed memory multiprocessors. Journal of Parallel and Distributed Computing, 7(2):279–301, 1989. doi:10.1016/0743-7315(89)90021-X.
[DG08] Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified data processing on large clusters. Communications of the ACM, 51(1):107–113, 2008. doi:10.1145/1327452.1327492.
[DJ19] Max A. Deppert and Klaus Jansen. Near-linear approximation algorithms for scheduling problems with batch setup times. In Christian Scheideler and Petra Berenbrink, editors, The 31st ACM on Symposium on Parallelism in Algorithms and Architectures, SPAA 2019, Phoenix, AZ, USA, June 22-24, 2019, pages 155–164. ACM, 2019. doi:10.1145/3323165.3323200.
[Eki21] Ali Ekici. Bin packing problem with conflicts and item fragmentation. Computers & Operations Research, 126:105113, 2021. doi:10.1016/j.cor.2020.105113.
[Ev06] Leah Epstein and Rob van Stee. Online scheduling of splittable tasks. ACM Transactions on Algorithms, 2(1):116–133, 2006. doi:10.1145/1125994.1125999.
[Fel81] Joseph Felsenstein. Evolutionary trees from DNA sequences: a maximum likelihood approach. Journal of Molecular Evolution, 17(6):368–376, 1981. doi:10.1007/BF01734359.
[GARK11] Benjamin Gufler, Nikolaus Augsten, Angelika Reiser, and Alfons Kemper. Handling data skew in mapreduce. In Frank Leymann, Ivan I. Ivanov, Marten van Sinderen, and Boris Shishkov, editors, CLOSER 2011 - Proceedings of the 1st International Conference on Cloud Computing and Services Science, Noordwijkerhout, Netherlands, 7-9 May, 2011, pages 574–583. SciTePress, 2011. doi:10.5220/0003391105740583.
[Gra66] Ronald L. Graham. Bounds for certain multiprocessing anomalies. Bell System Tech. J., 45:1563–1581, 1966. URL: https://fanchung.ucsd.edu/ron/papers/66_04_multiprocessing.pdf.
[Gra69] Ronald L. Graham. Bounds on multiprocessing timing anomalies. SIAM Journal on Applied Mathematics, 17(2):416–429, 1969. doi:10.1137/0117039.
[HKH+21] Lukas Hübner, Alexey M. Kozlov, Demian Hespe, Peter Sanders, and Alexandros Stamatakis. Exploring parallel MPI fault tolerance mechanisms for phylogenetic inference with RAXML-NG. Bioinformatics, 37(22):4056–4063, 2021. doi:10.1093/bioinformatics/btab399.
[Kar72] Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, The IBM Research Symposia Series, pages 85–103. Plenum Press, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
[KDF+19] Alexey M. Kozlov, Diego Darriba, Tomáš Flouri, Benoit Morel, and Alexandros Stamatakis. RAXML-NG: a fast, scalable and user-friendly tool for maximum likelihood phylogenetic inference. Bioinformatics, 35(21):4453–4455, 2019. doi:10.1093/bioinformatics/btz305.
[KFAS14] Kassian Kobert, Tomás Flouri, Andre J. Aberer, and Alexandros Stamatakis. The divisible load balance problem and its application to phylogenetic inference. In Dan Brown and Burkhard Morgenstern, editors, Algorithms in Bioinformatics - 14th International Workshop, WABI 2014, Wroclaw, Poland, September 8-10, 2014. Proceedings, Lecture Notes in Computer Science, pages 204–216. Springer, 2014. doi:10.1007/978-3-662-44753-6_16.
[KK98] George Karypis and Vipin Kumar. A fast and high quality multilevel scheme for partitioning irregular graphs. SIAM Journal on Scientific Computing, 20(1):359–392, 1998. doi:10.1137/S1064827595287997.
[KSF17] Kassian Kobert, Alexandros Stamatakis, and Tomáš Flouri. Efficient detection of repeating sites to accelerate phylogenetic likelihood calculations. Systematic Biology, 66(2):205–217, 2017. doi:10.1093/sysbio/syw075.
[KSV03] Piotr Krysta, Peter Sanders, and Berthold Vöcking. Scheduling and traffic allocation for tasks with bounded splittability. In Branislav Rovan and Peter Vojtás, editors, Mathematical Foundations of Computer Science 2003, 28th International Symposium, MFCS 2003, Bratislava, Slovakia, August 25-29, 2003, Proceedings, volume 2747 of Lecture Notes in Computer Science, pages 500–510. Springer, 2003. doi:10.1007/978-3-540-45138-9_44.
[KTR12] Lars Kolb, Andreas Thor, and Erhard Rahm. Load balancing for mapreduce-based entity resolution. In Anastasios Kementsietsidis and Marcos Antonio Vaz Salles, editors, IEEE 28th International Conference on Data Engineering (ICDE 2012), Washington, DC, USA (Arlington, Virginia), 1-5 April, 2012, pages 618–629. IEEE Computer Society, 2012. doi:10.1109/ICDE.2012.22.
[KYT20] Paschalia Kapli, Ziheng Yang, and Maximilian J. Telford. Phylogenetic tree building in the genomic age. Nature Reviews Genetics, 21(7):428–444, 2020. doi:10.1038/s41576-020-0233-0.
[LAP 14] Mu Li, David G. Andersen, Jun Woo Park, Alexander J. Smola, Amr Ahmed, Vanja Josifovski, James Long, Eugene J. Shekita, and Bor-Yiing Su. Scaling distributed machine learning with the parameter server. In Jason Flinn and Hank Levy, editors, 11th USENIX Symposium on Operating Systems Design and Implementation, OSDI '14, Broomfield, CO, USA, October 6-8, 2014, pages 583–598. USENIX Association, 2014. URL: https://www.usenix.org/conference/osdi14/technical-sessions/presentation/li_mu.
[LSS22] Dimitrios Los, Thomas Sauerwald, and John Sylvester. Balanced allocations: Caching and packing, twinning and thinning. In Joseph (Seffi) Naor and Niv Buchbinder, editors, Proceedings of the 2022 ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, Virtual Conference / Alexandria, VA, USA, January 9 - 12, 2022, pages 1847–1874. SIAM, 2022. doi:10.1137/1.9781611977073.74.
[McN59] Robert McNaughton. Scheduling with deadlines and loss functions. Management Science, 6(1):1–12, 1959. URL: http://www.jstor.org/stable/2627472.
[MFS17] Benoit Morel, Tomás Flouri, and Alexandros Stamatakis. A novel heuristic for data distribution in massively parallel phylogenetic inference using site repeats. In 19th IEEE International Conference on High Performance Computing and Communications; 15th IEEE International Conference on Smart City; 3rd IEEE International Conference on Data Science and Systems, HPCC/SmartCity/DSS 2017, Bangkok, Thailand, December 18-20, 2017, pages 81–88. IEEE Computer Society, 2017. doi:10.1109/HPCC-SMARTCITY-DSS.2017.11.
[MHH 22] Dheevatsa Mudigere, Yuchen Hao, Jianyu Huang, Zhihao Jia, Andrew Tulloch, Srinivas Sridharan, Xing Liu, Mustafa Ozdal, Jade Nie, Jongsoo Park, Liang Luo, Jie Amy Yang, Leon Gao, Dmytro Ivchenko, Aarti Basant, Yuxi Hu, Jiyan Yang, Ehsan K. Ardestani, Xiaodong Wang, Rakesh Komuravelli, Ching-Hsiang Chu, Serhat Yilmaz, Huayu Li, Jiyuan Qian, Zhuobo Feng, Yinbin Ma, Junjie Yang, Ellie Wen, Hong Li, Lin Yang, Chonglin Sun, Whitney Zhao, Dimitry Melts, Krishna Dhulipala, K. R. Kishore, Tyler Graf, Assaf Eisenman, Kiran Kumar Matam, Adi Gangidi, Guoqiang Jerry Chen, Manoj Krishnan, Avinash Nayak, Krishnakumar Nair, Bharath Muthiah, Mahmoud khorashadi, Pallab Bhattacharya, Petr Lapukhov, Maxim Naumov, Ajit Mathews, Lin Qiao, Mikhail Smelyanskiy, Bill Jia, and Vijay Rao. Software-hardware co-design for fast and scalable training of deep learning recommendation models. In Valentina Salapura, Mohamed Zahran, Fred Chong, and Lingjia Tang, editors, ISCA '22: The 49th Annual International Symposium on Computer Architecture, New York, New York, USA, June 18 - 22, 2022, pages 993–1011. ACM, 2022. doi:10.1145/3470496.3533727.
[MR01] Nir Menakerman and Raphael Rom. Bin packing with item fragmentation. In Frank K. H. A. Dehne, Jörg-Rüdiger Sack, and Roberto Tamassia, editors, Algorithms and Data Structures, 7th International Workshop, WADS 2001, Providence, RI, USA, August 8-10, 2001, Proceedings, volume 2125 of Lecture Notes in Computer Science, pages 313–324. Springer, 2001. doi:10.1007/3-540-44634-6\29.
[SKFS16] Constantin Scholl, Kassian Kobert, Tomáš Flouri, and Alexandros Stamatakis. The divisible load balance problem with shared cost and its application to phylogenetic inference. In 2016 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW), pages 408–417. IEEE, 2016. doi:10.1109/IPDPSW.2016.38.
[ST19] Shumpei Shiina and Kenjiro Taura. Almost deterministic work stealing. In Michela Taufer, Pavan Balaji, and Antonio J. Peña, editors, Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC 2019, Denver, Colorado, USA, November 17-19, 2019, pages 47:1–47:16. ACM, 2019. doi:10.1145/3295500.3356161.
[STY08] Hadas Shachnai, Tami Tamir, and Omer Yehezkely. Approximation schemes for packing with item fragmentation. Theory Comput. Syst., 43(1):81–98, 2008. doi:10.1007/S00224-007-9082-X.
[SY07] Hadas Shachnai and Omer Yehezkely. Fast asymptotic FPTAS for packing fragmentable items with costs. In Erzsébet Csuhaj-Varjú and Zoltán Ésik, editors, Fundamentals of Computation Theory, 16th International Symposium, FCT 2007, Budapest, Hungary, August 27-30, 2007, Proceedings, volume 4639 of Lecture Notes in Computer Science, pages 482–493. Springer, 2007. doi:10.1007/978-3-540-74240-1_42.
[VGR03] Bharadwaj Veeravalli, Debasish Ghose, and Thomas G. Robertazzi. Divisible load theory: A new paradigm for load scheduling in distributed systems. Clust. Comput., 6(1):7–17, 2003. doi:10.1023/A:1020958815308.
[WL08] Dong Hyuk Woo and Hsien-Hsin S. Lee. Extending amdahl’s law for energy-efficient computing in the many-core era. Computer, 41(12):24–31, 2008. doi:10.1109/MC.2008.494.