Computing the sequence of k-cardinality assignments

The k-cardinality assignment (k-assignment, for short) problem asks for finding a minimal (maximal) weight of a matching of cardinality k in a weighted bipartite graph \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$K_{n,n}$$\end{document}Kn,n, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k \le n$$\end{document}k≤n. Here we are interested in computing the sequence of all k-assignments, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k=1,\ldots ,n$$\end{document}k=1,…,n. By applying the algorithm of Gassner and Klinz (2010) for the parametric assignment problem one can compute in time \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal {O}}(n^3)$$\end{document}O(n3) the set of k-assignments for those integers \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k \le n$$\end{document}k≤n which refer to essential terms of the full characteristic maxpolynomial \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar{\chi }}_{W}(x)$$\end{document}χ¯W(x) of the corresponding max-plus weight matrix W. We show that \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar{\chi }}_{W}(x)$$\end{document}χ¯W(x) is in full canonical form, which implies that the remaining k-assignments refer to semi-essential terms of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar{\chi }}_{W}(x)$$\end{document}χ¯W(x). This property enables us to efficiently compute in time \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal {O}}(n^2)$$\end{document}O(n2) all the remaining k-assignments out of the already computed essential k-assignments. It follows that time complexity for computing the sequence of all k-cardinality assignments is \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal {O}}(n^3)$$\end{document}O(n3), which is the best known time for this problem.


Introduction
A fundamental problem in combinatorial optimization is the linear assignment problem, which is special type of a minimum cost flow problem, or even more generally, of a linear programming problem. It is common to describe it in terms of "agents" and "tasks". The tasks are to be performed by the agents in such a way that each agent is assigned to at most one task and no task may be performed by more than one agent. For each agent-task pair a "cost" is attached, telling how much does it cost for the B Amnon Rosenmann rosenmann@math.tugraz.at 1 Institute of Discrete Mathematics, Graz University of Technology, Steyrergasse 30, 8010 Graz, Austria specific agent to perform the specific task. The assignment problem asks for finding an optimal assignment of agents to tasks such that the total cost is minimal. Clearly, an analogous problem asks for finding an assignment which is optimal with regard to a maximal total cost.
The assignment problem has numerous and diverse practical applications. Some examples: assigning workers to jobs, e.g. salespersons to sales territories, taxi drivers to different locations, assigning machines to factory orders, computer programs to processors, teachers to classes, contracts to bidders, switching satellites time slots assigning transmitting to receiving earth stations, sensors to airplane tracks in air traffic control.
In its basic form the number of agents equals the number of tasks (a "balanced" assignment). Here we deal with a more general problem. Given n agents and n tasks and a number k ≤ n, the problem is to find an optimal matching of k agents to k tasks such that the total cost of this assignment is minimal among all assignments of cardinality k. In practice, the assignment problem may repeat itself many times, where the number of tasks in the single assignments alters between 1 and n. In this case we are interested in computing in advance the optimal cost of all k-cardinality assignments (k-assignments, for short), for k running from 1 to n, in an efficient way that outperforms the total cost of computing each of the k-assignments separately. This last problem is the topic of the current paper.
The assignment problem can naturally be represented as a weighted bipartite graph, where one set of vertices represents the agents and the other represents the tasks, and the weights on the edges represent the corresponding costs.
Among the generalizations of the standard assignment problem is the parametric assignment problem, which is a special case of a parametric linear programming problem (Murty 1983). In the parametric assignment problem the costs are not restricted to be constants but functions of a parameter λ. When the parametric costs are linear functions of λ then the optimal cost of an n-assignment forms a piecewise linear function of λ defined over the real numbers and with finitely-many pieces (intervals). The goal is to find optimal assignments at each of these intervals in an incremental (or successive) and efficient way. A special and efficient algorithm of Gassner and Klinz (G-K) (2010) for the parametric linear assignment problem, in which the weight (cost) at each edge e i j is either w i j or λ + w i j , does exactly that and its time complexity is O(n 3 ).
The question is, how do we obtain the optimal k-assignments by solving the parametric assignment problem? The G-K algorithm works also when the cost function of e i j is min{λ, w i j }. Suppose now that we assign to each edge e i j the weight min{λ, w i j } and solve the parametric assignment problem with the G-K algorithm. Then, if within some interval we obtain an optimal assignment in which n − k of the edges have the value min{λ, w i j } = λ and k edges have the value min{λ, w i j } = w i j then the latter form an optimal k-assignment for that specific k. It follows that after completing the algorithm we obtain a list of optimal k-assignments in time O(n 3 ). This is better than the total complexity of O(n 4 ) achieved by computing separately for each k the optimal k-assignment since the best time complexity for solving a single k-assignment problem is also O(n 3 ) (which is quite surprising, given that the optimal k-assignment is chosen among [n(n−1)···(n−k+1)] 2 k! possibilities). The problem is that, in general, the above procedure will not produce all the kassignments, for k = 1, . . . , n. Here comes our contribution by showing how to obtain in a simple way the remaining k-assignments in an overall time of O(n 2 ). It follows that the entire sequence of k-assignments can be computed in time O(n 3 ), which is the best time complexity that can be achieved with the known algorithms.
The idea is to exploit the special case of the parametric assignment problem in which the parameter λ appears at all the edges e i j of the bipartite graph as a cost function min{λ, w i j }. For convenience, we solve here the maximal assignment problem (clearly, when the costs are set to be −w i j then maximal assignment gives the minimal assignment with the original costs w i j ). The natural setting for working with the maximum operation is max-plus algebra, where the operations of maximum and addition replace the standard addition and multiplication operations, respectively. Given an n × n matrix A with entries a i j = w i j , its "full characteristic maxpolynomial" χ A (λ) is defined to be the max-permanent of the matrix with entries max{λ, w i j }. Then the coefficients of the powers λ n−k ofχ A (λ) are exactly the (maximal) values of the k-assignments. Moreover, unlike the case with the characteristic maxpolynomial χ A (λ), where the parameter appears on the diagonal of the matrix, we show that the full characteristic maxpolynomialχ A (λ) is in "full canonical form", and this property allows us to compute efficiently the k-assignments that remain after applying the G-K algorithm. That is, we show that the remaining k-assignments can be extracted out of those that were already computed by the G-K algorithm and there is no need to consider the set of all costs w i j .

