Multiple Hungarian Method for k -Assignment Problem

: The k -assignment problem (or, the k -matching problem) on k -partite graphs is an NP-hard problem for k ≥ 3. In this paper we introduce ﬁve new heuristics. Two algorithms, B m and C m , arise as natural improvements of Algorithm A m from (He et al., in: Graph Algorithms And Applications 2, World Scientiﬁc, 2004). The other three algorithms, D m , E m , and F m , incorporate randomization. Algorithm D m can be considered as a greedy version of B m , whereas E m and F m are versions of local search algorithm, specialized for the k -matching problem. The algorithms are implemented in Python and are run on three datasets. On the datasets available, all the algorithms clearly outperform Algorithm A m in terms of solution quality. On the ﬁrst dataset with known optimal values the average relative error ranges from 1.47% over optimum (algorithm A m ) to 0.08% over optimum (algorithm E m ). On the second dataset with known optimal values the average relative error ranges from 4.41% over optimum (algorithm A m ) to 0.45% over optimum (algorithm F m ). Better quality of solutions demands higher computation times, thus the new algorithms provide a good compromise between quality of solutions and computation time.


Motivation
Suppose we have k sets of vertices V 1 , V 2 , . . ., V k and we want to consider multi-associations between them.For example, in bioinformatics, V 1 can correspond to the set of known (relevant) diseases, V 2 to the set of known drugs, and V 3 to the set of known genes that are relevant for the observed species (e.g., for Homo Sapiens).Multi-association in this case is a triple which means that disease v 1 , drug v 2 , and gene v 3 are related.Such a triple may imply that the gene v 3 is activated in disease v 1 and is usually silenced by drug v 2 , hence drug v 2 may be considered to be the cure for disease v 1 .This is related to the very vibrant area of drug re-purposing and precision medicine, see e.g., [1][2][3].We can represent the data as a complete 3-partite graph where the vertex set is V 1 ∪ V 2 ∪ V 3 and the edges between vertices from different V i have weights equal to the strength of the association between the ending vertices.Each triple (v 1 , v 2 , v 3 ) is therefore a complete subgraph (3-clique, triangle) of such a graph and its weight is the sum of the weights on its edges.
If we want to find a decomposition of this graph into disjoint triangles with a maximum (minimum) total weight, we obtain the 3-assignment problem (3-AP) [4][5][6][7].The 3-AP can also serve as a model in production planning when we try to assign e.g., workers, machines, and tasks in a way that each worker gets exactly one task at one machine and the total cost is minimal.Many more applications can be found in the literature, see cf. [8] or [9], and the references therein.

Problem Formulation
Let G = (V, E, w) be a complete weighted k-partite graph where is the vertex set, V i are the vertices of the i-th partition with cardinality |V i | = n, E = 1≤i<j≤k {uv | u ∈ V i , v ∈ V j } is the edge set, and w : E → R is the weight function that may be given in terms of matrices W ij as w(e) = W ij uv for e = uv, u ∈ V i , v ∈ V j .A k-clique is a subset Q ⊂ V with cardinality k, such that the induced graph G[Q] is isomorphic to the complete graph K k .This means that a k-clique has exactly one vertex from each V i .In the case when G is a k-partite graph, a k-clique can be also called a k-association.The weight of a k-clique Q, w(Q), is the sum of the edge weights of G[Q]: w(e).
In a complete k-partite graph where each partition has cardinality n, we can always find n pairwise disjoint k-cliques Q = {Q 1 , Q 2 , . . ., Q n }.We call such a set of cliques a k-assignment or k-matching, since this is a natural extension of 2-assignments or 2-matchings in the bipartite graphs.Naturally, we define the weight of k-assignment Q as The k-assignment problem, or equivalently, the k-matching problem (k-AP) (1), is the problem of finding a k-assignment of a given k-partite graph G with the minimum weight: In the literature [4][5][6]10], this problem is also referred to as the multidimensional assignment problem (MAP).For the case k = 3 we can also trace the name 3-index assignment problem or 3-dimensional assignment problem in the literature.When k = 2, it is well-known that the Hungarian algorithm solves the 2-assignment problem to optimality [11] in polynomial time.Kuhn used this name for the method because his invention of the algorithm is based on the work of two Hungarian mathematicians, D. König and E. Egervary.We observe that sometimes the researchers use word matching if the weights on the graph edges are all equal to 1, while for the general case they use assignment.
In this paper, we will also consider the maximum version of (1) because we want to compare our heuristic algorithms with some algorithms from the literature correctly.To make a clear distinction, we use subscripts m and M in the names of heuristic algorithms to denote that we are solving (1) with minimum and maximum objective, respectively.
We conclude the subsection with a useful observation.For k > 2, every k-assignment Q implies a 2-assignment on G[V i ∪ V j ], for all i = j.Thus Q gives rise to ( k 2 ) 2-assignments M i,j , 1 ≤ i < j ≤ k, between partitions V i and V j .Therefore, a k-assignment Q defines ( k ) -assignments on subgraphs of G induced on ( k ) different -partitions.

