two algorithms for maximum and minimum weighted bipartite
TRANSCRIPT
Two Algorithms for Maximumand Minimum Weighted
Bipartite Matching
Advisor: Prof. Yuh-Dauh Lyuu
Hung-Pin Shih
Department of Computer Science and Information EngineeringNational Taiwan University
Abstract
This thesis applies two algorithms to the maximum and minimum weightedbipartite matching problems. In such matching problems, the maximizationand minimization problems are essentially same in that one can be trans-formed into the other by replacing the weight on each edge with an inverseof the weight. Depending on the algorithms we used, we will choose the maxi-mization or minimization problems for illustrations. We apply the ant colonyoptimization (ACO) algorithm on a minimum weighted bipartite matchingproblem by transforming the problem to a traveling salesman problem (TSP).It may seem that makes the problem more complicated, but in reality it doesnot. We call this algorithm “ant-matching,” which can solve any weightedbipartite matching problems with or without a perfect matching. Besides, wealso apply the Metropolis algorithm to solve the maximum weighted bipartitematching problem. To analyze the performance on these two algorithms, wecompare the algorithms with the exact Hungarian algorithm, a well-knowncombinatorial optimization method for solving the weighted bipartite match-ing problem.
Keywords: Metropolis algorithm, Ant colony optimization, Maximumweighted bipartite matching, Minimum weighted bipartite matching
Contents
1 Introduction 4
2 Preliminaries 52.1 Maximum/Minimum Weighted Bipartite Matching . . . . . . 5
2.1.1 Weighted Bipartite Graph . . . . . . . . . . . . . . . . 52.1.2 Maximum/Minimum Weighted Bipartite Matching . . 5
2.2 Ant Colony Optimization . . . . . . . . . . . . . . . . . . . . . 62.3 Metropolis Algorithm . . . . . . . . . . . . . . . . . . . . . . . 7
3 Maximum/Minimum Weighted Bipartite Matching Prob-lems 93.1 ACO Algorithm for Minimum-Weighted Bipartite Matching . 9
3.1.1 Transforming Minimum-Weighted Bipartite Matchingto Traveling Salesman Problem . . . . . . . . . . . . . 10
3.1.2 Using ACO Algorithm to Solve Minimum-Weighted Bi-partite Matching . . . . . . . . . . . . . . . . . . . . . 12
3.1.3 The Complexity of Ant-Matching Algorithm . . . . . . 133.2 Metropolis Algorithm for Maximum-Weighted Bipartite
Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2.1 The Complexity of Metropolis Algorithm . . . . . . . . 15
4 Experimental Results 174.1 Comparison of Complexity . . . . . . . . . . . . . . . . . . . . 174.2 Graph Sampling Algorithm . . . . . . . . . . . . . . . . . . . 184.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.1 Results on Complete Bipartite Graphs . . . . . . . . . 194.3.2 Results on Sparse Bipartite Graphs . . . . . . . . . . . 204.3.3 Results on Ant-Matching Algorithm . . . . . . . . . . . 234.3.4 Results on Metropolis Algorithm . . . . . . . . . . . . 25
5 Conclusions 35
1
List of Figures
3.1 Transforming a bipartite matching problem to a TSP: (1) Theoriginal bipartite graph G. (2) Add u′
1 and its correspondingedges. (3) The final graph G′. . . . . . . . . . . . . . . . . . . 10
4.1 The running time of each algorithm on the complete bipartitegraph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 The running time of each algorithm on the bipartite graphwhere each vertex ui ∈ U has at most 2% ∗ |V | edges. . . . . . 21
4.3 The running time of each algorithm on the bipartite graphwhere each vertex ui ∈ U has at most 5 edges. . . . . . . . . . 22
4.4 The running times of the ant-matching algorithm on each dif-ferent bipartite graph. . . . . . . . . . . . . . . . . . . . . . . 24
4.5 The weights found by the ant-matching algorithm as propor-tions to the weights of the optimal solution on each differentbipartite graph. . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.6 The weight found by the Metropolis algorithm as proportionsto the weights of the optimal solution on each different bipar-tite graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2
List of Tables
4.1 Comparison of complexity . . . . . . . . . . . . . . . . . . . . 174.2 The weights as proportions to the weights of the optimal so-
lution on the complete bipartite graph. . . . . . . . . . . . . . 194.3 The weights as proportions to the weights of the optimal so-
lution on the bipartite graph where each vertex ui ∈ U has atmost 2% ∗ |V | edges. . . . . . . . . . . . . . . . . . . . . . . . 21
4.4 The weights as proportions to the weight of the optimal solu-tion on the bipartite graph where each vertex ui ∈ U has atmost 5 edges. . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.5 Results on each algorithm for complete bipartite graphs. . . . 264.6 Results on each algorithm for the bipartite graphs where each
vertex has at most 50% ∗ |V | edges. . . . . . . . . . . . . . . . 274.7 Results on each algorithm for the bipartite graphs where each
vertex has at most 25% ∗ |V | edges. . . . . . . . . . . . . . . . 284.8 Results on each algorithm for the bipartite graphs where each
vertex has at most 10% ∗ |V | edges. . . . . . . . . . . . . . . . 294.9 Results on each algorithm for the bipartite graphs where each
vertex has at most 5% ∗ |V | edges. . . . . . . . . . . . . . . . . 304.10 Results on each algorithm for the bipartite graphs where each
vertex has at most 2% ∗ |V | edges. . . . . . . . . . . . . . . . . 314.11 Results on each algorithm for the bipartite graphs where each
vertex has at most 5 edges. . . . . . . . . . . . . . . . . . . . . 324.12 Results on each algorithm for the bipartite graphs where each
vertex has at most 10 edges. . . . . . . . . . . . . . . . . . . . 334.13 Results on each algorithm for the bipartite graphs where each
vertex has at most 20 edges. . . . . . . . . . . . . . . . . . . . 34
3
Chapter 1
Introduction
The maximum/minimum weighted bipartite matching problem is a combina-torial optimization problem, and there exist many optimization algorithmsto solve the matching problem. But here we try some heuristic or sam-pling methods and expect them to generate reasonable sub-optimal solutionswithin reasonable time bounds. Specifically we use the ant colony opti-mization (ACO) and the Metropolis algorithm. In the ACO algorithm, wetransform this matching problem to a traveling salesman problem (TSP)and use the concepts of ACO algorithm as a basis for a new method to solvethe matching problem. We call the new method “ant-matching.” In theMetropolis algorithm, we randomly select a matching edge in each iterationto generate an approximate solution. Then we compare the performancesof these two algorithms with the exact Hungarian algorithm [2], which is aoptimization algorithm used to solve the weighted matching problems.
The structure of this thesis is organized as follows: In Chapter 1 andChapter 2, we define the problem of maximum/minimum weighted bipar-tite matching and introduce the background of the two above-mentionedalgorithms. In Chapter 3, we transform the weighted bipartite matchingproblem to a traveling salesman problem (TSP) and apply the concepts ofant colony optimization (ACO) algorithm as a basis for a new matching al-gorithm called “ant-matching.” In the latter part of Chapter 3, we applythe Metropolis algorithm to solve the maximum weighted bipartite matchingproblem. Finally, Chapter 4 compares these algorithms with other methodsin solving the weighted matching problems, and we conclude in Chapter 5.
4
Chapter 2
Preliminaries
2.1 Maximum/Minimum Weighted Bipartite
Matching
2.1.1 Weighted Bipartite Graph
A bipartite graph G = (U, V,E) is a graph whose vertices can be dividedinto two disjoint sets U and V such that each edge (ui, vj) ∈ E connects avertex ui ∈ U and one vj ∈ V . If each edge in graph G has an associatedweight wij, the graph G is called a weighted bipartite graph.
2.1.2 Maximum/Minimum Weighted BipartiteMatching
In a bipartite graph G = (U, V,E), a matching M of graph G is a subsetof E such that no two edges in M share a common vertex. If the graphG is a weighted bipartite graph, the maximum/minimum weighted bipartitematching is a matching whose sum of the weights of the edges is maxi-mum/minimum. The maximum/minimum weighted bipartite matching canbe formulated as follows:
max / min∑
(ui,vj)∈E
wijxij
|U |∑i=1
xij = 1,∀j = 1, ..., |V |
|V |∑j=1
xij = 1,∀i = 1, ..., |U |
5
xij ∈ {0, 1}
where xij is 1 denotes edge (ui, vj) is an edge in the maximum/minimumweighted bipartite matching.
2.2 Ant Colony Optimization
In the real world, ants are social insects and communicate with some inter-esting behavior. Each ant lays down pheromone on the path. When antsfind foods, they will go back to its nest. If some other ants encounter thepath, they will follow it based on the density of pheromone deposited. Thepheromone on the path that ants found initially will be reinforcing. Eventu-ally, ants will find the foods.
Over time, the pheromone on the path evaporates, thus reducing its at-tracting strength. The longer path an ant travels down and back, the moretime the pheromone has to evaporate. On a shorter path, an ant travelsdown the path and back faster, and the pheromone density remains highas the pheromone is laid on as fast as it can evaporate. Assume the antcolony converges to a path. If a shorter path is found by some ants, becausethe path is shorter than the original path that the ant colony converged to,the ants travel down the path and back faster. The density of pheromoneon the shorter path will increase gradually and the density on the originalpath will decrease. After a period of time, the ant colony will converge tothe shorter path. It will prevent the ant colony from converging to a localoptimal solution.
The ant colony optimization (ACO) algorithm comes from observing thebehavior of the ants. It simulates the ants and the pheromone evaporation onthe paths. In each iteration, the ants select the paths according to the densityof pheromone deposited. If the path has higher density, it will be selectedwith higher probability. After finding a path, the ants lay down pheromoneon the path. In the ACO algorithm, each path represents a solution. Besides,the pheromone evaporates gradually. The ACO algorithm is illustrated inAlgorithm 1.
Algorithm 1 ACO Algorithm for TSP
while termination condition not met dogenerate solutionspheromone update
end while
6
The ACO algorithm has been used in solving the traveling salesman prob-lem (TSP) to find a nearly optimal solution [4]. In the TSP problem, thereare n cities. Each city has to be visited exactly once, and the tour endsat the starting city. The problem is to find a shortest tour to visit these ncities. Let dij be the distance between the city i and the city j and τij bethe pheromone on the edge connects i and j.
Each of the m ants decides independently on the city to be visited next.They base their decision on the density of pheromone τij and a heuristicfunction ηij. The probability of choosing the next city j from current city iat the tth iteration is
pkij =
[τij(t)]α(ηij)
β∑l∈Nk
l[τil(t)]α(ηij)β
,∀j ∈ Nki (2.1)
where ηij = 1dij
is a commonly used heuristic function, α and β are two
parameters to determine the relative influences of the pheromone and thedistance, and Nk
i is a list of cities that the kth ant has yet to visit.After all ants have constructed their complete tours, we update the
pheromone on each edge thus:
τij(t + 1) = (1− ρ)τij(t) +m∑
k=1
∆τ kij(t) (2.2)
where 0 < ρ ≤ 1 is the pheromone evaporation rate, ∆τ kij(t) is the pheromone
that the kth ant deposited at the tth iteration, which is defined as follows:
∆τ kij(t) =
{1/Lk(t) if(i, j) ∈ T k(t)0 if(i, j) /∈ T k(t)
(2.3)
where Lk(t) is the length of the kth ant’s tour at the tth iteration, T k(t) is thekth ant’s tour at the tth iteration. The shorter the tour the ants found, themore pheromone is deposited. After a number of iterations, the ant colonywill converge to a nearly shortest tour. Finally, select any starting city andfollow the edge with the highest density of pheromone to visit as the nextcity. After completing the tour, the tour is a solution of the TSP problem.
2.3 Metropolis Algorithm
The Metropolis algorithm is an algorithm to generate a sequence of samplesfrom a probability distribution that is hard to sample directly. It uses theMarkov chain Monte Carlo simulation to approximate the distribution [1].
7
The Metropolis algorithm can generate samples from any unknown proba-bility distribution P (x) and requires only a function proportional to the den-sity of P (x) that can be calculated at x. The algorithm generates a Markovchain in which each state xt+1 depends only on the previous state xt. LetQ(xt, x′) denotes the candidate-generating density, where
∫Q(xt, x′)dx′ = 1.
The algorithm depends on the current state xt to generate a new sample x′
from Q(xt, ·)1. The sample x′ is accepted as the next state xt+1 if α ∈ U(0, 1)satisfies Eq. (2.4):
α <P (x′)Q(x′, xt)
P (xt)Q(xt, x′)(2.4)
If α satisfies Eq. (2.4), xt+1 = x′. Otherwise, the current state xt is retained,i.e., xt+1 = xt. The algorithm is illustrated in Algorithm 2.
Algorithm 2 Metropolis Algorithm
for t = 1, 2, ..., N dosample x′ from Q(xt, ·) and α from U(0, 1) {U(0, 1) is the uniform dis-tribution on(0, 1)}if α < P (x′)Q(x′,xt)
P (xt)Q(xt,x′)then
xt+1 = x′
elsext+1 = xt
end ifend forreturn {x(1), x(2), ..., x(N)}
1Lyuu: but if you do not know what Q is how can you generate x’????Hung-Pin: We don’t know Q at first. But we can observe the possible transitions betweenthe current state and the next state to find a possible Q. The possible Q may be corrector wrong, but it will describe the transitions. This is reasonable, if we don’t know theprobability distribution P (x), we observe the transitions between the current state andthe next state and infer a possible Q. We can use Q to sample the other next states andfind the unknown probability distribution P (x).
8
Chapter 3
Maximum/Minimum WeightedBipartite Matching Problems
In a weighted bipartite graph G = (U, V,E), we want to find a maxi-mum/minimum weighted bipartite matching (maximum/minimum-weightedBM) whose sum of the weights of the edges is maximum/minimum. To solvethis matching problem, we present two methods. For illustrations, we willintroduce each method on a different matching problem. Specifically we ap-ply the ACO algorithm to solve the minimum-weighted BM problems andthe Metropolis algorithm to solve the maximum-weighted BM problems.
3.1 ACO Algorithm for Minimum-Weighted
Bipartite Matching
In a weighted bipartite graph G = (U, V,E), we want to find a matchingwhose sum of the weights of the edges is minimum. Here we apply theconcepts of ACO algorithm as a basis for a new method to solve the matchingproblem. First, we transform the matching problem to a TSP problem. Itmay seem that makes the matching problem more complicated, but in realityit does not. Second, we apply the ACO algorithm on the TSP problemand perform some simplifications to be explained later on solving the TSPproblem. The result is a new method for solving the minimum-weightedBM problem. In this chapter, the TSP refers to the problem of finding aminimum weighted complete tour on the complete graph with multiple edgesbetween vertices, and the number of edges between vertices will change asthe different tour selection.
9
Figure 3.1: Transforming a bipartite matching problem to a TSP: (1) Theoriginal bipartite graph G. (2) Add u′
1 and its corresponding edges. (3) Thefinal graph G′.
3.1.1 Transforming Minimum-Weighted BipartiteMatching to Traveling Salesman Problem
In a weighted bipartite graph G = (U, V,E), we choose either U or V as thebase vertices and transform the minimum-weighted BM problem to a TSPproblem. We choose the vertices set U as our base vertices for illustrations.First, for each ui ∈ U , we create a corresponding virtual vertex u′
i ∈ U ′,where U ′ is the set of vertices correspond to U and |U ′| = |U |. Then, foreach (ui, vj) ∈ E where ui ∈ U, vj ∈ V , we create a corresponding back edge(u′
i, vj) ∈ E ′ with an associated weight 0, where E ′ contains the edges wecreate. Furthermore, we create another back edge (ui, u
′i) ∈ E ′ with a large
associated weight wmax. Here we define this large associated weight wmax as20 ∗maxi∈|U |,j∈|V | wij. Finally, for each virtual vertex u′
i ∈ U ′, we create theedges (u′
i, uk) ∈ E ′ to connect each vertex uk ∈ U, uk 6= ui, with an associatedweight wik = 0. Thus, we have a new graph G′ = (U, V,E, U ′, E ′). The abovesteps are illustrated in Algorithm 3 and Figure 3.1. In Figure 3.1, each backedge (u′
i, vj) ∈ E ′ is in green and (ui, u′i) ∈ E ′ is in red. Besides, the edges
(u′i, uk) connect each vertex u′
i to all the other vertices in U are in grey.In the new graph G′ = (U, V,E, U ′, E ′), on each base vertex ui ∈ U , we
define that if we choose the edge (ui, vj) ∈ E, then we will follow the edge(vj, u
′i) ∈ E ′ back to vertex u′
i ∈ U ′. Thus, for each base vertex ui ∈ U , thereare some paths ui−vj −u′
i where (ui, vj) ∈ E and (vj, u′i) ∈ E ′, and the path
10
Algorithm 3 Transform Graph G to G′
Input: Weighted bipartite graph G = (U, V,E)and each edge (ui, vj) ∈ E has a weight wij.
E ′ = ∅for ui ∈ U do
create vertex u′i ∈ U ′
for (ui, vj) ∈ E doadd back edge (u′
i, vj) to E ′ with weight 0end foradd back edge (ui, u
′i) to E ′ with weight wmax
for uk ∈ U doadd edge (u′
i, uk) to E ′ with weight 0end for
end forreturn graph G′ = {U, V,E, U ′, E ′}
ui−u′i where (ui, u
′i) ∈ E ′. So there exist a edge from ui to its corresponding
virtual vertex u′i ∈ U ′. Furthermore, each virtual vertex u′
i is connected toall the other base vertices uk ∈ U . Thus, if we start from any base vertexui ∈ U on the graph G′, we can visit each base vertex in U exactly once andend at ui (a Hamiltonian cycle). If we want to find a matching M in thebipartite graph G, we can find it with a Hamiltonian cycle in the graph G′
as follows.Let Availi(V ) ⊆ V be the vertex set adjacent to the vertex ui ∈ U such
that for each vertex vj ∈ Availi(V ), each edge (ul, vj) ∈ E is not yet anmatching edge in the matching M . On each vertex ui ∈ U , the ant mayselect12 the edge (ui, vj) ∈ E followed by (vj, u
′i) ∈ E ′ where vj ∈ Availi(V ),
or select the edge (ui, u′i) ∈ E ′. If the ant select the edge (ui, vj) ∈ E followed
by (vj, u′i) ∈ E ′, we add a new matching edge (ui, vj) to M . If the ant select
the edge (ui, u′i) ∈ E ′, we do not change M . After visiting all the base vertex
ui ∈ U exactly once, we will find the matching M .
1Lyuu: what do you mean by select? what if both are possible, which one do youselect?Hung-Pin: We choose edge based on the pheromone. It will be explained later. Here wejust explain the reduction.
2Lyuu: this is strange. if you are only describing a reduction, why bring up ”select”?Also if you use ”select”, it is better to write ”the ant may select”?Hung-Pin: I replace reduction with transformation. Moreover, because there are multi-paths between ui and u′
i, the different selection has different means in the matching M . Iuse the ”select” to explain the differences and the relations between the matching problemand the TSP problem.
11
Thus, if we find a tour to visit each base vertex ui ∈ U exactly onceand then return to the starting base vertex, and the total weight of thistour is minimum, we have a minimum weighted bipartite matching M onthe weighted bipartite graph G. Now, we have successfully transformed theminimum-weighted BM problem to the TSP problem.
3.1.2 Using ACO Algorithm to Solve Minimum-Weighted Bipartite Matching
After transforming the weighted bipartite graph G = (U, V,E) to a newgraph G′ = (U, V,E, U ′, E ′), we can use the ACO algorithm to solve theTSP problem on G′ and find the solutions of the original matching problem.But here we can perform some simplifications on solving the TSP problem.In the graph G′, the algorithm needs to visit all vertices in the set U andcorresponding set U ′ of U to do matching. With the simplification, becausewe define that if the ant select the base vertex ui ∈ U , then the ant will followthe paths ui − vj − u′
i or the path ui − u′i back to the vertex u′
i, we can seeU and U ′ same because if the algorithm visits the base vertex ui ∈ U , it willvisit its corresponding virtual vertex u′
i ∈ U ′ next.3 Therefore, the algorithmcan just visit each ui ∈ U and select a matching edge (ui, vj) ∈ E. It willhelp this method more efficient and applicable for the minimum-weightedBM problems. We call this new method “ant-matching.”
In the ACO algorithm, the ants choose the next vertex independentlybased their decision on the density of pheromone and a heuristic function.In the ant-matching algorithm, the ants choose the next vertex based on thesame mechanisms. In each iteration t, the ants choose the next base vertexui ∈ Availk(U)(t) based on the density of pheromone τp(i)i(t) as Eq. (3.1),
where Availk(U)(t) is the set of available base vertices that the kth ant hasyet to visit at the tth iteration and up(i) ∈ U is the predecessor of the vertexui. Let Nk
i (t) ⊆ V be the set of the kth ant’s available adjacent vertices ofui at the tth iteration. If |Nk
i (t)| > 0, each of the m ants chooses one vertexvj ∈ Nk
i (t) to do matching based on the density of pheromone τij(t) anda heuristic function ηij(t) as Eq. (2.1), then adds the weight wij to Lk(t),where Lk(t) is the length of the kth ant’s tour in iteration t. Otherwise, the
3Lyuu: I do not think this is true, as we discussed last Thursday. You want it to betrue, but it may not be true for a general TSP solver. you need to say YOUR TSP solverwill impose this conditionHung-Pin: I add a sentence before this sentence to explain the condition. Besides, atthe end of the section 3.1, I redefine the TSP problem in the transformation. It is not ageneral TSP. It likes a related TSP problem which generalized TSP deals with ”states”.Thus, I redefine the TSP problem.
12
ant does nothing but adds a large associated weight wmax to Lk(t). Aftereach of m ants visiting all the vertices in the set U , update the pheromoneon each edge and start the next iteration. The pheromone deposited on eachedge (ui, uk) ∈ E ′ represents an order relation such that if one ant choosesthe vertex ui, it will choose the vertex uk next time. And a large amount ofpheromone on the edge (ui, vj) represents that the edge (ui, vj) is a preferredmatching edge. Thus, we have the order relations to do matching on thevertex set U and the preferred matching edges on each vertex ui ∈ U . Wecan find the solutions of the matching problems according to the density ofpheromone. The algorithm is listed in Algorithm 4, and Algorithm 5 is thedetail.
pkp(i)i =
[τp(i)i(t)]α∑
l∈Availk(U)(t)[τp(i)l(t)]α∀i ∈ Availk(U)(t) (3.1)
Algorithm 4 Ant-Matching Algorithm
for t = 1 to tmax dofor k = 1 to NumberOfAnts do
choose ui ∈ Availk(U)(t) based on τp(i)i(t)choose vertex vj ∈ Nk
i (t) based on τij(t) and ηij(t)end forupdate pheromone
end for
3.1.3 The Complexity of Ant-Matching Algorithm
In the ant-matching algorithm, each ant visits each vertex ui in the vertexset U and searchs each edge adjacent to ui exactly once. Thus, generatinga solution costs O(U + E). Moreover, it costs O(U2 + E) to update thedensity of pheromone on each edge (ui, uk) where ui, uk ∈ U and on each edge(ui, vj) ∈ E. If there are m ants and tmax iterations. The total complexity ofthe ant-matching algorithm is O(tmax(m(U + E) + U2 + E)).
3.2 Metropolis Algorithm for Maximum-
Weighted Bipartite Matching
In a weighted bipartite graph G = (U, V,E), we can choose the vertex set U orV arbitrarily to do matching. We choose the vertex set U for illustrations. We
13
Algorithm 5 Ant-Matching Algorithm in Detail
Input: Weighted bipartite graph G = (U, V,E)and each edge (ui, vj) ∈ E has a weight wij.
MatchingListBest = []Weightmin = ∞for t = 1 to tmax do{Generate Solution}for k = 1 to NumberOfAnts do
Availk(U)(t) = U ;MatchingListk(t) = []Weightk(t) = 0while |Availk(U)(t)| > 0 do
choose available ui ∈ Availk(U)(t) based on τij(t)
remove ui in Availk(U)(t)if ui has available adjacent vertices Nk
i (t) ⊆ V thenchoose vj ∈ Nk
i (t) based on τij(t) and ηij
add (ui, vj) into MatchingListk(t)Weightk(t) = Weightk(t) + wij
elseadd (ui, φ) into MatchingListk(t)Weightk(t) = Weightk(t) + wmax
end ifend whileif Weightk(t) ≤ Weightmin(t) thenMatchingListBest = MatchingListk(t)
end ifend for{Update pheromone}for k = 1 to NumberOfAnts do
for l = 1 to |MatchingListk(t)| and (xl, yl) ∈ MatchingListk(t) do∆τ k
xl−1,xl(t) = 1/Weightk(t)
if yl 6= φ then∆τ k
xl,yl(t) = 1/Weightk(t)
else∆τ k
xl,xl(t) = 1/Weightk(t)
end ifend for
end forfor (ui, vj) ∈ E do
τij(t + 1) = (1− ρ)τij(t) +∑m
k=1 ∆τ kij(t)
end forfor ui, uj ∈ U, ui 6= uj do
τij(t + 1) = (1− ρ)τij(t) +∑m
k=1 ∆τ kij(t)
end fort = t + 1;
end for
14
apply the Metropolis algorithm on the maximum weighted bipartite matching(maximum-weighted BM) problem. Let x be the current search state. x ∈{0, 1}|E| describes the set of matchings (ui, vj), where xij = 1 denotes amatching edge, xij = 0 denotes not.
In each iteration, choose (ui, vj) ∈ E at random and flip xij. Thus, inthe current state x, choose a new search state x′ = {x′
00, ..., x′|U ||V |} where
x′ij = 1− xij, and x′
gh = xgh, if the edges (ug, vh) 6= (ui, vj).After choosing a new state x′, using a fitness function f to decide if we
choose the new search state x′ as the next state. If f(x′) ≥ f(x), select x′. If
f(x′) < f(x), select x′ with the probability ef(x′)−f(x)
K , where K is a constant,otherwise, select x. The algorithm is illustrated in Algorithm 6.
Algorithm 6 Apply Metropolis Algorithm to Maximum-Weighted BM
Input: Weighted bipartite graph G = (U, V,E)and each edge (ui, vj) ∈ E has a weight wij.
loopchoose (ui, vj) ∈ E at random and flip xij
sample α from U(0, 1)if f(x′) ≥ f(x) then
select x′
elseif α ≤ e
f(x′)−f(x)K then
select x′
end ifend if
end loop
Here we choose 0m as the starting state x for the maximization prob-lems and choose a fitness function f , where f(x) = 0 for the state xwhich there exist two edges in the matching sharing a common vertex, andf(x) =
∑ui∈U,vj∈V xijwij for the state x, not which has two edges that share
the same vertex. This fitness function f will guarantee the matching is rea-sonable in each iteration.
3.2.1 The Complexity of Metropolis Algorithm
In the Metropolis algorithm, generating a new search state costs a little. Togenerate a new search state we choose a edge (ui, vj) ∈ E at random and flipxij. It will cost O(1) to generate a new search state. Then, it costs O(1) tocalculate the weight of the new search state and costs O(1) to verify if the
15
new state is reasonable. If the new search state is better than the best state,record the new search state as the best state and it will cost O(U). Thus, ifthere are c iterations, the complexity of the Metropolis algorithm is O(cU).
16
Chapter 4
Experimental Results
After introducing the two methods on solving the weighted bipartite match-ing problems, we write them in programs to do some experiments and com-pare them with the Hungarian algorithm, a well-known algorithm for solvingthe weighted bipartite matching problems. In a weighted bipartite graphG = (U, V,E) and each edge (ui, vj) ∈ E has an associated weight wij.We replace each edge weight wij with 1
wijto transform a maximum weighted
bipartite matching problem to a minimum weighted bipartite matching prob-lem. Thus, we can use these algorithms to solve the maximum or minimumweighted bipartite matching problem.
4.1 Comparison of Complexity
Before the experiments, we compare the complexity first. The complexity ofeach algorithm is listed as follows:
Table 4.1: Comparison of complexity
Algorithm ComplexityAnt-Matching O(tmax(m(U + E) + U2 + E))Metropolis Algorithm O(cU)Hungarian Algorithm O(V 3)
In Table 4.1, we can easily find that the complexity of the MetropolisAlgorithm is the smallest. But we can’t easily compare the complexity of theant-matching algorithm with the Hungarian algorithm. To verify that if the
17
ant-matching algorithm is faster than the Hungarian algorithm or not, wewill do some experiments. Moreover, we also test if the Metropolis algorithmand the ant-matching algorithm can generate a reasonable solution for theweighted bipartite matching problem within a smaller time and discuss theirusability.
4.2 Graph Sampling Algorithm
Before the experiments, we build some graph generating algorithms to gen-erate the weighted bipartite graphs. There are two graph generating algo-rithms:
• Generating algorithm of complete bipartite graphs.
The generating algorithm is used to generate the complete weightedbipartite graph, which ∀ui ∈ U,∀vj ∈ V, ∃(ui, vj) ∈ E.
• Generating algorithm of sparse bipartite graphs.
The graph generating algorithm generate a weighted bipartite graphG = (U, V,E) randomly and each vertex ui ∈ U has at most a specifiednumber of adjacent vertices. It does not ensure that the generatedgraphs has a perfect matching.
We will use these algorithms to generate the graph samples to do theexperiments.
4.3 Results
In the experiments, we configure some variables at first. In the ant-matchingalgorithm, there are 200 iterations and 20 ants in each iteration and we makeα = 2 and β = 1 to make the relative influence of the pheromone doublesthat of the distance. In the Metropolis algorithm, we initialize 1, 000, 000, 000cycles to generate the new search states. After configuring the variables, westart the experiments, and the results are listed as follows. We will analyzethe results in different aspects:
• TimeThe cost of time in solving the weighted bipartite matching problems.
• WeightThe maximum weight found by each algorithm. We solve the maximumweighted bipartite matching problems in our experiments.
18
Size Ant-Matching Metropolis Size Ant-Matching Metropolis100x100 95.13% 60.87% 1100x1100 91.20% 52.07%200x200 94.21% 56.73% 1200x1200 91.10% 52.29%300x300 92.94% 55.75% 1300x1300 91.52% 51.98%400x400 92.93% 54.93% 1400x1400 90.96% 51.59%500x500 92.94% 53.81% 1500x1500 90.93% 51.64%600x600 92.67% 54.49% 1600x1600 90.95% 51.72%700x700 92.36% 52.79% 1700x1700 90.95% 50.92%800x800 91.66% 52.40% 1800x1800 90.75% 51.25%900x900 92.16% 52.84% 1900x1900 90.58% 51.59%1000x1000 91.73% 52.54% 2000x2000 90.62% 51.71%
Table 4.2: The weights as proportions to the weights of the optimal solutionon the complete bipartite graph.
4.3.1 Results on Complete Bipartite Graphs
We use the ant-matching algorithm, the Metropolis algorithm, and the Hun-garian algorithm to solve the maximum weighted bipartite matching prob-lems on each complete bipartite graph with different problem size. Table 4.5is the numeral result in solving the matching problems. In Table 4.5, the re-sult found by the Hungarian algorithm is optimal. Table 4.2 lists the weightsfound by the ant-matching algorithm and the Metropolis algorithm as pro-portions to the weights of the optimal solution. In Table 4.5, we can see thatthe weights found by the ant-matching algorithm are close to the weights ofthe optimal solution. In Figure 4.1, the running time of the ant-matchingalgorithm increases gradually depending on the sizes of matching problems.Even the running time of the ant-matching algorithm is larger than the run-ning time of the Hungarian algorithm, but the growth rate of running time ofthe ant-matching algorithm is smaller than the Hungarian algorithm. Thus,if the problem size is very large, the ant-matching algorithm will be fasterthan the Hungarian algorithm.
The weights found by the Metropolis algorithm are close to the half ofthe weights of the optimal solution. But the running time of the Metropolisalgorithm is very small. In practice, we can find the result with less numberof cycles in the Metropolis algorithm. The initialized 1, 000, 000, 000 cycles isused to raise the running time, it will help to draw the transitions on differentproblem sizes in Figure 4.1.
19
Figure 4.1: The running time of each algorithm on the complete bipartitegraph.
4.3.2 Results on Sparse Bipartite Graphs
In the sparse bipartite graph G = (U, V,E) which each vertex ui ∈ U has atmost 2% ∗ |V | edges, the numeral result of this matching problem is listedin Table 4.10. Table 4.3 is the result of weights found by the ant-matchingalgorithm and the Metropolis algorithm as proportions to the weights ofthe optimal solution. In Table 4.3, the weights found by the ant-matchingalgorithm are close to the weights of the optimal solution. And in Figure 4.2,the running time of the ant-matching algorithm is much less than that of theHungarian algorithm as the problem size increases. Thus, in a large scalebipartite matching problem, we can use the ant-matching algorithm to finda solution in a smaller time, and the result is close to the optimal solution.
In Table 4.3, we can see the weights found by the Metropolis algorithmare close to half of the weights of the optimal solution. In Figure 4.2, evenwe initializes 1, 000, 000, 000 cycles in the Metropolis algorithm, the runningtime is still small. Thus, if we want to find a matching in a rapid time anddon’t care the weight, we can use the Metropolis algorithm to find a solution.
20
Figure 4.2: The running time of each algorithm on the bipartite graph whereeach vertex ui ∈ U has at most 2% ∗ |V | edges.
Size Ant-Matching Metropolis Size Ant-Matching Metropolis100x100 96.81% 72.27% 100x100 95.57% 47.06%200x200 98.42% 56.44% 200x200 95.18% 47.56%300x300 98.35% 53.23% 300x300 95.53% 46.97%400x400 97.37% 50.95% 400x400 94.82% 47.81%500x500 97.31% 48.83% 500x500 95.28% 47.09%600x600 97.11% 48.83% 600x600 95.03% 47.43%700x700 96.64% 47.78% 700x700 94.58% 47.00%800x800 96.86% 48.52% 800x800 94.59% 47.25%900x900 96.09% 48.37% 900x900 94.56% 46.99%1000x1000 95.80% 48.16% 1000x1000 94.28% 47.30%
Table 4.3: The weights as proportions to the weights of the optimal solutionon the bipartite graph where each vertex ui ∈ U has at most 2% ∗ |V | edges.
21
Figure 4.3: The running time of each algorithm on the bipartite graph whereeach vertex ui ∈ U has at most 5 edges.
Here is another sparse bipartite graph G = (U, V,E) where each vertexui ∈ U has at most 5 edges, and the numeral result of this matching problemis listed in Table 4.11. Figure 4.3 is the graphic illustration of the time costsby each algorithm. We can see that the running times of the ant-matchingalgorithm and the Metropolis algorithm are still much less than the runningtimes of the Hungarian algorithm. In Table 4.4, the weights found by theant-matching algorithm are close to the optimal solutions. Thus, in a largescale and very sparse graph, we can use the ant-matching algorithm to finda matching in a smaller time and the weight of the matching is close to theweight of the optimal solution.
22
Size Ant-Matching Metropolis Size Ant-Matching Metropolis100x100 98.23% 66.07% 1100x1100 97.53% 50.51%200x200 97.75% 59.71% 1200x1200 97.17% 51.07%300x300 96.00% 56.68% 1300x1300 97.61% 51.01%400x400 96.57% 56.24% 1400x1400 97.33% 49.85%500x500 97.93% 54.29% 1500x1500 97.06% 49.63%600x600 96.74% 52.85% 1600x1600 97.38% 49.12%700x700 97.27% 52.71% 1700x1700 97.01% 49.21%800x800 97.35% 51.83% 1800x1800 97.22% 49.01%900x900 97.42% 51.61% 1900x1900 96.99% 48.63%1000x1000 96.80% 51.61% 2000x2000 97.06% 48.65%
Table 4.4: The weights as proportions to the weight of the optimal solutionon the bipartite graph where each vertex ui ∈ U has at most 5 edges.
4.3.3 Results on Ant-Matching Algorithm
In addition to the above-mentioned bipartite matching problems, we alsosolve the matching problems on different bipartite graphs in our experiments.The numeral results are listed in Tables 4.5–4.13. We will analyze the resultsand indicate the features of each algorithm.
In the ant-matching algorithm, Figure 4.4 is the graphic illustration forthe running times on each different bipartite matching problem. In Figure4.4, we can easily see that the running time of the ant-matching algorithmdepends on number of edges. The less the number of edges in the bipartitegraph, the less time the ant-matching algorithm costs on solving the matchingproblem.
Figure 4.5 illustrates the transitions of the weights on each different graphon different problem sizes. In Figure 4.5, as the problem size increases, theweights found by the ant-matching algorithm on each different graph as pro-portions to the weights of the optimal solution decrease slowly. Besides, theweights as proportions to the optimal solution are greater than 90%. Withthe advantages of the smaller running time, we can use the ant-matchingalgorithm to find a matching in a smaller time, which the weight is close tothe optimal solution.
23
Figure 4.4: The running times of the ant-matching algorithm on each differ-ent bipartite graph.
Figure 4.5: The weights found by the ant-matching algorithm as proportionsto the weights of the optimal solution on each different bipartite graph.
24
Figure 4.6: The weight found by the Metropolis algorithm as proportions tothe weights of the optimal solution on each different bipartite graph.
4.3.4 Results on Metropolis Algorithm
The running time of the Metropolis algorithm is much smaller than the othertwo algorithms. Even the cost times have slight change on different prob-lem sizes, but they are still smaller than the other two algorithms. But theweights found by the Metropolis algorithm are not as impressive. In Figure4.6, as the problem size increases, we can see that the weights found by theMetropolis algorithm as proportions to the optimal solution lie in between45% and 55%. Thus, if we don’t care the weights found by the Metropolis al-gorithm, we can use the Metropolis algorithm to solve the bipartite matchingproblem within a small time.
25
Tab
le4.
5:R
esults
onea
chal
gorith
mfo
rco
mple
tebip
ar-
tite
grap
hs.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
1242
212
7454
7893
.762
1278
459
.991
3797
598
.562
8713
820
0x20
028
328
1261
4010
9418
6.75
3371
311
2.45
1180
919
8.23
4685
930
0x30
067
969
1441
7241
2527
7.28
7194
116
6.33
6095
729
8.34
1794
940
0x40
011
9875
1986
2510
438
370.
1943
328
218.
8004
151
398.
3521
658
500x
500
1868
9128
1625
2021
946
3.15
6447
526
8.15
7171
349
8.32
2094
560
0x60
026
8281
3264
2234
484
554.
4458
956
326.
0030
6259
8.29
3561
700x
700
3630
0033
7172
6478
164
4.91
3209
436
8.58
9427
869
8.26
6603
880
0x80
047
4672
3459
2210
5953
731.
7736
169
418.
3070
854
798.
3324
054
900x
900
6024
6937
1109
1462
0482
7.94
8320
247
4.67
2823
689
8.37
4043
110
00x10
0074
2375
3768
2820
4000
915.
8608
818
524.
5644
648
998.
4223
776
1100
x11
0090
2640
3725
3130
0031
1001
.691
501
571.
8960
081
1098
.358
4512
00x12
0010
6860
941
7531
3951
2510
91.7
3615
762
6.56
6850
211
98.3
5680
213
00x13
0012
5360
938
5781
5370
3211
88.2
4128
167
4.89
3523
712
98.3
4793
414
00x14
0014
4840
640
0343
7088
9012
72.0
0647
472
1.39
6174
413
98.3
7025
415
00x15
0016
6812
539
5672
9073
7513
62.4
5832
477
3.79
7069
614
98.4
1646
916
00x16
0018
9523
439
9672
1098
031
1453
.659
121
826.
6484
5415
98.3
6725
517
00x17
0021
5092
241
9453
1424
421
1544
.753
336
864.
8778
489
1698
.379
739
1800
x18
0024
6317
240
9375
1785
843
1631
.940
541
921.
6115
056
1798
.372
2319
00x19
0026
9170
342
8485
2110
999
1719
.485
088
979.
4262
441
1898
.372
438
2000
x20
0029
7348
542
6828
2662
853
1810
.807
4510
33.3
9225
919
98.3
5114
3
26
Tab
le4.
6:R
esult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
50%∗|V|e
dge
s.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
4922
1275
3194
92.7
2780
627
60.3
6169
385
96.8
6275
204
200x
200
1932
813
1110
1047
187.
1510
867
113.
0348
6719
6.86
5259
530
0x30
043
485
1331
8839
5327
6.33
2672
516
3.41
2203
929
6.58
2848
440
0x40
077
406
1422
9788
1336
6.02
1748
921
6.40
9315
396.
7368
031
500x
500
1210
0020
2375
2017
245
6.86
3981
526
4.64
2575
149
6.74
1958
600x
600
1741
2525
7937
3410
954
9.52
7526
831
2.29
1804
859
6.68
1299
770
0x70
023
6500
2910
9356
641
641.
3882
497
366.
1369
673
696.
8035
924
800x
800
3089
2231
8203
9221
973
4.11
2888
541
7.24
3250
879
6.73
2962
590
0x90
039
0672
3456
4013
9641
818.
4287
195
467.
2815
802
896.
6588
299
1000
x10
0048
2782
3613
6019
9453
913.
0191
076
522.
0801
954
996.
9157
8311
00x11
0058
8250
3734
2131
2516
1002
.044
8656
6.10
8963
510
96.6
4038
912
00x12
0070
1359
3894
2240
3218
1098
.590
562
614.
3345
073
1196
.734
613
00x13
0082
6625
3808
7556
9453
1184
.955
507
668.
5840
256
1296
.792
552
1400
x14
0096
1250
3857
6670
7172
1273
.914
744
720.
9959
4613
96.7
6358
515
00x15
0011
0164
139
3406
9009
8513
67.0
7456
277
9.05
6539
114
96.7
1836
416
00x16
0012
5404
739
2016
1133
766
1453
.961
3681
7.48
3947
115
96.7
1902
117
00x17
0014
1400
041
0844
1365
297
1545
.651
154
863.
5369
943
1696
.774
299
1800
x18
0015
8639
141
3610
1691
687
1630
.413
165
917.
1276
354
1796
.742
078
1900
x19
0017
6645
340
4891
2063
985
1724
.556
971
974.
1730
304
1896
.714
927
2000
x20
0019
5975
042
1547
2492
984
1813
.187
7110
28.6
3545
519
96.7
6367
5
27
Tab
le4.
7:R
esult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
25%∗|V|e
dge
s.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
5875
1210
4763
91.0
8770
013
55.6
1176
776
93.1
4795
471
200x
200
1337
512
3406
640
185.
5426
607
108.
4255
932
193.
4444
159
300x
300
3153
112
5875
2494
277.
7223
822
159.
6677
912
293.
3814
713
400x
400
5606
213
9734
6453
359.
3233
843
214.
4873
6439
3.57
3760
350
0x50
087
578
1356
5614
573
454.
6455
209
256.
6291
784
493.
3040
891
600x
600
1252
3414
3218
2760
354
2.86
8112
931
2.70
9116
559
3.67
2341
870
0x70
017
0110
1755
4749
844
640.
9559
432
364.
1409
9369
3.62
9180
780
0x80
022
1953
2171
2579
956
726.
0061
843
411.
0983
714
793.
5412
079
900x
900
2799
0624
4953
1261
6882
4.97
3926
446
1.20
3447
689
3.42
4683
910
00x10
0034
4454
2715
0017
6792
914.
2384
497
509.
7117
555
993.
6410
455
1100
x11
0041
6157
2880
0024
9002
1002
.637
891
560.
4437
2410
93.3
7439
212
00x12
0049
5171
3064
6940
6296
1092
.740
705
611.
8370
349
1193
.319
361
1300
x13
0058
0250
3241
4156
7642
1188
.161
513
659.
0457
447
1293
.535
325
1400
x14
0069
0297
3305
6271
1439
1284
.472
726
716.
8991
148
1393
.315
201
1500
x15
0077
2047
3396
0989
3031
1365
.775
754
765.
3170
4914
93.5
2115
416
00x16
0087
8171
3605
6311
7493
514
59.4
6000
280
9.93
3155
915
93.2
746
1700
x17
0099
2062
3594
5313
5833
615
53.8
4162
886
5.64
4716
816
93.5
4095
1800
x18
0011
1137
536
5704
1757
088
1641
.120
297
913.
3638
176
1793
.344
5819
00x19
0012
3661
037
6813
1951
383
1727
.499
884
964.
0143
746
1893
.537
905
2000
x20
0013
7064
138
4891
2623
716
1822
.796
555
1009
.587
833
1993
.525
222
28
Tab
le4.
8:R
esult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
10%∗|V|e
dge
s.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
4859
1269
5378
81.9
8107
088
52.7
4386
7384
.895
1305
320
0x20
010
531
1262
5065
517
7.58
3311
110
3.46
2862
184.
1782
001
300x
300
2520
312
7531
2509
270.
0122
5815
2.43
3590
228
4.04
4278
140
0x40
045
078
1280
4763
1236
8.40
3189
419
8.92
4660
438
3.33
2709
750
0x50
070
110
1347
3413
108
459.
6486
038
249.
8956
0148
3.22
5838
600x
600
1007
9713
2078
2936
455
3.28
167
295.
4547
724
582.
7038
311
700x
700
1366
4113
5094
5015
664
8.52
8165
934
4.96
9619
682.
8400
679
800x
800
1775
7813
7641
8563
073
4.94
4871
395.
7375
045
782.
5284
336
900x
900
2248
7514
1422
1103
3381
3.92
1163
544
5.66
5788
788
2.89
5943
910
00x10
0027
9047
1590
0018
3946
898.
1066
518
494.
2512
265
982.
8046
155
1100
x11
0033
6750
1839
2230
1091
1001
.708
216
547.
6307
167
1082
.368
178
1200
x12
0040
1532
2038
9138
9089
1078
.901
513
592.
5325
897
1182
.699
767
1300
x13
0046
6312
2270
7955
5828
1168
.468
644
642.
0305
438
1282
.202
102
1400
x14
0053
8859
2461
7269
5479
1263
.152
943
690.
8885
926
1382
.615
354
1500
x15
0062
7906
2582
9788
8542
1356
.610
098
738.
1014
563
1482
.409
127
1600
x16
0071
7609
2921
0911
1835
714
40.8
1085
478
9.83
3652
715
82.3
2484
117
00x17
0079
6484
2853
4414
1042
415
52.5
1965
483
4.94
5819
816
82.5
6552
818
00x18
0088
9594
3201
1017
3230
616
28.8
5150
688
7.68
5158
617
82.2
0673
519
00x19
0098
9969
3341
7222
0918
717
21.1
8842
593
2.32
2166
218
82.1
3431
620
00x20
0010
9737
531
2610
2609
406
1817
.020
365
983.
5757
335
1982
.354
23
29
Tab
le4.
9:R
esult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
5%∗|V|e
dge
s.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
4766
1653
4463
72.5
5963
638
45.2
6483
225
74.3
5403
938
200x
200
1051
615
7875
953
166.
5589
723
96.9
0158
747
171.
1226
1830
0x30
024
313
1449
2237
6626
1.30
2440
513
9.07
6186
268.
4547
5940
0x40
043
203
1527
9791
4135
3.86
6419
318
4.21
1072
836
8.54
7148
250
0x50
067
344
1525
9417
594
451.
1410
476
231.
1197
816
468.
8982
772
600x
600
9646
815
3016
3446
854
2.86
2225
527
7.07
6739
356
9.05
7167
670
0x70
013
1047
1547
5061
953
638.
3631
942
328.
4142
032
667.
9605
229
800x
800
1706
5615
4547
9429
772
7.69
5069
237
3.37
8100
776
7.87
0686
190
0x90
021
5015
1679
8413
8031
820.
9100
048
424.
8350
4286
9.32
1103
510
00x10
0026
5735
1585
9320
4500
914.
2964
7246
9.80
6912
196
7.68
7227
211
00x11
0032
1593
1637
1927
6672
962.
8716
941
519.
3492
103
1068
.466
494
1200
x12
0038
1282
1617
5042
9046
1105
.298
322
567.
2015
287
1167
.502
663
1300
x13
0044
2172
1777
3454
5843
1190
.381
8862
1.70
2371
512
67.8
4560
514
00x14
0053
0797
1814
0770
9016
1241
.875
366
0.98
2468
1369
.133
415
1500
x15
0058
9953
1886
2592
7703
1343
.170
651
711.
0699
621
1467
.870
3816
00x16
0067
6547
1941
7211
4225
014
40.3
7264
777
0.59
0262
815
68.2
2760
817
00x17
0076
7094
1892
6613
8893
815
27.2
2796
808.
5954
361
1667
.407
893
1800
x18
0084
7500
1950
1515
7448
516
20.8
5849
885
5.38
6488
117
67.3
9563
719
00x19
0094
9563
2065
6220
5587
517
10.7
9986
890
8.37
5572
818
67.8
1361
920
00x20
0010
4714
121
6719
2510
532
1780
.259
9795
4.86
7843
419
67.0
5880
2
30
Tab
le4.
10:
Res
ult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
2%∗|V|e
dge
s.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
4500
1778
9063
55.1
8013
862
41.1
9267
619
57.0
0068
792
200x
200
9641
1710
4795
313
8.71
0132
279
.542
3864
214
0.93
1125
830
0x30
022
422
1660
0042
0322
4.02
9447
612
1.26
5374
227.
7981
038
400x
400
3926
616
2171
8484
320.
7804
736
167.
8679
841
329.
4465
666
500x
500
6100
016
0546
1893
841
4.58
7583
920
8.02
6716
442
6.02
9811
860
0x60
087
531
1614
6936
734
509.
6318
166
256.
2433
0352
4.80
1663
970
0x70
011
8922
1610
9458
453
604.
8175
264
298.
9940
862
625.
8276
844
800x
800
1546
7216
1297
9237
570
1.31
0001
235
1.32
063
724.
0302
865
900x
900
1952
3416
2375
1364
6979
1.28
1692
139
8.26
7256
682
3.44
6362
910
00x10
0024
0234
1668
9123
2406
883.
9602
428
444.
3647
732
922.
7610
247
1100
x11
0029
0187
1686
7228
2844
975.
0802
044
480.
1493
9510
20.2
9556
1200
x12
0034
5016
1698
4438
9687
1069
.086
453
4.25
6685
211
23.2
5550
113
00x13
0040
2484
1704
8451
9985
1167
.669
4457
4.13
9165
112
22.3
1780
514
00x14
0046
7125
1726
2570
3188
1253
.027
779
631.
8811
8913
21.5
2103
815
00x15
0053
7062
1697
1892
7734
1352
.065
866
668.
2464
149
1419
.073
406
1600
x16
0061
0609
1716
0911
4004
714
45.3
3847
972
1.35
0684
115
20.9
5315
517
00x17
0069
1313
1753
4414
8257
815
32.5
6083
976
1.55
5357
216
20.4
5389
818
00x18
0077
2937
1761
8817
0409
416
27.4
2030
481
2.94
1664
117
20.4
6442
919
00x19
0085
7343
1800
4720
5701
617
20.9
4202
685
5.19
3381
218
19.9
6171
320
00x20
0095
5719
1723
1224
6809
418
09.9
0783
790
8.01
1921
719
19.6
5387
31
Tab
le4.
11:
Res
ult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
5ed
ges.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
2610
1441
2578
71.0
1632
804
47.7
6754
179
72.2
9785
256
200x
200
9547
1479
5410
7814
4.32
6146
788
.160
6114
147.
6499
849
300x
300
2071
914
2969
3625
209.
4333
408
123.
6406
937
218.
1550
131
400x
400
3610
914
5453
9172
274.
9515
693
160.
1249
942
284.
7093
798
500x
500
5578
214
5828
1889
035
3.15
5080
619
5.75
8127
136
0.60
9790
860
0x60
080
657
1469
2236
235
418.
2425
001
228.
5038
435
432.
3359
955
700x
700
1092
5015
5937
6348
449
1.71
2577
326
6.47
9316
350
5.53
7890
680
0x80
014
1719
1499
6899
828
566.
7097
6730
1.73
2119
658
2.12
9979
900x
900
1769
5315
1015
1553
2864
2.08
9699
334
0.17
7652
865
9.11
0808
510
00x10
0021
9563
1503
4422
7000
705.
2530
634
376.
0164
821
728.
5519
891
1100
x11
0027
0328
1538
5932
5188
782.
8807
543
405.
4215
758
802.
6950
651
1200
x12
0032
1468
1505
7846
8969
836.
8582
344
439.
8375
131
861.
2299
184
1300
x13
0037
9110
1525
4758
1547
919.
6835
791
480.
6155
806
942.
1875
666
1400
x14
0044
0797
1530
1671
4781
991.
7097
025
507.
9210
4310
18.9
5962
1500
x15
0050
7610
1517
0394
5812
1058
.513
904
541.
3211
637
1090
.621
186
1600
x16
0057
9688
1527
6611
8665
611
27.4
5140
156
8.69
1967
1157
.792
919
1700
x17
0065
3219
1559
5415
8126
611
91.9
1572
160
4.58
5513
512
28.6
7696
718
00x18
0072
6531
1534
0718
5415
612
70.5
7783
264
0.53
8688
613
06.9
4436
619
00x19
0080
3360
1546
0922
9723
413
40.3
5130
667
2.03
5546
513
81.9
8123
2000
x20
0088
3531
1549
3827
7382
814
14.7
3028
709.
1355
942
1457
.643
701
32
Tab
le4.
12:
Res
ult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
10ed
ges.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
2906
1362
0378
83.4
4144
831
52.7
4386
7384
.895
1305
320
0x20
010
110
1388
2810
3116
6.08
0900
594
.969
6199
416
8.62
7658
430
0x30
021
907
1343
2933
9024
9.85
2134
913
6.84
3487
225
5.06
1219
840
0x40
038
250
1358
7590
0033
1.81
2769
318
0.87
7369
734
0.69
7786
550
0x50
058
516
1375
3118
329
412.
3106
6121
8.24
1374
642
4.53
8064
460
0x60
082
735
1386
7233
031
498.
8163
551
256.
5263
599
508.
9098
678
700x
700
1124
3713
9640
5545
357
3.20
1359
229
5.60
8140
759
2.91
7256
680
0x80
014
5750
1393
5990
516
661.
1020
851
337.
5970
951
678.
5129
0890
0x90
018
3062
1395
4712
9547
745.
2667
431
381.
3007
525
766.
6953
569
1000
x10
0022
6360
1399
0619
2563
824.
9628
987
410.
9344
0885
0.36
0086
1100
x11
0027
7265
1414
6927
9922
905.
3093
731
448.
8447
992
932.
8235
5212
00x12
0033
0922
1409
2235
8219
984.
2998
233
488.
0119
238
1015
.005
472
1300
x13
0038
4031
1416
5647
3188
1067
.979
441
532.
2819
5911
00.9
3529
1400
x14
0044
5844
1422
0365
7140
1148
.890
971
567.
5875
857
1185
.088
969
1500
x15
0051
0875
1428
2886
0047
1231
.703
836
614.
0386
2412
69.0
6846
716
00x16
0057
6782
1437
9710
5696
813
08.3
388
641.
7723
808
1350
.805
353
1700
x17
0064
8484
1526
2513
8350
013
80.1
1882
167
9.10
0884
114
30.6
6642
818
00x18
0072
6531
1610
4716
8826
614
68.2
9940
671
8.42
2965
915
18.5
5681
319
00x19
0073
1750
1550
4720
0012
515
53.8
7212
376
0.14
8536
916
05.3
8131
820
00x20
0079
9125
1562
6623
8110
916
28.2
8393
979
6.71
1340
116
87.4
1599
2
33
Tab
le4.
13:
Res
ult
son
each
algo
rith
mfo
rth
ebip
artite
grap
hs
wher
eea
chve
rtex
has
atm
ost
20ed
ges.
Tim
e(m
s)W
eigh
tSiz
eA
nt
Met
ropol
isH
unga
rian
Ant
Met
ropol
isH
unga
rian
100x
100
3344
1327
0393
88.9
9404
4555
.415
9606
691
.473
1706
520
0x20
011
078
1345
3111
2517
7.50
1070
610
3.46
2862
184.
1782
001
300x
300
2345
312
9156
3703
268.
6427
545
147.
1410
087
275.
9809
938
400x
400
4040
613
0719
9844
357.
4541
1519
6.09
4746
536
8.38
6148
950
0x50
061
750
1337
9719
610
442.
6658
518
234.
5835
032
459.
3350
209
600x
600
8698
513
6078
3273
452
8.64
6773
227
6.50
8276
955
1.40
3598
670
0x70
011
7078
1328
2859
937
617.
6368
435
319.
0734
327
642.
3899
665
800x
800
1510
3113
3563
9211
070
3.52
2271
436
1.94
6939
973
4.85
6971
390
0x90
018
9203
1338
7514
9500
796.
7183
423
405.
7479
686
827.
3289
196
1000
x10
0023
1671
1352
9620
3485
883.
5310
944
4.44
9194
791
8.72
2924
511
00x11
0028
1328
1367
9628
9250
974.
4097
692
488.
6040
136
1013
.999
974
1200
x12
0033
4265
1394
3839
7609
1055
.555
762
535.
0272
726
1104
.694
687
1300
x13
0039
2110
1390
6355
1984
1149
.346
358
577.
1818
476
1197
.436
389
1400
x14
0045
4032
1399
8465
2531
1232
.319
395
613.
9420
703
1285
.780
484
1500
x15
0052
0484
1426
5787
6735
1324
.146
313
653.
2243
0813
78.5
8299
316
00x16
0058
9375
1397
0411
0184
414
07.4
3937
868
9.68
4826
414
69.7
4472
817
00x17
0066
2219
1408
4413
4882
814
94.9
5388
973
6.84
7802
515
60.6
4509
118
00x18
0074
0328
1412
8215
5965
615
85.7
1184
478
2.90
3499
116
54.7
4217
319
00x19
0082
2156
1417
0320
1576
616
61.6
1008
181
4.08
8682
917
45.0
1535
120
00x20
0090
8079
1436
7223
3507
817
54.3
5467
586
1.03
6132
1836
.726
347
34
Chapter 5
Conclusions
This thesis presents two methods for the maximum and minimum weightedbipartite matching problems. In the ant-matching algorithm, we can find amatching which the weight is close to the optimal solution. And if in a largescale weighted bipartite matching problem, using the ant-matching algorithmto find a matching will be faster than using the Hungarian algorithm. In theMetropolis algorithm, we can use the algorithm to find a matching in a veryshort time, but the weight of the matching as proportions to the optimalsolution is not good. If we want to find a matching in a large weightedbipartite graph within a rapid time, the Metropolis algorithm is the bestchoice.
Besides, with the property of the ant colony optimization algorithm whichthe pheromone on the path changes gradually, the ant-matching algorithmwill be useful in solving the dynamic weighted bipartite matching problemswhere the vertices and edges in the bipartite graph change with the time. Inthe Metropolis algorithm, in each iteration the algorithm randomly choosesan edge as a matching edge or not. It will not be influenced by the change ofthe bipartite graph. Thus, it is applicable on solving the dynamic weightedmatching problems.
35
Bibliography
[1] S. Chib and E. Greenberg. (1995) Understanding the Metropolis-Hasting Algorithm. The American Statistician, Vol. 49, No. 4 (Novem-ber 1995), pp. 327–335.
[2] J. Munkres. (1957) Algorithms for the Assignment and Transporta-tion Problems. Journal of the Society of Industrial and Applied Math-ematics, Vol. 5, No. 1 (March 1957), pp. 32–38.
[3] Y. Nakamichi and T. Arita. (2001) Diversity Control in AntColony Optimization. Proceedings of the Inaugural Workshop on Arti-ficial Life (AL’01), pp. 70–78, Adelaide, Australia, December 2001.
[4] T. Stutzle, M. Dorigo. (1999) ACO Algorithms for the Travel-ing Salesman Problem. In K. Miettinen, M. Makela, P. Neittaanmaki,and J. Periaux, editors, Evolutionary Algorithms in Engineering andComputer Science. Wiley, 1999.
[5] I, Wegener. (2005) Simulated Annealing Beats Metropolis in Com-binatorial Optimization. ICALP 2005. LNCS 3580, pp. 589–601.
36