1. Introduction
An assignment problem can be interpreted as a problem of resource allocation in which a certain number of “tasks” are performed by some “agents” so that the total cost of pairing tasks with agents is minimized. There are many ways to constrain this problem, such as imposing onetoone mapping (the balanced problem), searching for a specific number of assignments (the
kcardinality assignment problem), imposing constraints on the resources (the generalized assignment problem), or allowing agents to perform multiple tasks or reversely having some tasks performed by more than one agent. For reviews on the variety of assignment problems and the algorithms that have been proposed to solve them, we refer the reader to Refs. [
1,
2,
3] and references therein. Assignment problems are fundamental combinatorial optimization problems. As such, solving such problems is a significant concern in operational research, economics, and data sciences, among other disciplines. Assignment problems have been and continue to be a focal point of investigation for mathematicians, statisticians, computer scientists, and even physicists. In this paper, we propose a general framework that regroups all the assignment problems mentioned above. We develop an approximate solution to this problem based on statistical physics and prove that it converges efficiently to an exact solution for nondegenerate as well as degenerate assignment problems.
Let us first define the assignment problem. Let
T be the set of tasks and
A the set of agents, with possibly different cardinalities
$\leftT\right={N}_{2}$ and
$\leftA\right={N}_{1}$. If we define
$C(i,j)$ as the cost of assigning task
i to the agent
j, the balanced assignment problem can be stated as finding a transportation matrix
G between
T and
A whose elements are nonnegative integer numbers and that minimizes
In the special case of ${N}_{1}={N}_{2}$, with a onetoone assignment of tasks to agents (the balanced assignment problem), G corresponds to a permutation of $\{1,\dots ,N\}$. In the more general case, ${N}_{1}$ and ${N}_{2}$ can be different (unbalanced assignment), the number of pairings k may be imposed with $0<k\le min({N}_{1},{N}_{2})$ (kcardinality assignment problem), and/or tasks and agents may be assigned to more than one agents and tasks, respectively. In those general cases, G remains binary but may not be a permutation matrix (in the specific case of the kcardinality problem, for example, G is a partial permutation matrix of rank k).
As mentioned above, assignment problems are basically combinatorial optimization problems that can be solved numerically using a linear programming model or, more specifically, a linear integer programming method. Those methods, however, are theoretically
$NP$complete. There are fast heuristics that can solve such problems, such as Dantzig’s simplex method [
4]. The assignment problem, however, is a specialized case of integer linear programming that can be recast and solved by an exact polynomial algorithm. For example, the most common algorithm for solving the balanced assignment problem has its origin in the work of Jacobi [
5]. It was “rediscovered” 60 years later by [
6] and is now dubbed the Hungarian algorithm. It is a global algorithm that iteratively identifies assignments between agents and tasks. It is polynomial in running time (
$O\left({N}^{4}\right)$ or
$O\left({N}^{3}\right)$ depending on the implementation). While it is serial by nature, there are many recent efforts to parallelize this algorithm (see, for example [
7,
8,
9], and references therein).
The Hungarian algorithm can be adapted to many unbalanced assignment problems. If there are
${N}_{2}$ tasks and
${N}_{1}$ agents, with
${N}_{2}>{N}_{1}$, for example, it is possible to add
${N}_{2}{N}_{1}$ “dummy” agents, solve the balanced assignment problem of size
${N}_{2}$, and then only retain the assignments to the actual
${N}_{1}$ agents. If each agent can perform up to
M tasks, the textbook solution is then to create
M copies of each agent prior to using the Hungarian algorithm. This approach, however, may not lead to the expected solution. Consider a problem with fiv tasks and three agents, with each agent allowed to perform up to three tasks. The option of creating three copies of each agent and then solving the corresponding unbalanced assignment problem may lead to one agent performing two tasks, a second agent performing three tasks, and the last agent not performing any task, possibly violating a constraint that each agent needs to perform at least one task. Several methods have been proposed to circumvent this problem, either by dividing the problem into multiple subproblems [
10,
11] or by using random algorithms such as the ant colony algorithms [
12,
13]. It is unclear whether these algorithms can identify the optimal solution (they have been shown to fail in some cases, see for example [
14]) or how they scale for large problems.
In this paper, we propose a radically different approach to solving a general class of assignment problems using continuous systems. Our approach is motivated by statistical physics. It is a full generalization of the method developed in a previous paper to solve balanced assignment problems [
15]. In the following, we will use the generic term “multiassignment” to represent an assignment problem with agents possibly performing multiple tasks, or with tasks assigned to multiple agents. In this paper, we aim to
Introduce and substantiate a continuous framework for addressing potentially multifaceted assignment problems involving multiple tasks and/or multiple agents, leveraging principles from statistical physics;
Demonstrate that, under generic circumstances where the multiassignment problem possesses a unique solution, the aforementioned framework ensures convergence to that solution with arbitrarily high accuracy, in terms of both cost (referred to as energy) and assignment matrix,
Present a modified approach capable of identifying at least one solution for degenerate multiassignment problems that feature multiple solutions;
Demonstrate that the implementation of this framework can be efficiently parallelized.
We emphasize that this formalism is not a mere adaptation but a full generalization of the framework we develop for solving assignment problems [
16]. In particular, new features of this paper are as follows:
A method to account for the fact that each task can be assigned to a variable number of agents and, on the other hand, that each agent can be assigned a variable number of tasks. To that end, we introduce indicator functions over the sets of tasks and agents that are optimized along with the transportation plan.
The establishment of proofs of validity and convergence of our algorithm for those general multiassignment problems. The main results are provided in the text, while the proofs themselves are relegated to the Appendices for more clarity. For the balanced assignment problem, these proofs rely heavily on the fact that the corresponding transportation matrices are permutation matrices that are the extreme points of the wellcharacterized convex set of doubly stochastic matrices (according to the Birkhoff–von Neumann theorem [
17,
18]). For more general multiassignment problems, the transportation matrices also belong to a convex set, with properties akin to the Birkhoff–von Neumann theorem (these properties are discussed in
Appendix A). The use of these properties to derive the convergence of our algorithm for solving multiassignment problems is new.
The paper is organized as follows. In
Section 2 Section 3 and
Section 4, we describe in detail the general framework we propose for solving multiassignment problems. Proofs of all important properties of this framework are provided in the appendices.
Section 5 briefly describes the implementation of the method in a C++ program, Matching V1.0. In
Section 6, we present some applications, along with a comparison to current algorithms.
2. A General Formulation of the Assignment Problem
We consider two sets of points,
${S}_{1}$ and
${S}_{2}$, with cardinalities
${N}_{1}$ and
${N}_{2}$, respectively. We represent the cost of transportation between
${S}_{1}$ and
${S}_{2}$ as a matrix
C whose elements
$C(i,j)$ are positive, for all
$(i,j)\in [1,{N}_{1}]\times [1,{N}_{2}]$. We set the number of assignments between points in
${S}_{1}$ and
${S}_{2}$ to be a strictly positive integer number
k, a constant given as input to the problem. A point
i is assigned to
${n}_{1}\left(i\right)$ points in
${S}_{2}$, with
${n}_{1}\left(i\right)$ belonging to
$[{p}_{min}\left(i\right),\dots ,{p}_{max}\left(i\right)]$, where
${p}_{min}\left(i\right)$ and
${p}_{max}\left(i\right)$ are nonnegative integers satisfying
$0\le {p}_{min}\left(i\right)\le {p}_{max}\left(i\right)\le {N}_{2}$. Similarly, a point
j is assigned to
${n}_{2}\left(j\right)$ points in
${S}_{1}$, with
${n}_{2}\left(j\right)$ belonging to
$[{q}_{min}\left(j\right),\dots ,{q}_{max}\left(j\right)]$, where
${q}_{min}\left(j\right)$ and
${q}_{max}\left(j\right)$ are nonnegative integers integers satisfying
$0\le {q}_{min}\left(j\right)\le {q}_{max}\left(j\right)\le {N}_{1}$. Using the traditional “taskagent” for the formulation of an assignment problem,
${S}_{1}$ represents the tasks, and
${S}_{2}$ the agents.
${n}_{1}\left(i\right)$ is the number of agents needed to perform task
i, while
${n}_{2}\left(j\right)$ is the number of tasks that can be performed by agent
j.
${p}_{min}\left(i\right)$ and
${p}_{max}\left(i\right)$ represent the minimum and maximum number of agents that are assigned to a task
i, respectively, while
${q}_{min}\left(j\right)$ and
${q}_{max}\left(j\right)$ represent the minimum and maximum number of tasks that can be assigned to an agent
j, respectively. We use a general definition of these boundaries, in that we allow each task and each agent to have their own limits. The multiassignment problem is then framed as the search for an assignment matrix
G that defines the correspondence between points in
${S}_{1}$ and points in
${S}_{2}$. This matrix is found by minimizing the assignment cost
U, defined as
The summations encompass all
i in
${S}_{1}$ and
j in
${S}_{2}$. The objective is to locate the minimum of
U given the values of
$G(i,j)$ that adhere to the following constraints:
where
k is the actual number of task–agent pairs. The numbers
${p}_{min}\left(i\right)$,
${p}_{max}\left(i\right)$,
${q}_{min}\left(j\right)$,
${q}_{max}\left(j\right)$, and
k are problemspecific and given. They do satisfy some constraints, such as
$0\le {p}_{min}\left(i\right)\le {p}_{max}\left(i\right)\le {N}_{2}$ and
$0\le {q}_{min}\left(j\right)\le {q}_{max}\left(j\right)\le {N}_{1}$, as described above, as well as
$0<k\le {\sum}_{i=1}^{{N}_{1}}{p}_{min}\left(i\right)$ and
$k\le {\sum}_{j=1}^{{N}_{2}}{q}_{min}\left(j\right)$. We store those numbers in four vectors,
${P}_{min}=({p}_{min}\left(1\right),\dots ,{p}_{min}\left({N}_{1}\right))$,
${P}_{max}=({p}_{max}\left(1\right),\dots ,{p}_{max}\left({N}_{1}\right))$,
${Q}_{min}=({q}_{min}\left(1\right),\dots ,{q}_{min}\left({N}_{2}\right))$,
${Q}_{max}=({q}_{max}\left(1\right),\dots ,{q}_{max}\left({N}_{2}\right))$.
Equation (
3) recap most of the standard linear assignment problems:
 (i)