Literature Review
The problem has been extensively studied in the past.Here we briefly mention some of the relevant results and cite some previous work without the intention to review the literature completely.The problem called 3-dimensional matching (3DM) has already appeared among the NP-hard problems in Karp's [12] seminal paper.This problem is related to the question of whether there exists a 3-assignment in a 3-partite graph if the partitions of the graph have the same cardinality but the graph is not necessary a complete k-partite graph.
According to [8], 3DM is a special case of the 3-assignment problem with maximum or minimum objective, which they call the axial 3-index assignment problem, hence Karp's result [12] implies that both minimization and maximization versions of 3-assignment problems are NP-hard.
If k = 3 and if we consider only the weights on the triples Q i which must be 0 or 1, then there exists a ( 23 − ε)-approximation algorithm [13].If the weights on the triangles are arbitrary, there exists a ( 1 2 − ε)-approximation algorithm [14].
For the minimization version of the problem, it is known [15] that there is no polynomial time algorithm that achieves a constant performance ratio unless P=NP and the result holds even in the case when the clique weights are of the form for all i, j, k (i.e., for the problem defined here as (1)).However, when the triangle inequality holds, Crama and Spieksma show that there is a 4  3 -approximation algorithm [15].Hence, it is justified to apply heuristics to find near optimal solutions of the 3-AP and in general for k-AP problem instances.In the literature, various heuristics are reported that were designed to handle the k-assignment problem, many focusing on the 3-AP.We mention some of them to illustrate the variety of ideas elaborated.Aiex et al. [16] adopted the heuristic called Greedy Randomized Adaptive Search Algorithm.Huang and Lim in [17] described a new local search procedure which solves the problem by simplifying it to the classical assignment problem.Furthermore, Huang and Lim hybridized their heuristic with a genetic algorithm.An extension of the Huang and Lim heuristic [17] to the multidimensional assignment problem was done in [18,19], while [20] developed another new heuristic named Approximate muscle guided beam search, using the local search of [17].Karapetyan and Gutin [21] devised a memetic algorithms with an adjustable population size technique and with the same local search as Huang and Lim for the case of 3-AP.The size was calculated as a function of the runtime of the whole algorithm and the average runtime of the local search for the given instance.According to Valencia, Martinez, and Perez [22] this is the best known technique to solve the general case of k-AP.These authors performed an experimental evaluation of a basic genetic algorithm combined with a dimensionwise variation heuristic and showed its effectiveness in comparison to a more complex state-of-the-art memetic algorithm for k-AP.Some other approaches were recently proposed for solving 3-AP [23], the so-called Neighborly algorithm, modified Greedy algorithm with some of the steps used by the Auction algorithm [24], and a probabilistic modification of the minimal element algorithm for solving the axial three-index assignment problem [25], where the idea was to extend the basic greedy-type algorithmic schemes using transition to a probabilistic setup based on variables randomization.
The k-assignment problem can be also formulated as an integer (0-1) linear programming problem in n k binary variables.This approach yields some interesting theoretical results, but has very limited practical impact due to the huge number of binary variables.More details can be found in [5,26].Some recent results related to special variants of the k-assignment problem can also be found in [23,27].An exact algorithm for 3-AP is proposed by Balas and Saltzman [4].For more information on related work we refer to [8,9] and the references there.
The idea to use the Hungarian algorithm for 2-AP as a tool to attack the k-AP first appears in [28], where the algorithm named A m (see the descriptions in the next section) for the approximate solution to the minimal k-assignment problem and an algorithm A M for the approximate solution to the maximal k-assignment problem (or the maximal k-clique problem) of a weighted complete k-partite graph is given.In [28] it is experimentally shown that the Cubic Greedy Algorithms are better than the Random Select Algorithm and that Algorithms A m and A M are better than the Cubic Greedy Algorithms.For k = 4, it is also shown that Algorithms A m and A M are better than the 4-clique Greedy Algorithm.