Related work
A well-known algorithm that solves the assignment problem is the "Hungarian algorithm" (or "Hungarian method") of Kuhn (1955Kuhn ( , 1956, based on the works of König (1916) and Egerváry (1931). Munkres (1957) showed that the algorithm is of strongly polynomial time complexity, in fact O(n 4 ). Later Edmonds and Karp (1972) and Tomizawa (1971) gave a version of the algorithm whose running time is O(n 3 ).
The best known time complexity for solving the k-cardinality assignment problem for a specific k ≤ n in a weighted full bipartite graph K n,n is also O(n 3 ), for example through network flow. In fact, the algorithm that is based on the successive shortest path algorithm for the minimum flow problem, which augments one unit of flow at each iteration (see Ahuja et al. 1993, Ch. 9.7 and Ch. 12.4), computes the sequence of k-assignments, for k = 1, . . . , n, in time O(n 3 ).
The algorithm of Gassner and Klinz (G-K) (2010) for the parametric assignment problem is of time complexity O(n 3 ). It is based on the algorithm of Young et al. (1991) for the parametric shortest path problem. In Young et al. (1991) the authors make use of the Fibonacci heap data structure of Fredman and Tarjan (1987) to improve the time complexity of the algorithm of Karp and Orlin (1981) for the parametric shortest path from O(n 3 log n) to O(n 3 ). At each iteration of the G-K algorithm a new "breakpoint" is computed and the shortest path tree in the "residual graph" is updated. At some point a cycle emerges that forces the tree to be ill-defined and then the next parametric assignment is computed. We remark that, in general, known algorithms for the parametric linear programming problem may have exponential number of breakpoints (Carstensen 1983). In fact, integer linear programming is an NP-complete problem even when the unknowns are binary.
A generalization of the G-K algorithm to maxpolynomials of any degree (not just linear ones) was introduced by Hook (2016).
In Gassner and Klinz (2010) applied their algorithm to efficiently compute the characteristic maxpolynomial of a matrix. As with the standard characteristic polynomial, the parameter (or variable) appears on the diagonal of the matrix. The coefficients of the characteristic maxpolynomial are the (optimal) "principal" k-assignments, that is, referring to principal square submatrices. However, the G-K algorithm computes the assignments that refer to "essential" terms and possibly some of the "semi-essential" terms of the characteristic maxpolynomial, and not the "inessential" terms and hence, in general, not all the principal k-assignments are computed (and to the best of our knowledge, it is not even known if a polynomial-time algorithm exists for computing these k-assignments).
Here we compute the full characteristic maxpolynomial, where the parameter appears on all entries of the matrix, thus the coefficients of this maxpolynomial are the standard k-assignments, since they are optimal among all k × k submatrices. Moreover, in the full characteristic maxpolynomial there are no inessential terms, only essential and semi-essential ones. This follows from the fact that the full characteristic maxpolynomial is in full canonical form, for which we give here a simple proof (for another proof, based on the fact that the matrix of the corresponding linear programming problem is totally unimodular, see Rosenmann et al. 2019). The fact that there are no inessential terms allows us to compute in an efficient way the k-assignments that were left after applying the G-K algorithm.

Organization of the article
In Sect. 2 we define the k-linear assignment problem and represent it as a matching problem in a weighted bipartite graph and as a linear programming problem. In Sect. 3 we introduce briefly the Max-plus algebra notions that are relevant to our problem and we show that the full characteristic maxpolynomial is in full canonical form (FCF). Then, in Sect. 4 we show that the sequence of k-assignments is concave, thus providing another proof for the FCF property of the full characteristic maxpolynomial. In Sect. 5 the computation of the k-assignments is presented. First, we describe the G-K algorithm for the parametric assignment problem when applied in the max-plus setting to the matrix with a parameter in all its entries, which is relevant for computing the k-assignments. Then we present our algorithm for computing the k-assignments that remain to be computed after completing the G-K algorithm. We conclude with a time complexity analysis.

The k-cardinality linear assignment problem
We are given a complete bipartite graph (biclique) K n,n = G(U , V ;E) consisting of two disjoint sets of vertices U = {u 1 , . . . , u n } and V = {v 1 , . . . , v n }, and an edge set E, adjoining each vertex u i ∈ U with each vertex v j ∈ V by an edge e i j . In addition, we are given a weight (cost) function w : E → I R max = I R ∪ {−∞} which assigns each edge e i j a weight w i j . The k-cardinality Linear Assignment Problem, or k-LAP (see e.g. Dell' Amico and Martello 1997;Dell'Amico et al. 2001;Volgenant 2004;Bai 2009;Belik and Jörnsten 2016;Bhunia et al. 2017;Kumar and Purusotham 2018;Prakash et al. 2022), asks for finding an optimal (here optimal is maximal) weight of a matching (independent edge set) of cardinality k, where k ≤ n. That is, we are looking for a set M k ⊆ E of k pairwise non-adjacent edges in K n,n that is of maximal total weight: Remarks 2.1 1. Here we compute the maximal assignments. For computing the minimal assignments we can either first multiply the weights by −1 and then compute the maximum, or compute directly the minimum in the analogous setting of I R min = I R ∪ {+∞}. 2. If the problem refers to sets U and V of different cardinalities n and m < n, respectively, then we can always introduce n − m spurious (dummy) vertices and n(n − m) spurious edges of weights −∞ (+∞ in the minimal assignment case) so that U and V become of equal cardinality. 3. We refer to Burkard et al. (2012) for a comprehensive treatment of linear and related assignment problems.
Representing the weight function as an n × n matrix W = (w i j ) over I R max , the k-LAP is about finding k elements of k different rows and k different columns, such that their sum is maximal. It can be formulated as an Integer Programming (IP) problem over the variables x i, j , for i, j = 1, . . . , n, as follows: If we replace the last condition x i j ∈ {0, 1} in (2.3) by the inequalities we obtain the corresponding Linear Programming (LP) problem. A LAP can also be described in the language of network flows or in terms of matroids. In what follows we use the term k-assignment when referring to k-cardinality linear (optimal) assignment.

Max-plus algebra
The values of the k-assignment problem, k = 1, . . . , n, appear as the coefficients of the full characteristic polynomial of the weight matrix W in the setting of max-plus algebra. In this section we present the relevant background about max-plus algebra.
Max-plus algebra (Butkovič 2010) is an algebra over the semifield I R max = I R ∪ {−∞}, equipped with the operations of addition a ⊕ b defined as max(a, b) and multiplication a b defined as a + b in standard arithmetic, with the unit elements −∞ for addition and 0 for multiplication. For the sake of readability, we suppress the multiplication sign , writing ab instead of a b and ax 3 instead of a x 3 . Also, when an indeterminate x appears without a coefficient, as in x n , then its coefficient is naturally the multiplicative identity element, i.e. 0.
A formal maxpolynomial of degree n over I R max in the indeterminate x is an expression of the form with a 0 , . . . , a n ∈ I R max . Each element of the generated algebra under the max and plus operations can be reduced to a unique expression of the form (3.1) with x treated as an indeterminate. Given a formal maxpolynomial p(x), the corresponding maxpolynomial function p(x) : I R max → I R max is convex and piecewise-affine. Unlike the situation in standard arithmetic, two distinct formal maxpolynomials p 1 (x) and p 2 (x) may represent the same maxpolynomial function, that is, for each x, the values ofp 1 (x) andp 2 (x) in I R max are the same. For suppose that a maxmonomial a k x k of p(x) has the property that for every value of x there exists another maxmonomial a l x l of p(x), l = k, such that a k x k ≤ a l x l (or, in standard arithmetic, max{a k + kx < a l + lx), then a k x k does not contribute to the functionp(x) and thus may be omitted or replaced by another maxmonomial a k x k (at least when a k < a k ). The term a k x k is said to be an essential term of p(x) whenp(x) = a k x k (as functions) in some interval of I R, . When a k x k <p(x) for all values of x then a k x k is said to be inessential. Otherwise, whenp(x) = a k x k at a single point, then we say that a k x k is semi-essential (in the literature there is no distinction between an inessential and a semi-essential term).
For each functionq(x) there exists a unique maxpolynomial representation p(x), such that every power x k of p(x) appears with the maximal possible coefficient a k , as long as the functional equalityp(x) =q(x) holds. We then say that p(x) is in full canonical form (in FCF) (Cuninghame-Green and Meijer 1980). It follows that when p(x) is in FCF then all its maxmonomials are either essential or semi-essential.
The max-plus roots (tropical roots) λ = −∞ of a maxpolynomial p(x) are the points at whichp(x) is non-differentiable. The multiplicity of a root equals the change of the slope ofp(x) at that root. Equivalently, the roots of p(x) are the values λ = −∞ of x at which at least two maxmonomials a k x k , a k+1 x k+1 , . . . , a k+d x k+d in the corresponding full canonical form satisfy a k λ k = a k+1 λ k+1 = · · · = a k+d λ k+d = p(λ) and the multiplicity of the root λ is then d, the difference between the largest and the smallest index of these maxmonomials. We also count −∞ as a root with multiplicity d whenever a 0 , a 1 , . . . , a d−1 are all equal to −∞ and a d = −∞.
Proposition 3.1 (see Rosenmann et al. 2019) Let p(x) = n k=0 a k x k be a maxpolynomial of degree n ≥ 1 and let λ 1 ≤ λ 2 ≤ · · · ≤ λ n be its roots. Then the following are equivalent characterizations of p(x) to be in full canonical form.

The (full) characteristic maxpolynomial of a matrix
Given an n × n matrix A ∈ I R n×n max , the max-plus permanent of A is where I is the max-plus identity matrix with 0 on the main diagonal and −∞ offdiagonal. It is a maxpolynomial of degree n, say χ A (x) = n k=0 a k x n−k , with a k being the maximal value among all principal maxpermanent minors of order k of A. The (tropical) roots of the characteristic maxpolynomial χ A (x) are called the maxplus eigenvalues of A. As shown in Akian et al. (2001), they can be asymptotically computed from the eigenvalues of an associated parametrized standard matrix with exponential entries.
Another maxpolynomial related to A is its full characteristic maxpolynomial, defined asχ where 0 is the matrix with 0 in all its entries (see Hook 2015). The difference between χ A (x) and χ A (x) is that inχ A (x) the indeterminate x appears in all entries instead of just on the diagonal. The coefficients a k ofχ A (x) = n k=0 a k x n−k equal the maximal value among all maxpermanent minors (not just principal maxpermanent minors) of order k of A. That is, a k equals the value of a k-assignment with weight matrix A. The (tropical) roots of the full characteristic maxpolynomialχ A (x) are called the max-plus singular values of A (Hook 2015). Similar to the max-plus eigenvalues, the max-plus singular values can be asymptotically computed from standard singular values (see Hook 2015;De Schutter and De Moor 2002).
An essential (formal) property of the full characteristic maxpolynomial, which distinguishes it from the characteristic maxpolynomial, is that it is in full canonical form. This property allows us to compute efficiently all the k-assignments.

Concavity of the sequence of k-assignments
We give here a direct proof of the FCF property of the full characteristic polynomial without referring to linear programming or network flow but rather demonstrate it on the bipartite graph. The method of proof will serve us in what will follow. First, we show the known fact (see Dell'Amico and Martello 1997) that it is always possible to form a (maximal) (k + 1)-assignment from the set of vertices matched by a k-assignment and an additional pair of vertices. Given a set E of matched pairs in a bipartite graph G(U , V ;E), an alternating path in E with respect to E is a path of positive length that alternately switches between edges of E and those of E\E . If an alternating path starts and ends in a vertex of E\E then it is an augmenting path (may also be of length 1). Proof Let E k , E k+1 be the set of edges of M k , M k+1 , respectively. The edges of E k ∪ E k+1 form a disjoint (with no common vertices) union of alternating paths. Because |E k+1 | > |E k |, at least one of these paths p is augmenting: it starts in a vertex u k+1 ∈ M k+1 \M k , ends in a vertex v k+1 ∈ M k+1 \M k , and all the inner vertices are in M k ∩ M k+1 . By the maximality of total weight of the two assignments, we may take the rest of the matches of M k to be also in M k+1 , that is, M k+1 = M k p, the symmetric difference of M k and p. Hence, M k+1 contains exactly one pair of vertices that is not in M k .
In terms of matrices, Lemma 4.1 says that given a matrix W ∈ I R n×n max , there exist permutation matrices P, Q ∈ I R n×n , such that the k-assignments in W = PW Q occur on its leading principal k × k submatrices, for k = 1, . . . , n.
We give now an alternative Proof of Proposition 3.2 in the language of k-assignments on bipartite graphs. We define a 0-assignment to be M 0 = ∅ with weight w 0 = −∞.
Proposition 4.2 Given a complete bipartite weighted graph K n,n , n ≥ 2, the sequence of weights w k , k = 0, . . . , n, of its k-assignments is concave.
Proof Let M k−1 , M k and M k+1 be 3 consecutive assignments with weights w k−1 , w k and w k+1 , respectively. We need to show that w k ≥ (w k−1 +w k+1 )/2. By Lemma 4.1, we may assume that M k+1 matches the vertices matched in M k−1 and additional 4 vertices and it consists of some of the pairs matched in M k−1 and other matched pairs which form two disjoint maximal augmenting paths p 1 , p 2 with the rest of the edges of M k−1 . That is, p 1 ∩ p 2 = ∅ and p 1 ∪ p 2 = M k+1 M k−1 .
For i = 1, 2, let be the gain exhibited by p i , that is, the difference between the total weight of the matches of M k+1 and those of M k−1 in p i . Then Suppose, without loss of generality, that g 1 ≥ g 2 . Then we form a (not necessarily maximal) matching M k , M k = M k−1 p 1 and we have By the maximality of w k , and the proof is complete.  (u 4 , v 2 )} of total weight w 4 = 10 + 5 + 4 + 4 = 23. The sequence of weights (10, 18, 23, 23) is clearly concave and it forms the coefficients of the full characteristic maxpolynomial

Computing the k-assignments
In Gassner and Klinz (G-K) (2010) introduced an efficient algorithm for a special kind of the parametric assignment problem. We present here (Sect. 5.1) the algorithm when applied in the max-plus setting to a matrix W with a parameter at all its entries. The result is the computation of the full characteristic maxpolynomialχ W (x). The coefficient of this maxpolynomial are the values of the corresponding k-assignments with a cost matrix W . Moreover, the G-K algorithm computes also the k-assignments themselves. However, these k-assignments refer to the essential terms ofχ A (x). It is then easy to compute the costs of the remaining k-assignments. But what is special about the full characteristic maxpolynomial is that it is in full canonical form, so that the remaining k-assignments (the ones not computed by the G-K algorithm) refer to semi-essential terms. This property allows us to compute very efficiently, in addition to their costs, also the optimal assignments themselves, the ones on which these costs are attained (Sect. 5.2).

Computing the k-assignments corresponding to essential terms
We present here the algorithm of Gassner and Klinz for the computation of the kassignments that refer to the essential terms of the full characteristic maxpolynomial. The presentation is more similar to the one appearing in Hook (2016), which is clearer to understand in our opinion. The major steps of the algorithm are described in Algorithm 1.  Update T with respect to e and p 17:

Algorithm 1 Computing the essential k-assignments
if T contains a cycle C(x) then 18: {new singular value of W and its multiplicity} 20: Given a weight (cost) matrix W = (w i j ) of size n ×n, we form the directed bipartite graph K n,n = G(U , V ;E) enhanced with weights w i j applied to the "constant edges" e i j from the vertices u i to the vertices v j . Then we add n 2 "parametric edges" e x i j directed from u i to v j , for i, j = 1, . . . , n, where the weight of each parametric edge is set to be x. Finally, we add a root r and n edges e r i , each of weight 0, that start in r and terminate in u i , i = 1, . . . , n. These edges remain fixed throughout the algorithm, whereas the other edges may change direction, accompanied by negation of their weight. The resulting graph is denoted by G(x).
As in Hook's presentation of the algorithm (Hook 2016), we begin with a value b 0 which is larger than the maximal entry of W . Clearly, for any value of x ∈ [b 0 , ∞), an assignment (matching of cardinality n of maximal weight) in G(x) contains n pairwise non-adjacent parametric edges, so that the weight of the assignment is w 0 (x) = nx. The weight of this assignment corresponds to the term x n of the full characteristic maxpolynomialχ W (x) = maxperm(x0 ⊕ W ). Then the value of the parameter x is gradually decreased and the constant entries of W are exposed. This is done in a bounded number of discrete steps, where at each step a new value b i ≤ b i−1 is computed and several updates are performed. If during these updates some special condition is fulfilled (the emerging of a cycle after updating the spanning tree, see below) then b i is the value of the next max-plus singular value λ j and a new assignment is computed. The new assignment has less parametric edges than the previous one, and the difference is the multiplicity of λ j (although, in fact, the singular values λ j need not be distinct and the actual multiplicity of λ j is then the sum of the corresponding multiplicities). The weight w k (x) = a k + (n − k)x, a k ∈ I R max , of the new assignment that applies to the current value of x corresponds to a term a k x n−k ofχ W (x), that is, w k = a k is the total weight of a k-assignment in G(U , V ;E).
The question now is how do we compute the essential k-assignments themselves? The G-K algorithm proceeds as follows. First we let the initial assignment M 0 (x) for b 0 ≤ x < ∞ to consist of the parametric edges e x ii , i = 1, . . . , n. Then we construct the residual graph ← − G (x). The residual graph is obtained from the graph G(x) by reversing the direction of the matching edges e x ii and negating their weights. A main tool of the algorithm consists of constructing and maintaining in the residual graph a parametric longest path tree T according to the algorithm of Young et al. (1991) (in Young et al. (1991 the constructed tree solves the analogous parametric shortest path problem). This is a spanning tree with the property that the sum of weights of a path from the root to any vertex gives the longest existing path that reaches this vertex. At the beginning the tree T may consist e.g. of the edges e r i , for i = 1, . . . , n, e x 1 j , for j = 2, . . . , n, and e x 21 , which gives a path of length (weight) 0 to each of the vertices u i and a path of length x to each of the vertices v j .
We notice that the construction of a longest path tree T is only possible when ← − G (x) does not contain (reachable) cycles of positive weight: once such a cycle exists then it can be taken unlimited number of times while increasing the weight of the path indefinitely. This property is crucial: when the value of x drops below some threshold b i then the graph G(x) contains a matching of n pairs of vertices whose total weight is larger than the current assignment (if such a matching does not exist the algorithm terminates). When x < b i the construction of a longest path tree is not possible anymore and this is demonstrated in the algorithm in the emergence of a cycle of positive weight when the tree is updated (see Ahuja et al. 1993 for this property in terms of network flow). At that point we get a new max-plus singular value λ j = b i .
In general, as the value of x decreases then T needs to be updated more often than updating the assignment. The update of T is performed by trying to replace an edge e = p → q by an edge e = p → q (a pivot edge). If the sub-tree of T rooted at q does not contain the vertex p then the replacement succeeds and the new tree is well-defined. After updating the vertex keys (as explained below) the algorithm continues by looking for the next pivot edge. Otherwise (when the sub-tree rooted at q contains p ), the replacement of e by e results in a cycle C(x) = q → q 1 → . . . → q t−1 → p → q of positive weight. In this case we do the following. The cycle C(x) is alternating between edges of the current assignment M k (x) and non-matching edges. We change the direction of the edges of C(x) and negate their weights (thus turning the cycle to be of negative weight) while obtaining a new residual graph ← − G (x). If the current assignment is M k (x) then the new assignment is M k+d (x) = M k (x) C(x), the symmetric difference of M k (x) and C(x). Here k + d is the number of constant edges in the new assignment and d = −w x (C(x)) > 0, where w x (C(x)) denotes the integral coefficient of x in the total weight of the edges of C(x). d is also the multiplicity of the corresponding max-plus singular value. Finally, we update the longest path tree: the edges of the new tree go in the direction q → p → q t−1 → . . . → q 1 .
It remains to show how to find the pivot edge e with which we update the longest path tree. To reach this goal (Gassner and Klinz 2010) apply the algorithm of Young et al. (1991). For each directed edge e of the residual graph ← − G k (x) let its weight be written as w(e) = w c (e) + w x (e)x, with w c (e) ∈ I R max is the constant part and w x (e) ∈ {0, −1, 1} is the parametric part. Then let w(q) = w c (q) + w x (q)x, where w c (q) ∈ I R max and w x (q) ∈ [−n .. n], be the weight of a vertex q of ← − G k (x), defined as the sum of the weights along the path from the root to q in the current tree. For each directed edge e = p → q of the residual graph ← − G its key is defined to be where κ(e) is defined to be −∞ if the denominator in (5.1) is not positive. Note that κ(e) gives the value of x at which the weight of the alternative path to q through e becomes equal to the weight of the path to q along the current tree, and for x < κ(e) the alternative path is the longer one. The key of a vertex q is then defined to be the maximum over the keys of all edges that terminate in q: The update of the tree T is done by choosing a vertex q of ← − G k (x) of maximal key (a pivot vertex) as well as an edge e = p → q with κ(e) = κ(q) (a pivot edge) and performing the update as described above. Then we need to update the keys of all the vertices in the sub-tree with root q before continuing.

Computing the k-assignments corresponding to semi-essential terms
Algorithm 1 computes the k-assignments which correspond to all the essential terms of the full characteristic maxpolynomialχ W (x) and probably some which correspond to semi-essential terms. Sinceχ W (x) is in FCF, we can easily deduce the values of the missing k-assignments. The question is how to compute the missing k-assignments themselves. The computation of all the k-assignments already in Algorithm 1 succeeds when each newly computed max-plus singular value λ j comes with multiplicity 1 (we remind that this is not necessarily its actual multiplicity since the computed singular values are not necessarily distinct). The G-K algorithm does not address the case of semi-essential terms, and it can be shown that in the presence of multiple pivot edges at the same time, the choices we make influence the multiplicities of the newly computed singular values. It is not clear whether it is always possible to choose the pivot edges in Algorithm 1 in such a way that the singular values have multiplicity 1, and if yes -if it can be done in an efficient way. Nor isn't it clear whether it is possible to direct the algorithm in such a way that the max-plus singular values will occur in full multiplicity, that is, that each computed new singular value will be different from the previous one, although one can try to choose the pivot edges in a way that serves this or the other purpose.
However, we will show that after obtaining the k-assignments from Algorithm 1, the remaining k-assignments, those that correspond to semi-essential terms ofχ W (x), are easy to compute.
Theorem 5.1 Let M be the set of k-assignments computed by Algorithm 1 when given an n-agents, n-tasks assignment problem. Let I ⊆ [n] be the set of integers k, for which M contains a k-assignment. Then it is possible to compute efficiently out of M the set of all the remaining k-assignments, for k ∈ [n]\I .
Proof We go over the sequence of k-assignments in M until we find a gap in the computed assignments. Then we compute the missing assignments, find the next gap and compute the next missing assignments and so on.
So, suppose that M contains an l-assignment M l and the next computed assignment is an (l + d)-assignment M l+d , where d > 1. We know that because the assignments refer to essential terms of the corresponding full characteristic maxpolynomial, which is in full canonical form, then the missing assignments refer to semi-essential terms. This means that the weights w(M l+i ) of the missing assignments M l+i , for i = 1, . . . , d − 1, are evenly spaced. Let be the weight difference between successive k-assignments, and let be the weight difference between the computed assignments M l and M l+d . By the above, As in the Proof of Proposition 4.2, in order to compute the missing assignments, we start with the assignment M l and transform it to the assignment M l+d in d steps. The paths of type T1 and T2 contain the same number of matches of M l and of M l+d . Each path of type T3 contains one more match of M l+d than of M l and the other way round for paths of type T4. Since M l+d contains d more matches than M l , the number of paths of type T3 is greater by d than the number of paths of type T4.
For each alternating path p of type T2 we have, by the maximality of the assignments M l and M l+d , the following equality of weights: Suppose that there exists at least one path of type T4. Then for each pair ( p 3 , p 4 ), where p 3 is a path of type T3 and p 4 is a path of type T4, we have, by maximality of M l and M l+d , Equivalently, there is a constant c, such that for every augmented path of type T3 or of type T4, where p odd refers to the edges of p in the odd places and p even refers to the edges of p in the even places. Thus, without changing its total weight, we can form a (possibly new) assignment M l+d out of the matched pairs of the given assignment M l+d of any d augmenting paths p 1 , . . . , p d of type T3, and then add all the matched pairs of M l which are not in p 1 , . . . , p d . For each of these paths p i of type T3, let its "gain" be In case there is at least one path of type T4, we have seen in (5.3) that the g i are equal to each other. Otherwise, suppose, without loss of generality, that g 1 ≥ g 2 ≥ · · · ≥ g d . (5.4) We will show that due to our special case also in case there are no paths of type T4 the g i are all the same. Let us construct the matchingsM l+i as whereM l is defined to be M l . (At this point we do not know yet whether these matchings are (optimal) k-assignments.) Then we have, (withM l = M l andM l+d = M l+d ) and By the maximality of the (l + 1)-assignment, (5.6) and it follows from (5.4), (5.5) and (5.6) that and thus each of the matchingsM l+i is indeed an (l + i)-assignment, for i = 1, . . . , d − 1.
Algorithm 2 Computing the semi-essential k-assignments 1: Input: M {list of the essential k-assignments computed by Algorithm 1}; 2: Output: N {list of the missing semi-essential k-assignments}; 3: Initialization: 4: N ← ∅ 5: 6: while there are uncomputed semi-essential k-assignments do 7: Find in M the next successive assignments M l and M l+d with d > 1 8: Find disjoint augmenting paths p 1 , . . . , p d−1 of M l+d w.r.t. M l 9: for i ← 1 to d −1 do 10: M l+i ← M l+i−1 p i 11: N ← N ∪ M l+i {new (l + i)-assignment} 12: end for 13: end while

Time complexity
The G-K algorithm computes the k-assignments that refer to essential terms and possibly some of the semi-essential terms in time O(n 3 ).
In Algorithm 2 we compute the semi-essential k-assignments that remain to be computed after completing the G-K algorithm, thus obtaining all the k-assignments, for k = 1, . . . , n. Our aim here is to show that the running time of Algorithm 2 is O(n 2 ). The cause for being able to achieve such an improved running time, where, in general, solving a single k-assignment is of time complexity O(n 3 ) with the known algorithms, is that, as we showed in Sect. 5.2, the remaining semi-essential assignments can be extracted out of the already computed assignments with the G-K algorithm without the need to refer to the original data of n 2 agent-task costs.
Given a list of the k-assignments computed by the G-K algorithm, our mission is to fill-in the gaps in this list. We can assume that the k-assignments are in the following data structure. For each vertex u i there exists an array U i of size n, so that U i [k] = j in case u i and v j are matched in the k-assignment, and similarly for every v j corresponds an array V j , where in this case V j [k] = i for the same match in the k-assignment.
So, suppose that the assignments M l and M l+d , d > 1, are given by the G-K algorithm, whereas the in-between k-assignments are missing. Starting at any matched pair of M l+d , we can extend it to a maximal alternating path by following the pointers at U i [l], U i [l + d], V j [l] and V j [l + d], for i, j ∈ {1, . . . , n}. That is, if U i [l + d] = j (a (u i , v j ) match in M l+d ), then we look at V j [l]. If V j [l] = k (a (v j , u k ) match in M l ) then we look at U k [l + d], and so on. The total number of matches (or edges) in M l and in M l+d together is at most 2n, so that the process of finding all the alternating paths is done in time O(n). There are at least d augmenting paths of type T3, that is, (maximal) paths that start and end at matches of M l+d . Hence, in general, we need not find all the alternating paths, but stop once we find d − 1 paths, say, p 1 , . . . , p d−1 , of type T3.
Next, we compute the assignments M l+1 , . . . , M l+d−1 as follows. Suppose that we already computed M l+1 , . . . , M l+i−1 . Then we form M l+i by taking M l+i−1 and replacing the matches in p i that belong to M l (and to M l+i−1 ) by the matches in p i that belong to M l+d (that is, obtaining the symmetric difference of M l+i−1 and p i ), thus increasing the overall number of matches by one. This can be done in time O(n), so that the overall time for obtaining M l+i is O(n).
Since the number of k-assignments to be computed by Algorithm 2 is less than n, we achieve an O(n 2 ) time complexity for computing all the missing k-assignments.
We conclude that the time complexity for computing all the k-assignments, k = 1, . . . , n, in the combined G-K Algorithm and Algorithm 2 is O(n 3 ).
In special cases, where there are many assignments that are left to be computed after completing the G-K algorithm, the fact that these extra assignments are computed more efficiently may reduce the overall running time. For example, such a case may occur when many of the n 2 agent-task costs are equal to each other.