If $k={N}_{1}={N}_{2}$ and ${p}_{min}\left(i\right)={p}_{max}\left(i\right)={q}_{min}\left(j\right)={q}_{max}\left(j\right)=1$ for all i and j, we recover the balanced assignment problem,
 (ii)
If
${p}_{min}\left(i\right)={q}_{min}\left(j\right)=0$ and
${p}_{max}\left(i\right)={q}_{max}\left(j\right)=1$ for all
i and
j, the equations correspond to the
kcardinality assignment problem [
19,
20,
21].
In Equation (
3),
$G(i,j)$,
${n}_{1}\left(i\right)$ and
${n}_{2}\left(j\right)$ are unknown, defining a total of
${N}_{1}{N}_{2}+{N}_{1}+{N}_{2}$ variables. The solution to the general assignment problem is given by the functions
${n}_{1}^{*}$ and
${n}_{2}^{*}$ on
${S}_{1}$ and
${S}_{2}$, respectively, which identify which tasks and which agents are involved in the optimal assignment, the transportation matrix
${G}^{*}$ that defines these correspondences, and the minimum assignment cost
${U}^{*}=U({G}^{*},C)$.
Optimizing Equation (
2) subject to the constraints Equation (
3) constitutes a discrete optimization challenge, specifically an integer linear programming problem. To address this challenge, we employ a statistical physics methodology, transforming it into a temperaturedependent problem involving real variables. The integer optimal solution is then obtained as the temperature approaches zero.
2.1. Effective Free Energy for the General Assignment Problem
Solving the multiassignment problem entails determining the minimum of the function defined in Equation (
2) across the potential mappings between the two discrete sets of points under consideration. Identifying this minimum is tantamount to identifying the most probable state of the system it characterizes. This “system” encompasses the various binary transportation plans, also referred to as assignment matrices, between
${S}_{1}$ and
${S}_{2}$ that adhere to the constraints Equation (
3). Each state within this system corresponds to assignment matrix
G with its associated energy
$U(G,C)$ as defined in Equation (
2). The probability
$P\left(G\right)$ linked with an assignment matrix
G is given by
In this equation,
$\beta $ is the inverse temperature, namely
$\beta =1/{k}_{B}T$, where
${k}_{B}$ is the Boltzmann constant and
T is the temperature, and
$Z\left(\beta \right)$ is the partition function computed over all states of the system. As this system is defined by the assignment matrices
G and by the marginals of
G,
${n}_{1}$, and
${n}_{2}$, the partition function is equal to
where
$\mathcal{F}\left(\beta \right)$ is the free energy of the system. The practicality of this free energy is limited due to the inability to compute it explicitly. We develop a method for approximating it through the saddle point approximation technique.
Taking into account the constraints in Equation (
3), the partition function can be written as
The three sums impose that
$G(i,j)$,
${n}_{1}\left(i\right)$, and
${n}_{2}\left(j\right)$ take integer values within some ranges defined by the constraints Equation (
3). The additional constraints are imposed through the delta functions. We employ the Fourier representation of those delta functions, thereby introducing additional auxiliary variables
x,
$\lambda \left(i\right)$, and
$\mu \left(j\right)$, with
$i\in [1,{N}_{1}]$ and
$j\in [1,{N}_{2}]$. The partition function is then given, after reorganization, by (up to a multiplicative constant) by
where
$\xdf$ is the imaginary unit (
${\xdf}^{2}=1$). Note that we have rescaled the variables
x,
$\mathit{\lambda}$, and
$\mathit{\mu}$ by a factor
$\beta $ for consistency with the energy term. Conducting the summations over the variables
$G(i,j)$,
${n}_{1}\left(i\right)$, and
${n}_{2}\left(j\right)$, we get
where
${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$ is a functional, or effective free energy, that depends on the variables
$\mathit{\lambda}$,
$\mathit{\mu}$, and
x and is defined by
In contrast to the expression of the internal energy
U defined in Equation (
2) that depends on the
${N}_{1}{N}_{2}+{N}_{1}+{N}_{2}$ constrained binary variables
$G(i,j)$,
${n}_{1}\left(i\right)$, and
${n}_{2}\left(j\right)$, the expression for the effective free energy
${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$ depends only on
${N}_{1}+{N}_{2}+1$ unconstrained variables, namely
$\lambda \left(i\right)$,
$\mu \left(j\right)$, and
x. Below, we demonstrate how identifying the extremum of this function enables us to address the multiassignment problem.
2.2. Optimizing the Effective Free Energy
Let
$\overline{G}(i,j)$,
$\overline{{n}_{1}}\left(i\right)$, and
$\overline{{n}_{2}}\left(j\right)$ represent the expected values of
$G(i,j)$,
${n}_{1}\left(i\right)$, and
${n}_{2}\left(j\right)$, respectively, in accordance with the Gibbs distribution specified in Equation (
4). Computing these expected values directly is unfortunately not feasible as the partition function defined in Equation (
8) lacks an analytical expression. Instead, we derive a saddle point approximation (SPA) by seeking extrema of the effective free energy with respect to the variables
$\lambda $,
$\mu $, and
x:
After some rearrangements, these two equations can be written as
where
and
Note that
 (i)
$g(x,a,a)=a$. If
$a=1$ and
${N}_{1}={N}_{2}=1$, we recover Equation (
11) from [
16] corresponding to the balanced assignment problem.
 (ii)
$g(x,0,1)=h(x)$. In this case, Equation (
11) refers to the
kcardinality problem.
As frequently encountered, the saddle point may be purely imaginary. In this instance, it is evident from Equations (10) and (
11) that the variables
$\xdf\lambda \left(i\right)$,
$\xdf\mu \left(j\right)$, and
$\xdfx$ must be real. Consequently, we will replace
$\left\{\xdf\lambda \right(i),\xdf\mu (j),\xdfx\}$ by
$\left\{\lambda \right(i),\mu (j),x\}$ below.
In order to analyze the saddle point approximation, SPA, it is necessary to verify the existence and evaluate the uniqueness of the extrema of the effective free energy. The following theorem proves that ${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$ is strictly concave.
Theorem 1. The Hessian of the effective free energy ${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$ is negative definite if ${p}_{min}\left(i\right)<{p}_{max}\left(i\right)$ for all i and ${q}_{min}\left(j\right)<{q}_{max}\left(j\right)$, for all j, and negative semidefinite otherwise. The free energy function ${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$ is then strictly concave in the first case and concave in the second case.
The following property establishes a relationship between the solutions of the SPA system of equations and the expected values for the assignment matrix and for the indicator functions:
Proposition 1. Let ${\overline{S}}_{\beta}$ be the expected state of the system at the temperature β with respect to the Gibbs distribution given in Equation (4). ${\overline{S}}_{\beta}$ is associated with an expected transportation plan ${\overline{G}}_{\beta}$ and expected indicator functions ${\overline{{n}_{1}}}_{\beta}$ and ${\overline{{n}_{2}}}_{\beta}$. Let ${\lambda}^{MF}\left(i\right)$, ${\mu}^{MF}\left(j\right)$, and ${x}^{MF}$ be the solutions of the system of Equation (10). Then the following identities hold: To indicate that the solutions are mean field solutions, we use the superscript $MF$.
Proof. The proof of this proposition is virtually identical to the proof of the same results for the assignment problem, found in Appendix B of [
15]. □
For a given value of the parameter
$\beta $,
${\overline{n}}_{1\beta}\left(i\right)$ and
${\overline{n}}_{2\beta}\left(j\right)$ are the numbers of elements of
${S}_{2}$ and the number of elements in
${S}_{1}$ that are in correspondence with
i and
j, respectively, and
${\overline{G}}_{\beta}$ forms a transportation plan between
${S}_{1}$ and
${S}_{2}$ that is optimal with respect to the free energy defined in Equation (
8). Note that these values are mean values and fractional. The matrix
${\overline{G}}_{\beta}$ belongs to a polytope, which we define as
${\mathcal{U}}^{k}({P}_{min}^{max},{Q}_{min}^{max})$ (see
Appendix A for a full characterization of this polytope). We can link the mean field assignment matrix
${\overline{G}}_{\beta}$ to an optimal free energy
${F}_{\beta}^{MF}$ and to an optimal internal energy
${U}_{\beta}^{MF}={\sum}_{i,j}{\overline{G}}_{\beta}(i,j)C(i,j)$. These values serve as mean field approximations of the exact free energy and internal energy of the system, respectively. Here are the key properties of
${U}_{\beta}^{MF}$ and
${F}_{\beta}^{MF}$:
Proposition 2. ${F}_{\beta}^{MF}$ and ${U}_{\beta}^{MF}$ are monotonic increasing and monotonic decreasing functions, respectively, of the parameter β.
Theorem 1 and Proposition 2 outlined above underscore several advantages of the proposed framework, which reframes the multiassignment problem as a temperaturedependent process. Firstly, at each temperature, the multiassignment problem with a generic cost matrix is transformed into a concave problem with a unique solution. This problem exhibits linear complexity in the number of variables, contrasting with the quadratic complexity of the original problem. The concavity facilitates the utilization of straightforward algorithms for identifying a minimum of the effective free energy function (Equation (
8)). Additionally, Equation (
12) offers robust numerical stability for computing the transportation plan and the functions
${n}_{1}$ and
${n}_{2}$, owing to the characteristics of the functions
$h\left(x\right)$ and
$g\left(x\right)$. Lastly, the convergence with respect to temperature is monotonic.
3. Solving Generic Assignment Problems
In the previous section, we proposed an effective free energy, ${F}_{\beta}\left(\mathit{\lambda},\mathit{\mu},x\right)$, that depends on ${N}_{1}+{N}_{2}+1$ unconstrained variables and on the inverse of the temperature, $\beta $, whose extremum identifies the solution of a possibly multijob, multiagent assignment problem. We have shown that the trajectory of this extremum is monotonic, increasing with respect to $\beta $. We now relate these values to the optimal assignment energy ${U}^{*}$:
Theorem 2. Let ${F}_{\beta}^{MF}$ and ${U}_{\beta}^{MF}$ be the mean field approximations of the exact free energy and internal energy of the system at the inverse temperature β. The optimal assignment energy ${U}^{*}$ is then given by,namely, the optimal assignment energy, ${U}^{*}$, is equal to the infinite limit with respect to the inverse temperature of both the mean field free energy and the internal energy. This theorem illustrates that as the inverse temperature approaches infinity (or equivalently, as the temperature tends towards zero), the internal energy and free energy of the system converge to the optimal assignment energy. This confirms the validity of our statistical physics approach, particularly emphasizing the effectiveness of the saddlepoint approximation. Note, however, that it does not define the behavior of the coupling matrix ${\overline{G}}_{\beta}={X}^{MF}$. As ${\overline{G}}_{\beta}(i,j)=h\left(\beta (C(i,j)+{\lambda}^{MF}\left(i\right)+{\mu}^{MF}\left(j\right)+{x}^{MF})\right)$ and $0<h\left(x\right)<1$, the coupling matrix at any finite temperature is fractional. We need to show that as $\beta \to +\infty $, the corresponding matrix ${\overline{G}}_{\infty}$ does converge to the solution matrix ${G}^{*}$ and not to a fractional matrix that would lead to the same low energy ${U}^{*}$.
We first establish bounds on the internal energy and free energy at the SPA. Let us define
Theorem 3. ${F}_{\beta}^{MF}$ and ${U}_{\beta}^{MF}$, the mean field approximations of the exact free energy and internal energy of the system at the inverse temperature β, satisfy the following inequalities: where ${U}^{*}$ is the optimal assignment energy and $A({N}_{1},{N}_{2})$ is defined in Equation (14). Now, let us assume that the multiassignment problem linked with the ${N}_{1}\times {N}_{2}$ cost matrix C possesses a unique optimal assignment matrix, denoted as ${G}^{*}$. We have the following theorem:
Theorem 4. Let ${\overline{G}}_{\beta}$ be the coupling matrix solution of the SPA equations at the inverse temperature β. We assume that the multiassignment problem has a unique solution, with ${G}^{*}$ being the associated coupling matrix. If Δ is the difference in total cost between the optimal solution and the secondbest solution, then This theorem validates that, in the generic case in which the solution to the assignment problem is unique, the converged solution matrix ${\overline{G}}_{\infty}$ is this unique solution.
5. Matching: A Program for Solving Assignment Problems
We have implemented the multiassignment framework described here in a C++ program, Matching, that is succinctly described in Algorithm 1.
Matching relies on an iterative process in which the parameter
$\beta $ is gradually increased. At each value of
$\beta $, the nonlinear system of equations defined by Equation (10) is solved. We write this system as
where
$\mathbf{A}=({\mathbf{A}}_{\lambda},{\mathbf{A}}_{\mu},{A}_{x})$ is a vector of predicates defined as
This system has
${N}_{1}+{N}_{2}+1$ equations, with the same number of variables. It is solved using an iterative Newton–Raphson method (for details, see, for example [
16,
25]). Once the SPA system of equations is solved, the assignment matrix
${\overline{G}}_{\beta}$, the functions
${\overline{n}}_{1\beta}$,
${\overline{n}}_{2\beta}$, and the corresponding transportation energy
${U}^{MF}\left(\beta \right)$ are computed. The iterations over
$\beta $ are stopped if the mean field energy
${U}_{\beta}^{MF}$ does not change anymore (within a tolerance TOL usually set to
${10}^{6}$). Otherwise,
$\beta $ is increased, and the current values of
$\mathit{\lambda}$,
$\mathit{\mu}$ and
x are used as input for the following iteration. At convergence, the values of the assignment matrix are rounded to the nearest integer (indicated as in the output of Algorithm 1). The minimal energy is then computed using the corresponding integer matrix.
The primary computational expense of this algorithm arises from solving the nonlinear set of equations corresponding to the SPA at every
$\beta $ value. We use for this purpose an iterative Newton–Raphson method (see [
15]).
Algorithm 1 Matching: a temperaturedependent framework for solving the multiassignment problem 
Input:${N}_{1}$ and ${N}_{2}$, the number of agents and tasks; ${p}_{min}\left(i\right)$ and ${p}_{max}\left(i\right)$, the minimum and maximum number of agents needed to perform task i, and ${q}_{min}\left(j\right)$ and ${q}_{max}\left(j\right)$, the minimum and maximum number of tasks that can be performed by an agent j; k, the expected number of assignments; the cost matrix C. Initial value ${\beta}_{0}$ for $\beta $, the inverse of the temperature Initialize: Initialize arrays $\mathit{\lambda}$ and $\mathit{\mu}$ to 0 and initialize $x=0$. Set $STEP=\sqrt{10}$. for$i=1,\dots $ until convergence do  (1)
Initialize ${\beta}^{i}=STEP\ast {\beta}^{i1}$.  (2)
Solve non linear Equation (10) for $\mathit{\lambda}$, $\mathit{\mu}$ and x at saddle point  (3)
Compute corresponding ${\overline{G}}_{\beta}^{i}$, ${\overline{n}}_{1\beta}^{i}$, ${\overline{n}}_{2\beta}^{i}$, and ${U}_{\beta}^{i,MF}$  (4)
Check for convergence: if ${U}_{\beta}^{i,MF}{U}_{\beta}^{i1,MF}<TOL$, stop
end for Output: The converged assignment matrix $\u230a{\overline{G}}_{\beta}\u2309$, the functions $\u230a{\overline{n}}_{1\beta}\u2309$, $\u230a{\overline{n}}_{2\beta}\u2309$ over the agents and tasks, and the minimal associated cost ${U}_{\beta}$.

As for any annealing scheme, the initial temperature, or, in our case, the initial value ${\beta}_{0}$, is a parameter that significantly impacts the efficiency of the algorithm. Setting ${\beta}_{0}$ to be too small (i.e., a high initial temperature) will lead to inefficiency as the system will spend a significant amount of time at high temperatures, while setting ${\beta}_{0}$ too high will require many steps to converge at the corresponding low temperature, thereby decreasing the efficiency brought about by annealing. The value of $\beta $ scales the cost matrix C and as such is related to the range of this matrix, more specifically to its largest value, ${C}_{max}$. We found that setting ${\beta}_{0}{C}_{max}=1$ provides satisfactory annealing efficiency. The value for $STEP$ was chosen empirically.
6. Examples
The framework we propose is general: it allows us to solve balanced and unbalanced assignment problems, including those that allow for multiagent or multitask assignments. We illustrate our method on the latter types of problems, as, to our knowledge, there are currently no solutions to those that are guaranteed to reach the optimal assignment.
As a first illustration of our framework, we ran Matching on the cost matrix
${C}_{1}$ given in
Table 1. This matrix has been used in previous studies of multiagent assignment problems [
10,
11,
13,
14,
26,
27]. Matching was run with the following parameters:
${p}_{min}=0$ for all agents (i.e., some agents may stay idle),
${p}_{max}=4$ for all agents (i.e., an agent can perform up to 4 tasks),
${q}_{min}={q}_{max}=1$ (i.e., a task is only performed by one agent), and
$k=8$ (all tasks are performed). In
Figure 1, we show the corresponding trajectories of the internal energy
${U}_{\beta}^{MF}$ and free energy
${F}_{\beta}^{MF}$.
As expected, the internal energy is monotonically decreasing while the free energy is monotonically increasing, and both converge to the same value, 1440. Theorem 3 provides bounds on those energy values. Note that it can be rewritten as
i.e., at each value of
$\beta $, we have bounds based on internal energy and free energy for the actual optimal cost of the assignment problem. These bounds are shown as shaded areas in
Figure 1. Note that the widths of the intervals defined by the bounds are inversely proportional to
$\beta $ and therefore decrease monotonically as
$\beta $ increases.
In
Table 2, we compare the assignment found by Matching on
${C}_{1}$ with
${p}_{max}$ set to 4 (i.e., up to four tasks per agent), and
${p}_{min}=0$ (agents can be idle) or
${p}_{min}=1$ (each agent must execute at least one task). The removal of the latter constraint leads to a better optimal assignment in which agent 3 remains idle. When we maintain this constraint, our results are the same as those found by Wang et al. [
13].
As a second more general test of our method, we compared the results of the framework we propose with the results of our own version of the Hungarian algorithm, as well as with those found in previous studies. We used both the matrix C1 and the matrix C2 given in
Table 3 in those computing experiments.
We ran Matching as follows. For all tasks
j, we set
${q}_{min}\left(j\right)={q}_{max}\left(j\right)=1$, i.e., a task is only performed by one agent, and all tasks are expected to be executed. The latter is further enforced by setting
k to be the total number of tasks (8 for
${C}_{1}$ and 10 for
${C}_{2}$). For an agent
i, we either set all
${p}_{min}\left(i\right)$ to be 1 (in which case all agents must perform at least one task) or 0 (in which case some agents may not be assigned). We considered all
${p}_{max}\left(i\right)$ to be equal to a given value
p and ran Matching with
p varying from 1 to
k. Note that both matrices
${C}_{1}$ and
${C}_{2}$ contain cycles. As such, optimal assignments based on those matrices are not unique. To remove the degeneracy, we added random uniform noise between
$[0,\u03f5]$ with
$\u03f5=0.001$ to all values of the cost matrices (see
Section 4 for details).
The Hungarian algorithm remains a standard for solving balanced as well as unbalanced assignment problems. It needs to be adapted, however, when solving multitask assignment problems. The corresponding textbook solution that was used, for example, in Ref. [
14] is to make copies or clones of the agents, solve the augmented unbalanced assignment problem using the Hungarian algorithm, and then regroup all clones of an agent to define the tasks that it is assigned to. We consequently created multiple versions of the cost matrices
${C}_{1}$ and
${C}_{2}$, with all agents copied
p times, where
p defines the maximum number of tasks that an agent can perform. We ran our own version of the Hungarian algorithm on those matrices. This version is adapted from the serial code written by C. Ma and is publicly available at
https://github.com/mcximing/hungarianalgorithmcpp, (accessed on 1 May 2021).
Comparisons of the results of Matching, of the Hungarian algorithm, and of previous studies are provided in
Table 4 for the cost matrix C1 and in
Table 5 for the cost matrix C2.
The results of Matching have been proven to be optimal (see
Section 3). As expected, those results are strongly dependent on the constraints imposed on the problem: we can find assignments with a lower total cost if we allow agents to remain idle by setting
${p}_{min}$ to 0. For example, for the cost matrix
${C}_{1}$, in the extreme case with
${p}_{min}=0$ and
${p}_{max}=8$ for all agents, we find that all eight tasks have been assigned to agent 5, while the other agents have no task to perform, with a total cost of 1400. If instead we set
${p}_{min}=1$ and keep
${p}_{max}=8$, we find that agent 5 is assigned tasks 1, 2, 5, and 6; agent 1 is assigned task 3; agent 2 is assigned task 8; agent 3 is assigned task 4; and agent 4 is assigned task 7, for a total cost of 1450. If we instead run the Hungarian algorithm with agents that have been cloned to allow for multitask assignments, we find optimal assignments that match those found by Matching with
${p}_{min}$ set to 0 for both cost matrices. For matrix
${C}_{1}$, for example, if each agent is represented with 8 clones, we find that agent 5 is assigned tasks 1, 2, 4, 5, 6, 7, and 8 while agent 1 is assigned task 3, for a total cost of 1400. This illustrates two points. First, as expected, the optimal assignment is not unique, as we find two different assignments with the same cost, 1400. Second, and more importantly, this shows the difficulty of applying the Hungarian algorithm for such problems. It works fine if we want to find the optimal assignment without consideration of constraints, such as the constraint each agent needs to perform at least one task, but does not fit if such a constraint is necessary.
The optimal solutions found by Matching when
${p}_{min}$ is set to 1 match those found by Wang et al. [
13] for both matrices and are better than those found by Majumdar et al. [
26] for matrix
${C}_{2}$. Note that the latter are obtained using either an ant colony algorithm or a genetic algorithm. Both are probabilistic algorithms that do not guarantee that the true minimum is found.
7. Conclusions
We have developed a general framework for solving balanced and unbalanced and constrained and unconstrained assignment problems. Given two sets of points ${S}_{1}$ and ${S}_{2}$ with the possibly different cardinalities ${N}_{1}$ and ${N}_{2}$, constraints on the number of possible assignments for each element of ${S}_{1}$ and of ${S}_{2}$, and a cost matrix defining the penalties of on assignment, we have constructed a concave free energy parameterized by temperature that captures those constraints. The definition of this free energy is general enough that it includes balanced and unbalanced cases. Its extremum establishes an optimal assignment between the two sets of points. We have demonstrated that this free energy consistently decreases as a function of $\beta $ (the inverse of temperature) towards the optimal assignment cost. Moreover, we have established that for sufficiently large $\beta $ values, the precise solution to the generic multiassignment problem can be directly derived through straightforward rounding to the nearest integer of the elements of the assignment matrix linked to this extremum. Additionally, we have developed a method that guarantees convergence for addressing degenerate assignment problems.
The formalism introduced in this paper was designed to generalize the Hungarian algorithm for a large range of assignment problems. We expect it to be useful for a much larger set of problems, especially those associated with graphs. Graphs capture data relationships and, as such, are essential to numerous applications. They are particularly useful in domains such as Web search [
28], neural [
29] and social network analysis [
30], gene networks [
31], etc. More generally, they are designed to represent complex knowledge. The scale of modern graphs leads to a need to develop more efficient methods to process very large graphs. The formalism we propose is well adapted to tackle this problem for applications such as bipartite or simple graph matching. We will also consider extensions to higherorder matching problems, such as
kmatching problems [
32] (for example the threeassignment problem [
33]) that are known to be
$NP$complete [
34]. These problems have their own applications for graph analyses.