Our Contribution
As the (1) problem is NP-hard for k ≥ 3, it is natural to ask whether one can design a useful heuristic based on the Hungarian algorithm that efficiently solves the k = 2 case to optimality.The first work along this avenue is the implementation of Algorithm A from [28].We continue the research with the main goal to understand how much the ideas of the Hungarian algorithm can contribute to performance of the heuristics.To this aim, we design several heuristics that are based on the Hungarian algorithm.Our experimental results show that all the algorithms improve the quality of the solutions compared to A, and some of our algorithms are a substantial improvement over the basic algorithm A (see Table 2).We also show that this type of heuristics can provide near optimal solutions for the k-assignment problem of very good quality on the datasets with known optimal values (see Tables 3 and 4).
The experiments are run on two datasets from the literature, one of them providing optimal solutions for the instances.In addition, we run two batches of experiments including instances generated by nonuniform distribution, in contrast to other datasets where the uniform distribution is used.Due to intractability of the k-assignment problem, it is not a surprise that our experimental study shows limitations of particular heuristics.Therefore we also introduce two randomized versions of heuristic algorithm C that lead to local search type heuristics that are observed to be improving the quality of solutions over time and may converge to the optimal solution.In this way we complement the quick heuristics with some alternatives that trade much longer computational times for quality of solutions.Hence we show that the heuristics for the k-assignment problem that are based on the Hungarian algorithm may be a very competitive choice.
The main contributions of this paper are the following: 1.
We design five new heuristics for (1).More precisely, we propose algorithms named B, C, D, E, and F for finding near optimal solutions to the (1).(All the algorithms have both the minimization and maximization versions, that are respectively denoted c.f. X m and X M , for algorithm X.) The algorithms rely on heavy usage of the Hungarian algorithm [11] and arise as natural improvements of Algorithm A m from [28].The last two algorithms, E and F, can be considered as versions of iterative improvement type local search algorithms, as opposed to the steepest descent nature of, e.g., C.

2.
We implement and test the algorithms on three datasets: (a) The set of random graphs generated as suggested in [28].Here we also reproduce their results.(b) We design two random datasets using both the uniform and a nonuniform distribution for the second batch of experiments.(c) We test our algorithms on the dataset of hard instances from [15], for which the optimal solutions are known.

3.
Our experimental results show that (on all datasets used) all the algorithms improve the quality of the solutions compared to algorithm A. We also observe the algorithms performance considering the quality of solutions versus computation time.
The rest of the paper is organized as follows.In Section 2 we introduce the notation that is used throughout the paper, and in Section 3 we outline the algorithms.In Section 4 we provide results of our experiments, where we evaluate the existing and the new algorithms on the three datasets.In Section 5 we summarize the results and discuss the methods of choice.

From k-Assignment Problem to 2-Assignment Problem
The Hungarian method [11] is a classical and polynomial-time exact method for solving the 2-assignment problem, therefore it is very natural that we explore the idea to find near optimal feasible solutions of k-assignment problem by solving a series of 2-assignment problems.
Below we are going to present several new algorithms for (1), which strongly rely on the repetitive use of the Hungarian method on selected bipartite subgraphs and contracting the original graphs along the assignments computed by this method.Note that all algorithms return feasible solutions because we have a complete k-partite graph where the Hungarian method always finds an optimum solution for any induced graph G[V i ∪ V j ], which can be easily used to reconstruct a feasible solution of (1) via operator * , see Section 3. Given an -partite weighted graph G and a 2-assignment M i,j between partitions V i and V j of G, we wish to contract the (weighted) edges which constitute M i,j in G.We therefore associate to M i,j the quotient graph The construction is explained in more detail below.The new weight function of G/M i,j is obtained by summing the weights of contracted edges adjacent to M i,j .Formally, the vertices of G/M i,j are the equivalence classes consisting of either the singleton {v} if the vertex v is not adjacent to an edge in the assignment M i,j or {u, v} if uv is an edge in M i,j .Loosely speaking, in G/M i,j , pairs of elements of V i and V j are merged along M i,j to form a new partition U while the other By construction, the elements of U and V are equivalence classes, and formally we have {u, v} = [u] = [v] and {u} = [u].However, we will (warning that it is abuse of notation) often not distinguish between V and V , (i.e., identify V = V ) and also consider the elements of U as sets of two elements, the union of two singleton sets.Formally, G/M i,j = (V , E , w ), is the graph with the vertex set and the edge set Or, recalling the simplified notation above, simply E i ,j = E i,j .
The new weight function is defined by summing the weights on the edges adjacent to the identified vertices In other words, the weights on E i ,j = E i,j are not changed, and the weights on the edge set F are the weights of pairs of edges that were contracted to obtain triangles {u, v, v }.

Algorithms
In this section we first recall Algorithm A m for (1) from [28] and then enhance it using different well-known greedy and local search approaches.Let A be a set and f a function the set of minimal elements in A under the function f .Let M i,j be an arbitrary assignment between the i-th and j-th partition and let M be a (k − 1)-assignment for the (k − 1)-partite graph G/M i,j .We denote by M * M i,j the unique k-assignment for G reconstructed from M and M i,j , i.e.,
For an example see Figure 1.In the case when G is a bipartite graph, G/M i,j contains only one partition and thus does not allow any assignment, for completeness we thus define ∅ * M i,j = M i,j .Recall that in the case n = 2 an optimal 2-assignment can be found using the Hungarian algorithm [11].The result of this algorithm on bipartite graph G will be denoted by HUNGARIAN(G).Algorithm 1, A m .The following algorithm, which we denote by A m , for finding near optimal solution for the minimal k-assignment problem of k-partite graph G has been proposed in [28].
In short, the algorithm finds an optimal 2-assignment for , takes the quotient by this assignment and recursively repeats this process.The final result is a complete k-assignment M reconstructed from the previously computed (k − 1)-assignments.
In Algorithm A m we first compute the optimal assignment M 1,2 between partitions V 1 and V 2 (Figure 1a), then we compute the quotient graph G/M 1,2 , presented in Figure 1b, and finally we compute the optimal assignment for this graph (Figure 1c).At the end, we reconstruct the 3-assignment M and obtain a solution of weight 44 (Figure 1d).Algorithm 2, B m .Algorithm A m is greedy in the sense that it takes (lexicographically) the first pair of partitions and merges them according to the best assignment among them.If the order of partitions is changed, A m would provide a different result.The idea of B m is to consider all the pairs for possible first merge, and take the best result.Note that B m is also greedy as it always takes the minimal assignment between the two partitions that are merged.(In a sense, one may say that B m is somehow more greedy than A m because it looks a bit farther for the seemingly best option in sight.) Algorithm B m searches through all possible pairs (V i , V j ) of partitions, recursively runs on the quotient graph G/M, where M is the optimal 2-assignment on V i ∪ V j , and among these partitions chooses the one with the best assignment of G/M.If there are more minimal partitions, the algorithm chooses a random partition of minimal weight.Clearly, Algorithm B m returns a k-assignment that is determined by the (k − 1) 2-assignments that were chosen in the recursive calls of B m .
Example 2. We take the same graph as in Example 1.In contrast to A m , Algorithm B m finds optimal assignments M 1,2 , M 1,3 , and M 2,3 for the induced subgraphs G see Figure 2a-c, respectively.The algorithm continues its search recursively on the bipartite graphs G/M 1,2 , G/M 1,3 , and G/M 2,3 .As Figure 2b shows, we obtain a k-assignment of weight 40.Algorithm 3, C m .Observe that Algorithm B m is much more time consuming than Algorithm A m as it calls the Hungarian algorithm subroutine times as opposed to only (k − 1) calls by Algorithm A m .However, note that Algorithm B m is greedy because it always takes the minimal 2-assignment.As the k-assignment problem (for k > 2) is intractable, a deterministic greedy algorithm can not solve the problem to optimality unless P=NP.We therefore consider an iterative improvement of the solutions by taking a nearly optimal solution (that may be the result of B m ) to define an initial solution.The neighbors of the given solution are the results of the following procedure: fix one of the 2-assignments, say M, and run Algorithm B m on G/M.After repeating the process by fixing all 2-assignments, we get a set of new solutions.If at least one of them is an improvement over the previously known best solution, we continue the improvement process.The process stops when there is no better solution among the set of new solutions.
The third algorithm, denoted as Algorithm C m , can be considered as a steepest descent algorithm on the set of all k-assignments, where the next solution is chosen to be a minimal solution in a suitably defined neighborhood., since the initial 3-assignment was already obtained from G/M 1,3 ).As Figure 3 shows, the best solution of weight 37 is obtained from contracting M 2,3 .If we continue with the iteration, we can see that the solution has stabilized and no further improvements can be made.
Note that Algorithm D m has the shortest average running time among algorithms B, C, and D. On the other hand, it is at the same time also the most short-sighted greedy algorithm among the rest of the algorithms, since its choice is based on the quality of the 2-assignment at hand, w(M), and not by looking at the quality of w(G/M).Algorithm 5, E m .The algorithms considered above were in principle deterministic.Except breaking ties randomly in case of more than one minimal choice, all the steps are precisely defined, i.e., the algorithms are deterministic.In the final experiment, we are interested in the effect of randomization.
The next algorithm, E m , is an alternative randomized version of C m .The main idea is to loop through all 2-assignments in random order and accept the first assignment M i,j that yields a better solution, instead of searching for the minimal 2-assignment M i,j .Thus algorithm E m is obtained by changing the main loop of C m .As algorithm E m accepts the first better solution in the neighborhood of the current solution, it is a kind of iterative improvement algorithm as opposed to C m , which is a steepest descent type search algorithms, because it always looks for the best solution in the neighborhood.

return M
We denote by E m (n) the algorithm that takes the best solution of E m out of n trials (restarts).
Algorithm 6, F m .The Algorithm E m stops when there is no better solution, even if there are solutions of the same quality (weight) in the neighbourhood of the current solution.These neighborhood solutions might later give improvement, therefore we introduce another variant, called F m (n), which in such case chooses randomly one solution of equal weight and continues, but stops after at most n steps, since it does not necessarily terminate (e.g., it can iterate between two equally good solutions).
Algorithm 6 (F m , multistart local search) for counter = 1, . . ., n do 5: if last_assignment in assignments then return M All of the above algorithms can be easily adapted to solve maximization assignment problems, i.e., to solve (1) where the objective is maximum.We denote the maximization variants of the algorithms A, B, C, D, E and F by A M , B M , C M , D M , E M , and F M , respectively.Remark 1.Clearly, the algorithms C, D, E, and F always return a feasible assignment because any solution is obtained by a recursive call of B. However, many calls of B and thus many runs of the Hungarian algorithm are expensive in terms of computation time.Therefore, it is an interesting question whether the present local search heuristics may be sped up by considering other neighborhoods, example applying the idea of variable neighborhood search [29].

Numerical Results
In this section, we present numerical evaluations of the algorithms introduced in Section 3. We compare them with the algorithms from [28] and to each other.In particular, we

•
reproduce the results on random graphs as given in [28] and compare them with the results of our Algorithms B m to F m and their maximization variants B M to F M , • evaluate the performance of the algorithms against A M as the number of vertices increases, test our algorithms on the instances provided in [15].

Datasets
Numerical evaluations are done using three sets of random complete k-partite graphs.The first set was constructed according to [28], as follows: It consists of two sets of 1000 random complete k-partite graphs with k = 3, 4 and n = 30, 100, respectively.The weights on the edges were selected randomly from given set S with probability density function p The second dataset is our contribution.It has been designed to compare how our algorithms scale with increasing size of the instances.It consists of two subsets, each consisting of instances with k = 3 and k = 4.The first subset was generated as follows.For each k ∈ {3, 4} we range the number of vertices n in each partition from 2 to 100 and the weights on edges connecting vertices from different partitions are chosen randomly according to discrete uniform distribution on the set S = {0, . . ., n − 1}.The second subset was obtained similarly, we only changed the distribution of the edge weights.The edges between the different partitions are assigned random weights chosen according to discrete uniform distribution on the set S = {2 0 , 2 1 , . . ., 2 10 }.We expect that these random instances are more difficult, because the very important edges are sufficiently rare.For each pair k, n we generated 1000 random instances.
The third set is the same as in [15].For this set, the optimum value of 3-AP is known.We retrieved it from [30].This dataset includes 18 instances of complete 3-partite graphs: • 6 graphs with 33 vertices and 6 graphs with 66 vertices in each of the 3 partitions, where the weights of edges between different partitions are random integers which should, according to the description given by the authors [30], range from 0 to 99.However, we point out that some of the weights in these instances are larger than 100.• 3 graphs with 33 vertices and 3 graphs with 66 vertices in each partition, where the weights take only values 1 or 2. We call these graphs binary graphs.
At the beginning of the web page [30] it is explained how the numerical results from [15] relate to these instances.

First Experiment-Dataset from He et al. (2004)
In the first experiment we compare the algorithms used in [28] (namely, the Random, Greedy, and A M algorithm) with our Algorithms B M , C M , D M , E M , E M (10), and F M (100) on the first set of random k-partite graphs, which we generated as described in [28], see Section 4.1.We run these 5 algorithms on each group of 1000 graph instances and report the average values in Tables 1 and 2.
Table 1.Comparison of Random, Greedy and A M algorithms from [28] with B M to F M algorithms for the maximization version of 3-AP.Each row contains average values of solutions obtained by these algorithms, computed over 1000 random instances of complete k-partite graphs with n vertices, which are generated as described in Section 4.1.We can see that Algorithms B M to F M return substantially better results.[28], and by our Algorithms B m to C m over 1000 random complete 3-partite graphs, respectively.We can see that our Algorithms B m to F m outperform the algorithms from [28].In order to compare the algorithms with A m (resp.A M ), we define the relative gap with respect to the value obtained by A m (resp.A M ) by

Second Experiment on Random Instances
In this subsection we compare Algorithms B M , C M , D M , E M , E M (10), and F M (100) on the second dataset, introduced in Section 4.1.We run all three algorithms on each of two subsets, consisting of 1000 instances for each pair (k, n) ∈ {3, 4} × {2, 3, 4, . . ., 100}.For each pair (k, n) and each algorithm, we compute the average value of solutions given by the algorithm over the corresponding 1000 instances.Then, we compute quotients of the average values for B M and for A M and denote it by B M /A M .Similarly we compute quotient C M /A M , and so on.Figures 4-7 contain plots and interpretations of these quotients.
The results on the first subset (with uniform distribution of weights) are depicted on Figures 4 and 5.They show that Algorithm E M (10) clearly finds the best solutions.The Algorithms C M , E M and F M (100) perform similarly, and are clearly outperforming B M and D M .Note that taking into account time complexity and considering k = 3, the clear winners among the faster algorithms (A M , B M , C M , D M , and E M ) are C M and E M , and among the more time consuming E M (10) and F M (100), the winner is E M (10).Note that E M (n) may potentially find even better solutions with larger n (and consequently may need more time).The differences are much less obvious for k = 4 (see Figure 5).With larger n, the ratios seem to stabilize at certain constants.
Considering the results on the first dataset (Table 1) and the first sample of the second dataset (Figures 4 and 5) suggest that there is no significant difference in quality of solutions among the algorithms C, E, and F. However, the results on the second subset (the set with a special distribution of weights), in particular for k = 3, show that Algorithms C, E, and F substantially outperform B and D (see Figure 6), and the differences of ratios tend to grow with larger n.This allows us to conclude that Algorithms C M , E M (n) and F M (n) are significantly better than B M and D M (at least on most of our instances).For k = 4 (see Figure 7), the differences are small again.   .Algorithm E M (10) outperforms the others.However, the ratios seem to stabilise at a constant factor.
Remark 2. When experimentally testing the performance of heuristics, it is well known that random instances are often among the simplest and many heuristics perform remarkably well on such datasets.It is often difficult to generate instances that are hard, or better to say, that are hard for a specific heuristic algorithm.The dataset generated using a nonuniform distribution of weights is obviously harder for the algorithms B and D. It may be of some interest to see what distribution of weights may show further significant differences in performance among the algorithms that are of interest here.

Third Experiment-Dataset Crama and Spieksma (1992)
In this subsection, we compare Algorithms A m , B m , C m , D m , E m , E m (10), and F m (100) with the optimal solution of 3-AP on the problems from the second database, which were taken from [30], see also Section 4.1.
For these instances, we know the optimum value of 3-AP (denoted by OPT), so we can report the relative gap, defined by δ = 100 • val − OPT OPT .
The results are given in Table 3 for non-binary problems and in Table 4 for binary problems.For non-binary graphs, with results presented in Table 3, Algorithms C m , E m , E m (10), and F(100) have, as expected, the best performance and on average differ from the optimal solution by 0.1% or less (see last row in Table 3).In addition, they are in some cases also able to find the optimal solution.
For binary graphs, with results presented in Table 4, we can observe that the relative performances are, due to the low weight sum, worse than those of non-binary graphs.As the problems are binary, a solution that differs from the optimal in one element may have, due to small total weight of the assignments, a considerably large relative error.As in the case of non-binary graphs, C m , E m , E m (10), and F(100) outperform A m , B m , and D m .Algorithm F m (100) finds the optimal solution in most cases (see the last column), and Algorithms C m , and E m find the optimal solution in some cases.
We point out that these algorithms are fast.Our implementation, which could be further optimised, takes a fraction of a second (on a 3.0 Ghz PC) on each of these instances.Relative computation times (relative to algorithm A) and average relative errors (compared to known optimal solutions) are evident from Figure 8. .This diagram contains graphical representations of average (normalized) times (in logarithmic scale) needed for non-binary instances from [30] computed in Table 3 and relative errors rel(with respect to the optimal value OPT).Algorithms A m , B m , C m , D m , and E m are considered fast, while E m (10) and F m (100) are comparably slow.

Summary and Conclusions
We have introduced Algorithms A, B, C, D, E, and F to approximately solve (1).The algorithms are all based on extensive use of the Hungarian algorithm and thus arise as natural improvements of Algorithm A from [28].Algorithms A, B, C, and D are in principle deterministic, whereas Algorithms E and F incorporate randomization.We implemented the algorithms in Python and evaluated them on three benchmark datasets.Numerical tests show that new algorithms in minimization or maximization variant, in terms of solution quality, outperform A on all of the chosen datasets.Summing up, our study shows that multiple usage of the classic Hungarian method can provide very tight solutions for (1), in some cases even an optimal solution.
Another important issue when regarding algorithms' performance is computational time.For smaller instances, E has relatively good speed and on average misses the optimal solution by merely 0.1%, thus, we propose it as our method of choice.Among the deterministic algorithms, our study suggests using Algorithm C.However, we wish to note that when we consider large instances of (1), both in number of partitions and in size of each partition, we must be very careful how often we will actually run the Hungarian method because many repetitions of the Hungarian method substantially increase computation time.The main goal of the reported research was to explore the potential of the Hungarian algorithm for solving the k-assignment problem.We have designed several heuristics based on the Hungarian method that have shown to be competitive.While, on one hand, some of our algorithms provide very good (near optimal or even optimal) results in a short time, we also designed two heuristics based on local search [31][32][33].Local search type heuristics improve the quality of solutions over time and may converge to the optimal solution.This type of heuristics are very useful when the quality of solutions is more important than computational time.We believe that further development of a multistart local search heuristics based on the Hungarian algorithm may lead to a very competitive heuristics for (1) with hopefully competitive fast convergence to optimal solutions.
In the future, a more comprehensive experimental study of local search based on the Hungarian algorithm may be a very promising avenue of research.
The graph G and an

Figure 1 .
Figure 1.Application of Algorithm A m on a small example.

Figure 2 .
Figure 2. Cases for Algorithm B M .

Algorithm 3 ( 7 :Example 3 .
C m , steepest descent based on B m ).1: function C m (G) b = arg min M i,j ∈M w B m (G/M i,j ) 6: M = B m (G/M a,b ) * M a,b until w(M previous ) = w(M) Taking the same instance as in Examples 1 and 2, Algorithm C m starts with finding a 3-assignment M = {M 1,2 , M 1,3 , M 2,3 } using B m and continues by recursively searching graphs G/M 1,2 and G/M 2,3 (we can skip G/M 1,3

M
= B m (G/M a,b ) * M a,b 12:

Figure 4 .
Figure 4.This plot depicts the quotients with A M for the instances from the first subset of the third dataset (see Section 4.1) corresponding to k = 3.The x axis represents the size of each partition n, while the y axis represents the quotient.We can see that with larger n, E M (10) outperforms all other algorithms, while C M , E M , and F M (100) perform similarly.

Figure 5 .
Figure5.On this plot we can observe the quotients with A M for the instances from the first subset of the third dataset, corresponding to k = 4.The x axis represents the size of each partition n, while y axis represents the quotient.Compared to results from Figure4, we can see that on this dataset, the difference between B M , C M , E M , E M (10) and F M (100) are becoming almost negligible when n increases.

Figure 6 .Figure 7 .
Figure6.This diagram depicts quotients with A M for the second subset of the third dataset (corresponding to k = 3).Compared to results from Figure4, we can see that on this subset, the Algorithms C M , E M , E M(10), and F M (100) give substantially better results than B M and D M .

Figure 8
Figure8.This diagram contains graphical representations of average (normalized) times (in logarithmic scale) needed for non-binary instances from[30] computed in Table3and relative errors rel(with respect to the optimal value OPT).Algorithms A m , B m , C m , D m , and E m are considered fast, while E m(10) and F m (100) are comparably slow.

Table 2 .
The rows contain (respectively) the average values obtained by algorithms Random, Greedy, A m from

Table 3 .
(10)30]son of AlgorithmsA m , B m , C m , D m , E m , E m(10), and F m (100) on the first group of instances of 3-AP from[15,30].Column 2 contains the optimum value of the problem, as reported in[30].For each algorithm, we report the value that it returns.Average relative errors δ and average computation times are given in the last two rows.Algorithms C m , E m , E m(10), and F m (100) have the best performance and, on average, differ from the optimal solution by 0.1% or less (see the last row).

Table 4 .
(10)rical result for Algorithms A m , B m , and C m on the second group of instances from[30](called binary graphs).The optimum values OPT are taken from[30], and the values val are computed by Algorithms A m , B m , C m , D m , E m , E m(10), and F(100).Average relative errors δ and average computation times are given in the last two rows.We can see that F m (100) has the best performance.