## Two Algorithms for Maximum and Minimum Weighted

## Bipartite Matching

### Advisor: Prof. Yuh-Dauh Lyuu Hung-Pin Shih

### Department of Computer Science and Information Engineering

### National Taiwan University

Abstract

This thesis applies two algorithms to the maximum and minimum weighted bipartite matching problems. In such matching problems, the maximization and minimization problems are essentially same in that one can be trans- formed into the other by replacing the weight on each edge with an inverse of the weight. Depending on the algorithms we used, we will choose the maxi- mization or minimization problems for illustrations. We apply the ant colony optimization (ACO) algorithm on a minimum weighted bipartite matching problem by transforming the problem to a traveling salesman problem (TSP).

It may seem that makes the problem more complicated, but in reality it does not. We call this algorithm “ant-matching,” which can solve any weighted bipartite matching problems with or without a perfect matching. Besides, we also apply the Metropolis algorithm to solve the maximum weighted bipartite matching problem. To analyze the performance on these two algorithms, we compare the algorithms with the exact Hungarian algorithm, a well-known combinatorial optimization method for solving the weighted bipartite match- ing problem.

Keywords: Metropolis algorithm, Ant colony optimization, Maximum weighted bipartite matching, Minimum weighted bipartite matching

## Contents

1 Introduction 4

2 Preliminaries 5

2.1 Maximum/Minimum Weighted Bipartite Matching . . . 5

2.1.1 Weighted Bipartite Graph . . . 5

2.1.2 Maximum/Minimum Weighted Bipartite Matching . . 5

2.2 Ant Colony Optimization . . . 6

2.3 Metropolis Algorithm . . . 7

3 Maximum/Minimum Weighted Bipartite Matching Prob- lems 9 3.1 ACO Algorithm for Minimum-Weighted Bipartite Matching . 9 3.1.1 Transforming Minimum-Weighted Bipartite Matching to 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 . . . 13

3.2 Metropolis Algorithm for Maximum-Weighted Bipartite Matching . . . 13

3.2.1 The Complexity of Metropolis Algorithm . . . 15

4 Experimental Results 17 4.1 Comparison of Complexity . . . 17

4.2 Graph Sampling Algorithm . . . 18

4.3 Results . . . 18

4.3.1 Results on Complete Bipartite Graphs . . . 19

4.3.2 Results on Sparse Bipartite Graphs . . . 20

4.3.3 Results on Ant-Matching Algorithm . . . 23

4.3.4 Results on Metropolis Algorithm . . . 25

5 Conclusions 35

## List of Figures

3.1 Transforming a bipartite matching problem to a TSP: (1) The
original bipartite graph G. (2) Add u^{0}_{1} and its corresponding
edges. (3) The final graph G^{0}. . . 10
4.1 The running time of each algorithm on the complete bipartite

graph. . . 20 4.2 The running time of each algorithm on the bipartite graph

where each vertex ui ∈ U has at most 2% ∗ |V | edges. . . 21 4.3 The running time of each algorithm on the bipartite graph

where each vertex u_{i} ∈ 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 different bipartite graph. . . 24 4.6 The weight found by the Metropolis algorithm as proportions

to the weights of the optimal solution on each different bipar- tite graph. . . 25

## List of Tables

4.1 Comparison of complexity . . . 17 4.2 The weights as proportions to the weights of the optimal so-

lution on the complete bipartite graph. . . 19 4.3 The weights as proportions to the weights of the optimal so-

lution on the bipartite graph where each vertex u_{i} ∈ U has at
most 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 u_{i} ∈ U has at
most 5 edges. . . 23
4.5 Results on each algorithm for complete bipartite graphs. . . . 26
4.6 Results on each algorithm for the bipartite graphs where each

vertex has at most 50% ∗ |V | edges. . . 27 4.7 Results on each algorithm for the bipartite graphs where each

vertex has at most 25% ∗ |V | edges. . . 28 4.8 Results on each algorithm for the bipartite graphs where each

vertex has at most 10% ∗ |V | edges. . . 29 4.9 Results on each algorithm for the bipartite graphs where each

vertex has at most 5% ∗ |V | edges. . . 30 4.10 Results on each algorithm for the bipartite graphs where each

vertex has at most 2% ∗ |V | edges. . . 31 4.11 Results on each algorithm for the bipartite graphs where each

vertex has at most 5 edges. . . 32 4.12 Results on each algorithm for the bipartite graphs where each

vertex has at most 10 edges. . . 33 4.13 Results on each algorithm for the bipartite graphs where each

vertex has at most 20 edges. . . 34

## Chapter 1 Introduction

The maximum/minimum weighted bipartite matching problem is a combina- torial optimization problem, and there exist many optimization algorithms to solve the matching problem. But here we try some heuristic or sam- pling methods and expect them to generate reasonable sub-optimal solutions within reasonable time bounds. Specifically we use the ant colony opti- mization (ACO) and the Metropolis algorithm. In the ACO algorithm, we transform this matching problem to a traveling salesman problem (TSP) and use the concepts of ACO algorithm as a basis for a new method to solve the matching problem. We call the new method “ant-matching.” In the Metropolis algorithm, we randomly select a matching edge in each iteration to generate an approximate solution. Then we compare the performances of these two algorithms with the exact Hungarian algorithm [2], which is a optimization algorithm used to solve the weighted matching problems.

The structure of this thesis is organized as follows: In Chapter 1 and Chapter 2, we define the problem of maximum/minimum weighted bipar- tite matching and introduce the background of the two above-mentioned algorithms. In Chapter 3, we transform the weighted bipartite matching problem to a traveling salesman problem (TSP) and apply the concepts of ant colony optimization (ACO) algorithm as a basis for a new matching al- gorithm called “ant-matching.” In the latter part of Chapter 3, we apply the Metropolis algorithm to solve the maximum weighted bipartite matching problem. Finally, Chapter 4 compares these algorithms with other methods in solving the weighted matching problems, and we conclude in Chapter 5.

## 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 divided
into two disjoint sets U and V such that each edge (u_{i}, v_{j}) ∈ E connects a
vertex u_{i} ∈ U and one v_{j} ∈ V . If each edge in graph G has an associated
weight w_{ij}, the graph G is called a weighted bipartite graph.

### 2.1.2 Maximum/Minimum Weighted Bipartite Matching

In a bipartite graph G = (U, V, E), a matching M of graph G is a subset of E such that no two edges in M share a common vertex. If the graph G is a weighted bipartite graph, the maximum/minimum weighted bipartite matching is a matching whose sum of the weights of the edges is maxi- mum/minimum. The maximum/minimum weighted bipartite matching can be formulated as follows:

max / min X

(ui,vj)∈E

w_{ij}x_{ij}

|U |

X

i=1

x_{ij} = 1, ∀j = 1, ..., |V |

|V |

X

j=1

xij = 1, ∀i = 1, ..., |U |

x_{ij} ∈ {0, 1}

where x_{ij} is 1 denotes edge (u_{i}, v_{j}) is an edge in the maximum/minimum
weighted 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 ants find foods, they will go back to its nest. If some other ants encounter the path, they will follow it based on the density of pheromone deposited. The pheromone 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 more time the pheromone has to evaporate. On a shorter path, an ant travels down the path and back faster, and the pheromone density remains high as the pheromone is laid on as fast as it can evaporate. Assume the ant colony converges to a path. If a shorter path is found by some ants, because the 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 pheromone on the shorter path will increase gradually and the density on the original path will decrease. After a period of time, the ant colony will converge to the shorter path. It will prevent the ant colony from converging to a local optimal solution.

The ant colony optimization (ACO) algorithm comes from observing the behavior of the ants. It simulates the ants and the pheromone evaporation on the paths. In each iteration, the ants select the paths according to the density of pheromone deposited. If the path has higher density, it will be selected with higher probability. After finding a path, the ants lay down pheromone on the path. In the ACO algorithm, each path represents a solution. Besides, the pheromone evaporates gradually. The ACO algorithm is illustrated in Algorithm 1.

Algorithm 1 ACO Algorithm for TSP while termination condition not met do

generate solutions pheromone update end while

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, there
are n cities. Each city has to be visited exactly once, and the tour ends
at the starting city. The problem is to find a shortest tour to visit these n
cities. Let d_{ij} be the distance between the city i and the city j and τ_{ij} be
the 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 heuristic
function η_{ij}. The probability of choosing the next city j from current city i
at the tth iteration is

p^{k}_{ij} = [τ_{ij}(t)]^{α}(η_{ij})^{β}
P

l∈N_{l}^{k}[τ_{il}(t)]^{α}(η_{ij})^{β} , ∀j ∈ N_{i}^{k} (2.1)
where ηij = _{d}^{1}

ij is a commonly used heuristic function, α and β are two
parameters to determine the relative influences of the pheromone and the
distance, and N_{i}^{k} 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

X

k=1

∆τ_{ij}^{k}(t) (2.2)

where 0 < ρ ≤ 1 is the pheromone evaporation rate, ∆τ_{ij}^{k}(t) is the pheromone
that the kth ant deposited at the tth iteration, which is defined as follows:

∆τ_{ij}^{k}(t) = 1/L^{k}(t) if(i, j) ∈ T^{k}(t)

0 if(i, j) /∈ T^{k}(t) (2.3)

where L^{k}(t) is the length of the kth ant’s tour at the tth iteration, T^{k}(t) is the
kth ant’s tour at the tth iteration. The shorter the tour the ants found, the
more pheromone is deposited. After a number of iterations, the ant colony
will converge to a nearly shortest tour. Finally, select any starting city and
follow the edge with the highest density of pheromone to visit as the next
city. 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 samples from a probability distribution that is hard to sample directly. It uses the Markov chain Monte Carlo simulation to approximate the distribution [1].

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 Markov
chain in which each state x^{t+1} depends only on the previous state x^{t}. Let
Q(x^{t}, x^{0}) denotes the candidate-generating density, where R Q(x^{t}, x^{0})dx^{0} = 1.

The algorithm depends on the current state x^{t} to generate a new sample x^{0}
from Q(x^{t}, ·)^{1}. The sample x^{0} is accepted as the next state x^{t+1}if α ∈ U (0, 1)
satisfies Eq. (2.4):

α < P (x^{0})Q(x^{0}, x^{t})

P (x^{t})Q(x^{t}, x^{0}) (2.4)

If α satisfies Eq. (2.4), x^{t+1} = x^{0}. Otherwise, the current state x^{t} is retained,
i.e., x^{t+1} = x^{t}. The algorithm is illustrated in Algorithm 2.

Algorithm 2 Metropolis Algorithm for t = 1, 2, ..., N do

sample x^{0} from Q(x^{t}, ·) and α from U (0, 1) {U (0, 1) is the uniform dis-
tribution on(0, 1)}

if α < ^{P (x}_{P (x}^{0}t^{)Q(x})Q(x^{0}^{t}^{,x},x^{t}^{0}^{)}) then
x^{t+1} = x^{0}

else

x^{t+1} = x^{t}
end if
end for

return {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 between the current state and the next state to find a possible Q. The possible Q may be correct or wrong, but it will describe the transitions. This is reasonable, if we don’t know the probability distribution P (x), we observe the transitions between the current state and the next state and infer a possible Q. We can use Q to sample the other next states and find the unknown probability distribution P (x).

## Chapter 3

## Maximum/Minimum Weighted Bipartite Matching Problems

In a weighted bipartite graph G = (U, V, E), we want to find a maxi- mum/minimum weighted bipartite matching (maximum/minimum-weighted BM) whose sum of the weights of the edges is maximum/minimum. To solve this matching problem, we present two methods. For illustrations, we will introduce each method on a different matching problem. Specifically we ap- ply the ACO algorithm to solve the minimum-weighted BM problems and the 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 matching whose sum of the weights of the edges is minimum. Here we apply the concepts of ACO algorithm as a basis for a new method to solve the matching problem. First, we transform the matching problem to a TSP problem. It may seem that makes the matching problem more complicated, but in reality it does not. Second, we apply the ACO algorithm on the TSP problem and perform some simplifications to be explained later on solving the TSP problem. The result is a new method for solving the minimum-weighted BM problem. In this chapter, the TSP refers to the problem of finding a minimum weighted complete tour on the complete graph with multiple edges between vertices, and the number of edges between vertices will change as the different tour selection.

Figure 3.1: Transforming a bipartite matching problem to a TSP: (1) The
original bipartite graph G. (2) Add u^{0}_{1} and its corresponding edges. (3) The
final graph G^{0}.

### 3.1.1 Transforming Minimum-Weighted Bipartite Matching to Traveling Salesman Problem

In a weighted bipartite graph G = (U, V, E), we choose either U or V as the base vertices and transform the minimum-weighted BM problem to a TSP problem. We choose the vertices set U as our base vertices for illustrations.

First, for each u_{i} ∈ U , we create a corresponding virtual vertex u^{0}_{i} ∈ U^{0},
where U^{0} is the set of vertices correspond to U and |U^{0}| = |U |. Then, for
each (u_{i}, v_{j}) ∈ E where u_{i} ∈ U, v_{j} ∈ V , we create a corresponding back edge
(u^{0}_{i}, v_{j}) ∈ E^{0} with an associated weight 0, where E^{0} contains the edges we
create. Furthermore, we create another back edge (u_{i}, u^{0}_{i}) ∈ E^{0} with a large
associated weight w_{max}. Here we define this large associated weight w_{max} as
20 ∗ maxi∈|U |,j∈|V |w_{ij}. Finally, for each virtual vertex u^{0}_{i} ∈ U^{0}, we create the
edges (u^{0}_{i}, u_{k}) ∈ E^{0} to connect each vertex u_{k} ∈ U, u_{k}6= u_{i}, with an associated
weight w_{ik} = 0. Thus, we have a new graph G^{0} = (U, V, E, U^{0}, E^{0}). The above
steps are illustrated in Algorithm 3 and Figure 3.1. In Figure 3.1, each back
edge (u^{0}_{i}, v_{j}) ∈ E^{0} is in green and (u_{i}, u^{0}_{i}) ∈ E^{0} is in red. Besides, the edges
(u^{0}_{i}, u_{k}) connect each vertex u^{0}_{i} to all the other vertices in U are in grey.

In the new graph G^{0} = (U, V, E, U^{0}, E^{0}), on each base vertex u_{i} ∈ U , we
define that if we choose the edge (u_{i}, v_{j}) ∈ E, then we will follow the edge
(v_{j}, u^{0}_{i}) ∈ E^{0} back to vertex u^{0}_{i} ∈ U^{0}. Thus, for each base vertex u_{i} ∈ U , there
are some paths u_{i}− v_{j}− u^{0}_{i} where (u_{i}, v_{j}) ∈ E and (v_{j}, u^{0}_{i}) ∈ E^{0}, and the path

Algorithm 3 Transform Graph G to G^{0}

Input: Weighted bipartite graph G = (U, V, E)
and each edge (u_{i}, v_{j}) ∈ E has a weight w_{ij}.
E^{0} = ∅

for ui ∈ U do

create vertex u^{0}_{i} ∈ U^{0}
for (u_{i}, v_{j}) ∈ E do

add back edge (u^{0}_{i}, vj) to E^{0} with weight 0
end for

add back edge (u_{i}, u^{0}_{i}) to E^{0} with weight w_{max}
for uk∈ U do

add edge (u^{0}_{i}, u_{k}) to E^{0} with weight 0
end for

end for

return graph G^{0} = {U, V, E, U^{0}, E^{0}}

u_{i}− u^{0}_{i} where (u_{i}, u^{0}_{i}) ∈ E^{0}. So there exist a edge from u_{i} to its corresponding
virtual vertex u^{0}_{i} ∈ U^{0}. Furthermore, each virtual vertex u^{0}_{i} is connected to
all the other base vertices u_{k} ∈ U . Thus, if we start from any base vertex
u_{i} ∈ U on the graph G^{0}, we can visit each base vertex in U exactly once and
end at u_{i} (a Hamiltonian cycle). If we want to find a matching M in the
bipartite graph G, we can find it with a Hamiltonian cycle in the graph G^{0}
as follows.

Let Avail_{i}(V ) ⊆ V be the vertex set adjacent to the vertex u_{i} ∈ U such
that for each vertex v_{j} ∈ Avail_{i}(V ), each edge (u_{l}, v_{j}) ∈ E is not yet an
matching edge in the matching M . On each vertex u_{i} ∈ U , the ant may
select^{12} the edge (u_{i}, v_{j}) ∈ E followed by (v_{j}, u^{0}_{i}) ∈ E^{0} where v_{j} ∈ Avail_{i}(V ),
or select the edge (u_{i}, u^{0}_{i}) ∈ E^{0}. If the ant select the edge (u_{i}, v_{j}) ∈ E followed
by (v_{j}, u^{0}_{i}) ∈ E^{0}, we add a new matching edge (u_{i}, v_{j}) to M . If the ant select
the edge (u_{i}, u^{0}_{i}) ∈ E^{0}, we do not change M . After visiting all the base vertex
u_{i} ∈ U exactly once, we will find the matching M .

1Lyuu: what do you mean by select? what if both are possible, which one do you select?

Hung-Pin: We choose edge based on the pheromone. It will be explained later. Here we just 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^{0}_{i}, the different selection has different means in the matching M . I
use the ”select” to explain the differences and the relations between the matching problem
and the TSP problem.

Thus, if we find a tour to visit each base vertex u_{i} ∈ U exactly once
and then return to the starting base vertex, and the total weight of this
tour is minimum, we have a minimum weighted bipartite matching M on
the weighted bipartite graph G. Now, we have successfully transformed the
minimum-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 new
graph G^{0} = (U, V, E, U^{0}, E^{0}), we can use the ACO algorithm to solve the
TSP problem on G^{0} 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^{0}, the algorithm needs to visit all vertices in the set U and
corresponding set U^{0} of U to do matching. With the simplification, because
we define that if the ant select the base vertex u_{i} ∈ U , then the ant will follow
the paths u_{i} − v_{j} − u^{0}_{i} or the path u_{i} − u^{0}_{i} back to the vertex u^{0}_{i}, we can see
U and U^{0} same because if the algorithm visits the base vertex u_{i} ∈ U , it will
visit its corresponding virtual vertex u^{0}_{i} ∈ U^{0} next.^{3} Therefore, the algorithm
can just visit each u_{i} ∈ U and select a matching edge (u_{i}, v_{j}) ∈ E. It will
help this method more efficient and applicable for the minimum-weighted
BM problems. We call this new method “ant-matching.”

In the ACO algorithm, the ants choose the next vertex independently based their decision on the density of pheromone and a heuristic function.

In the ant-matching algorithm, the ants choose the next vertex based on the
same mechanisms. In each iteration t, the ants choose the next base vertex
u_{i} ∈ Avail^{k}(U )(t) based on the density of pheromone τ_{p(i)i}(t) as Eq. (3.1),
where Avail^{k}(U )(t) is the set of available base vertices that the kth ant has
yet to visit at the tth iteration and u_{p(i)} ∈ U is the predecessor of the vertex
u_{i}. Let N_{i}^{k}(t) ⊆ V be the set of the kth ant’s available adjacent vertices of
u_{i} at the tth iteration. If |N_{i}^{k}(t)| > 0, each of the m ants chooses one vertex
v_{j} ∈ N_{i}^{k}(t) to do matching based on the density of pheromone τ_{ij}(t) and
a heuristic function η_{ij}(t) as Eq. (2.1), then adds the weight w_{ij} to L^{k}(t),
where L^{k}(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 be true, but it may not be true for a general TSP solver. you need to say YOUR TSP solver will impose this condition

Hung-Pin: I add a sentence before this sentence to explain the condition. Besides, at the end of the section 3.1, I redefine the TSP problem in the transformation. It is not a general TSP. It likes a related TSP problem which generalized TSP deals with ”states”.

Thus, I redefine the TSP problem.

ant does nothing but adds a large associated weight w_{max} to L^{k}(t). After
each of m ants visiting all the vertices in the set U , update the pheromone
on each edge and start the next iteration. The pheromone deposited on each
edge (u_{i}, u_{k}) ∈ E^{0} represents an order relation such that if one ant chooses
the vertex u_{i}, it will choose the vertex u_{k} next time. And a large amount of
pheromone on the edge (u_{i}, v_{j}) represents that the edge (u_{i}, v_{j}) is a preferred
matching edge. Thus, we have the order relations to do matching on the
vertex set U and the preferred matching edges on each vertex u_{i} ∈ U . We
can find the solutions of the matching problems according to the density of
pheromone. The algorithm is listed in Algorithm 4, and Algorithm 5 is the
detail.

p^{k}_{p(i)i} = [τ_{p(i)i}(t)]^{α}
P

l∈Avail^{k}(U )(t)[τ_{p(i)l}(t)]^{α} ∀i ∈ Avail^{k}(U )(t) (3.1)
Algorithm 4 Ant-Matching Algorithm

for t = 1 to t_{max} do

for k = 1 to NumberOfAnts do

choose u_{i} ∈ Avail^{k}(U )(t) based on τ_{p(i)i}(t)

choose vertex v_{j} ∈ N_{i}^{k}(t) based on τ_{ij}(t) and η_{ij}(t)
end for

update pheromone end for

### 3.1.3 The Complexity of Ant-Matching Algorithm

In the ant-matching algorithm, each ant visits each vertex u_{i} in the vertex
set U and searchs each edge adjacent to u_{i} exactly once. Thus, generating
a solution costs O(U + E). Moreover, it costs O(U^{2} + E) to update the
density of pheromone on each edge (u_{i}, u_{k}) where u_{i}, u_{k} ∈ U and on each edge
(u_{i}, v_{j}) ∈ E. If there are m ants and t_{max}iterations. The total complexity of
the ant-matching algorithm is O(t_{max}(m(U + E) + U^{2}+ 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 or V arbitrarily to do matching. We choose the vertex set U for illustrations. We

Algorithm 5 Ant-Matching Algorithm in Detail Input: Weighted bipartite graph G = (U, V, E)

and each edge (u_{i}, v_{j}) ∈ E has a weight w_{ij}.
MatchingList_{Best}= []

Weight_{min} = ∞
for t = 1 to t_{max} do

{Generate Solution}

for k = 1 to NumberOfAnts do
Avail^{k}(U )(t) = U ;

MatchingList_{k}(t) = []

Weight_{k}(t) = 0

while |Avail^{k}(U )(t)| > 0 do

choose available u_{i} ∈ Avail^{k}(U )(t) based on τ_{ij}(t)
remove u_{i} in Avail^{k}(U )(t)

if u_{i} has available adjacent vertices N_{i}^{k}(t) ⊆ V then
choose vj ∈ N_{i}^{k}(t) based on τij(t) and ηij

add (u_{i}, v_{j}) into MatchingList_{k}(t)
Weight_{k}(t) = Weight_{k}(t) + w_{ij}
else

add (ui, φ) into MatchingList_{k}(t)
Weight_{k}(t) = Weight_{k}(t) + w_{max}
end if

end while

if Weight_{k}(t) ≤ Weight_{min}(t) then
MatchingList_{Best} = MatchingList_{k}(t)
end if

end for

{Update pheromone}

for k = 1 to NumberOfAnts do

for l = 1 to |MatchingList_{k}(t)| and (x_{l}, y_{l}) ∈ MatchingList_{k}(t) do

∆τ_{x}^{k}

l−1,xl(t) = 1/Weight_{k}(t)
if y_{l}6= φ then

∆τ_{x}^{k}

l,yl(t) = 1/Weight_{k}(t)
else

∆τ_{x}^{k}

l,xl(t) = 1/Weight_{k}(t)
end if

end for end for

for (ui, vj) ∈ E do

τ_{ij}(t + 1) = (1 − ρ)τ_{ij}(t) +Pm

k=1∆τ_{ij}^{k}(t)
end for

for u_{i}, u_{j} ∈ U, u_{i} 6= u_{j} do

τij(t + 1) = (1 − ρ)τij(t) +Pm

k=1∆τ_{ij}^{k}(t)
end for

t = t + 1;

end for

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 (u_{i}, v_{j}), where x_{ij} = 1 denotes a
matching edge, x_{ij} = 0 denotes not.

In each iteration, choose (u_{i}, v_{j}) ∈ E at random and flip x_{ij}. Thus, in
the current state x, choose a new search state x^{0} = {x^{0}_{00}, ..., x^{0}_{|U ||V |}} where
x^{0}_{ij} = 1 − x_{ij}, and x^{0}_{gh} = x_{gh}, if the edges (u_{g}, v_{h}) 6= (u_{i}, v_{j}).

After choosing a new state x^{0}, using a fitness function f to decide if we
choose the new search state x^{0} as the next state. If f (x^{0}) ≥ f (x), select x^{0}. If
f (x^{0}) < f (x), select x^{0} with the probability ef (x0)−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 (u_{i}, v_{j}) ∈ E has a weight w_{ij}.
loop

choose (u_{i}, v_{j}) ∈ E at random and flip x_{ij}
sample α from U (0, 1)

if f (x^{0}) ≥ f (x) then
select x^{0}

else

if α ≤ ef (x0)−f (x)

K then

select x^{0}
end if
end if
end loop

Here we choose 0^{m} as the starting state x for the maximization prob-
lems and choose a fitness function f , where f (x) = 0 for the state x
which there exist two edges in the matching sharing a common vertex, and
f (x) =P

ui∈U,vj∈V x_{ij}w_{ij} 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. To
generate a new search state we choose a edge (u_{i}, v_{j}) ∈ E at random and flip
x_{ij}. It will cost O(1) to generate a new search state. Then, it costs O(1) to
calculate the weight of the new search state and costs O(1) to verify if the

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, if there are c iterations, the complexity of the Metropolis algorithm is O(cU ).

## 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 solving
the weighted bipartite matching problems. In a weighted bipartite graph
G = (U, V, E) and each edge (u_{i}, v_{j}) ∈ E has an associated weight w_{ij}.
We replace each edge weight w_{ij} with _{w}^{1}

ij to 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 minimum weighted bipartite matching problem.

### 4.1 Comparison of Complexity

Before the experiments, we compare the complexity first. The complexity of each algorithm is listed as follows:

Table 4.1: Comparison of complexity

Algorithm Complexity

Ant-Matching O(t_{max}(m(U + E) + U^{2}+ E))

Metropolis Algorithm O(cU )
Hungarian Algorithm O(V^{3})

In Table 4.1, we can easily find that the complexity of the Metropolis Algorithm is the smallest. But we can’t easily compare the complexity of the ant-matching algorithm with the Hungarian algorithm. To verify that if the

ant-matching algorithm is faster than the Hungarian algorithm or not, we will do some experiments. Moreover, we also test if the Metropolis algorithm and the ant-matching algorithm can generate a reasonable solution for the weighted bipartite matching problem within a smaller time and discuss their usability.

### 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 weighted
bipartite graph, which ∀u_{i} ∈ U, ∀v_{j} ∈ V, ∃(u_{i}, v_{j}) ∈ E.

• Generating algorithm of sparse bipartite graphs.

The graph generating algorithm generate a weighted bipartite graph
G = (U, V, E) randomly and each vertex u_{i} ∈ U has at most a specified
number of adjacent vertices. It does not ensure that the generated
graphs has a perfect matching.

We will use these algorithms to generate the graph samples to do the experiments.

### 4.3 Results

In the experiments, we configure some variables at first. In the ant-matching algorithm, there are 200 iterations and 20 ants in each iteration and we make α = 2 and β = 1 to make the relative influence of the pheromone doubles that of the distance. In the Metropolis algorithm, we initialize 1, 000, 000, 000 cycles to generate the new search states. After configuring the variables, we start the experiments, and the results are listed as follows. We will analyze the results in different aspects:

• Time

The cost of time in solving the weighted bipartite matching problems.

• Weight

The maximum weight found by each algorithm. We solve the maximum weighted bipartite matching problems in our experiments.

Size Ant-Matching Metropolis Size Ant-Matching Metropolis

100x100 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 solution on 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.5 is 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 weights found 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 that the weights found by the ant-matching algorithm are close to the weights of the optimal solution. In Figure 4.1, the running time of the ant-matching algorithm 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 of the ant-matching algorithm is smaller than the Hungarian algorithm. Thus, if the problem size is very large, the ant-matching algorithm will be faster than the Hungarian algorithm.

The weights found by the Metropolis algorithm are close to the half of the weights of the optimal solution. But the running time of the Metropolis algorithm is very small. In practice, we can find the result with less number of cycles in the Metropolis algorithm. The initialized 1, 000, 000, 000 cycles is used to raise the running time, it will help to draw the transitions on different problem sizes in Figure 4.1.

Figure 4.1: The running time of each algorithm on the complete bipartite graph.

### 4.3.2 Results on Sparse Bipartite Graphs

In the sparse bipartite graph G = (U, V, E) which each vertex u_{i} ∈ U has at
most 2% ∗ |V | edges, the numeral result of this matching problem is listed
in Table 4.10. Table 4.3 is the result of weights found by the ant-matching
algorithm and the Metropolis algorithm as proportions to the weights of
the optimal solution. In Table 4.3, the weights found by the ant-matching
algorithm 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 the
Hungarian algorithm as the problem size increases. Thus, in a large scale
bipartite matching problem, we can use the ant-matching algorithm to find
a 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 algorithm are close to half of the weights of the optimal solution. In Figure 4.2, even we initializes 1, 000, 000, 000 cycles in the Metropolis algorithm, the running time is still small. Thus, if we want to find a matching in a rapid time and don’t care the weight, we can use the Metropolis algorithm to find a solution.

Figure 4.2: The running time of each algorithm on the bipartite graph where
each vertex u_{i} ∈ U has at most 2% ∗ |V | edges.

Size Ant-Matching Metropolis Size Ant-Matching Metropolis

100x100 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 solution
on the bipartite graph where each vertex u_{i} ∈ U has at most 2% ∗ |V | edges.

Figure 4.3: The running time of each algorithm on the bipartite graph where
each vertex u_{i} ∈ U has at most 5 edges.

Here is another sparse bipartite graph G = (U, V, E) where each vertex
u_{i} ∈ U has at most 5 edges, and the numeral result of this matching problem
is listed in Table 4.11. Figure 4.3 is the graphic illustration of the time costs
by each algorithm. We can see that the running times of the ant-matching
algorithm and the Metropolis algorithm are still much less than the running
times of the Hungarian algorithm. In Table 4.4, the weights found by the
ant-matching algorithm are close to the optimal solutions. Thus, in a large
scale and very sparse graph, we can use the ant-matching algorithm to find
a matching in a smaller time and the weight of the matching is close to the
weight of the optimal solution.

Size Ant-Matching Metropolis Size Ant-Matching Metropolis

100x100 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 solution
on the bipartite graph where each vertex u_{i} ∈ U has at most 5 edges.

### 4.3.3 Results on Ant-Matching Algorithm

In addition to the above-mentioned bipartite matching problems, we also solve 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 results and indicate the features of each algorithm.

In the ant-matching algorithm, Figure 4.4 is the graphic illustration for the running times on each different bipartite matching problem. In Figure 4.4, we can easily see that the running time of the ant-matching algorithm depends on number of edges. The less the number of edges in the bipartite graph, the less time the ant-matching algorithm costs on solving the matching problem.

Figure 4.5 illustrates the transitions of the weights on each different graph on different problem sizes. In Figure 4.5, as the problem size increases, the weights found by the ant-matching algorithm on each different graph as pro- portions to the weights of the optimal solution decrease slowly. Besides, the weights as proportions to the optimal solution are greater than 90%. With the advantages of the smaller running time, we can use the ant-matching algorithm to find a matching in a smaller time, which the weight is close to the optimal solution.

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 proportions to the weights of the optimal solution on each different bipartite graph.

Figure 4.6: The weight found by the Metropolis algorithm as proportions to the 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 other two algorithms. Even the cost times have slight change on different prob- lem sizes, but they are still smaller than the other two algorithms. But the weights found by the Metropolis algorithm are not as impressive. In Figure 4.6, as the problem size increases, we can see that the weights found by the Metropolis algorithm as proportions to the optimal solution lie in between 45% 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 matching problem within a small time.

Table4.5:Resultsoneachalgorithmforcompletebipar- titegraphs. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x100124221274547893.7621278459.9913797598.56287138 200x200283281261401094186.7533713112.4511809198.2346859 300x300679691441724125277.2871941166.3360957298.3417949 400x40011987519862510438370.1943328218.8004151398.3521658 500x50018689128162520219463.1564475268.1571713498.3220945 600x60026828132642234484554.4458956326.003062598.293561 700x70036300033717264781644.9132094368.5894278698.2666038 800x800474672345922105953731.7736169418.3070854798.3324054 900x900602469371109146204827.9483202474.6728236898.3740431 1000x1000742375376828204000915.8608818524.5644648998.4223776 1100x11009026403725313000311001.691501571.89600811098.35845 1200x120010686094175313951251091.736157626.56685021198.356802 1300x130012536093857815370321188.241281674.89352371298.347934 1400x140014484064003437088901272.006474721.39617441398.370254 1500x150016681253956729073751362.458324773.79706961498.416469 1600x1600189523439967210980311453.659121826.6484541598.367255 1700x1700215092241945314244211544.753336864.87784891698.379739 1800x1800246317240937517858431631.940541921.61150561798.37223 1900x1900269170342848521109991719.485088979.42624411898.372438 2000x2000297348542682826628531810.807451033.3922591998.351143

Table4.6:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost50%∗|V|edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10049221275319492.7278062760.3616938596.86275204 200x200193281311101047187.1510867113.034867196.8652595 300x300434851331883953276.3326725163.4122039296.5828484 400x400774061422978813366.0217489216.409315396.7368031 500x50012100020237520172456.8639815264.6425751496.741958 600x60017412525793734109549.5275268312.2918048596.6812997 700x70023650029109356641641.3882497366.1369673696.8035924 800x80030892231820392219734.1128885417.2432508796.7329625 900x900390672345640139641818.4287195467.2815802896.6588299 1000x1000482782361360199453913.0191076522.0801954996.915783 1100x11005882503734213125161002.04486566.10896351096.640389 1200x12007013593894224032181098.590562614.33450731196.7346 1300x13008266253808755694531184.955507668.58402561296.792552 1400x14009612503857667071721273.914744720.9959461396.763585 1500x150011016413934069009851367.074562779.05653911496.718364 1600x1600125404739201611337661453.96136817.48394711596.719021 1700x1700141400041084413652971545.651154863.53699431696.774299 1800x1800158639141361016916871630.413165917.12763541796.742078 1900x1900176645340489120639851724.556971974.17303041896.714927 2000x2000195975042154724929841813.187711028.6354551996.763675

Table4.7:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost25%∗|V|edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10058751210476391.0877001355.6117677693.14795471 200x20013375123406640185.5426607108.4255932193.4444159 300x300315311258752494277.7223822159.6677912293.3814713 400x400560621397346453359.3233843214.487364393.5737603 500x5008757813565614573454.6455209256.6291784493.3040891 600x60012523414321827603542.8681129312.7091165593.6723418 700x70017011017554749844640.9559432364.140993693.6291807 800x80022195321712579956726.0061843411.0983714793.5412079 900x900279906244953126168824.9739264461.2034476893.4246839 1000x1000344454271500176792914.2384497509.7117555993.6410455 1100x11004161572880002490021002.637891560.4437241093.374392 1200x12004951713064694062961092.740705611.83703491193.319361 1300x13005802503241415676421188.161513659.04574471293.535325 1400x14006902973305627114391284.472726716.89911481393.315201 1500x15007720473396098930311365.775754765.3170491493.521154 1600x160087817136056311749351459.460002809.93315591593.2746 1700x170099206235945313583361553.841628865.64471681693.54095 1800x1800111137536570417570881641.120297913.36381761793.34458 1900x1900123661037681319513831727.499884964.01437461893.537905 2000x2000137064138489126237161822.7965551009.5878331993.525222

Table4.8:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost10%∗|V|edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10048591269537881.9810708852.743867384.89513053 200x20010531126250655177.5833111103.462862184.1782001 300x300252031275312509270.012258152.4335902284.0442781 400x400450781280476312368.4031894198.9246604383.3327097 500x5007011013473413108459.6486038249.895601483.225838 600x60010079713207829364553.28167295.4547724582.7038311 700x70013664113509450156648.5281659344.969619682.8400679 800x80017757813764185630734.944871395.7375045782.5284336 900x900224875141422110333813.9211635445.6657887882.8959439 1000x1000279047159000183946898.1066518494.2512265982.8046155 1100x11003367501839223010911001.708216547.63071671082.368178 1200x12004015322038913890891078.901513592.53258971182.699767 1300x13004663122270795558281168.468644642.03054381282.202102 1400x14005388592461726954791263.152943690.88859261382.615354 1500x15006279062582978885421356.610098738.10145631482.409127 1600x160071760929210911183571440.810854789.83365271582.324841 1700x170079648428534414104241552.519654834.94581981682.565528 1800x180088959432011017323061628.851506887.68515861782.206735 1900x190098996933417222091871721.188425932.32216621882.134316 2000x2000109737531261026094061817.020365983.57573351982.35423

Table4.9:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost5%∗|V|edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10047661653446372.5596363845.2648322574.35403938 200x20010516157875953166.558972396.90158747171.122618 300x300243131449223766261.3024405139.076186268.454759 400x400432031527979141353.8664193184.2110728368.5471482 500x5006734415259417594451.1410476231.1197816468.8982772 600x6009646815301634468542.8622255277.0767393569.0571676 700x70013104715475061953638.3631942328.4142032667.9605229 800x80017065615454794297727.6950692373.3781007767.8706861 900x900215015167984138031820.9100048424.835042869.3211035 1000x1000265735158593204500914.296472469.8069121967.6872272 1100x1100321593163719276672962.8716941519.34921031068.466494 1200x12003812821617504290461105.298322567.20152871167.502663 1300x13004421721777345458431190.38188621.70237151267.845605 1400x14005307971814077090161241.8753660.9824681369.133415 1500x15005899531886259277031343.170651711.06996211467.87038 1600x160067654719417211422501440.372647770.59026281568.227608 1700x170076709418926613889381527.22796808.59543611667.407893 1800x180084750019501515744851620.858498855.38648811767.395637 1900x190094956320656220558751710.799868908.37557281867.813619 2000x2000104714121671925105321780.25997954.86784341967.058802

Table4.10:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost2%∗|V|edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10045001778906355.1801386241.1926761957.00068792 200x2009641171047953138.710132279.54238642140.9311258 300x300224221660004203224.0294476121.265374227.7981038 400x400392661621718484320.7804736167.8679841329.4465666 500x5006100016054618938414.5875839208.0267164426.0298118 600x6008753116146936734509.6318166256.243303524.8016639 700x70011892216109458453604.8175264298.9940862625.8276844 800x80015467216129792375701.3100012351.32063724.0302865 900x900195234162375136469791.2816921398.2672566823.4463629 1000x1000240234166891232406883.9602428444.3647732922.7610247 1100x1100290187168672282844975.0802044480.1493951020.29556 1200x12003450161698443896871069.0864534.25668521123.255501 1300x13004024841704845199851167.66944574.13916511222.317805 1400x14004671251726257031881253.027779631.8811891321.521038 1500x15005370621697189277341352.065866668.24641491419.073406 1600x160061060917160911400471445.338479721.35068411520.953155 1700x170069131317534414825781532.560839761.55535721620.453898 1800x180077293717618817040941627.420304812.94166411720.464429 1900x190085734318004720570161720.942026855.19338121819.961713 2000x200095571917231224680941809.907837908.01192171919.65387

Table4.11:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost5edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10026101441257871.0163280447.7675417972.29785256 200x20095471479541078144.326146788.1606114147.6499849 300x300207191429693625209.4333408123.6406937218.1550131 400x400361091454539172274.9515693160.1249942284.7093798 500x5005578214582818890353.1550806195.7581271360.6097908 600x6008065714692236235418.2425001228.5038435432.3359955 700x70010925015593763484491.7125773266.4793163505.5378906 800x80014171914996899828566.709767301.7321196582.129979 900x900176953151015155328642.0896993340.1776528659.1108085 1000x1000219563150344227000705.2530634376.0164821728.5519891 1100x1100270328153859325188782.8807543405.4215758802.6950651 1200x1200321468150578468969836.8582344439.8375131861.2299184 1300x1300379110152547581547919.6835791480.6155806942.1875666 1400x1400440797153016714781991.7097025507.9210431018.95962 1500x15005076101517039458121058.513904541.32116371090.621186 1600x160057968815276611866561127.451401568.6919671157.792919 1700x170065321915595415812661191.915721604.58551351228.676967 1800x180072653115340718541561270.577832640.53868861306.944366 1900x190080336015460922972341340.351306672.03554651381.98123 2000x200088353115493827738281414.73028709.13559421457.643701

Table4.12:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost10edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10029061362037883.4414483152.743867384.89513053 200x200101101388281031166.080900594.96961994168.6276584 300x300219071343293390249.8521349136.8434872255.0612198 400x400382501358759000331.8127693180.8773697340.6977865 500x5005851613753118329412.310661218.2413746424.5380644 600x6008273513867233031498.8163551256.5263599508.9098678 700x70011243713964055453573.2013592295.6081407592.9172566 800x80014575013935990516661.1020851337.5970951678.512908 900x900183062139547129547745.2667431381.3007525766.6953569 1000x1000226360139906192563824.9628987410.934408850.360086 1100x1100277265141469279922905.3093731448.8447992932.823552 1200x1200330922140922358219984.2998233488.01192381015.005472 1300x13003840311416564731881067.979441532.2819591100.93529 1400x14004458441422036571401148.890971567.58758571185.088969 1500x15005108751428288600471231.703836614.0386241269.068467 1600x160057678214379710569681308.3388641.77238081350.805353 1700x170064848415262513835001380.118821679.10088411430.666428 1800x180072653116104716882661468.299406718.42296591518.556813 1900x190073175015504720001251553.872123760.14853691605.381318 2000x200079912515626623811091628.283939796.71134011687.415992

Table4.13:Resultsoneachalgorithmforthebipartite graphswhereeachvertexhasatmost20edges. Time(ms)Weight SizeAntMetropolisHungarianAntMetropolisHungarian 100x10033441327039388.994044555.4159606691.47317065 200x200110781345311125177.5010706103.462862184.1782001 300x300234531291563703268.6427545147.1410087275.9809938 400x400404061307199844357.454115196.0947465368.3861489 500x5006175013379719610442.6658518234.5835032459.3350209 600x6008698513607832734528.6467732276.5082769551.4035986 700x70011707813282859937617.6368435319.0734327642.3899665 800x80015103113356392110703.5222714361.9469399734.8569713 900x900189203133875149500796.7183423405.7479686827.3289196 1000x1000231671135296203485883.53109444.4491947918.7229245 1100x1100281328136796289250974.4097692488.60401361013.999974 1200x12003342651394383976091055.555762535.02727261104.694687 1300x13003921101390635519841149.346358577.18184761197.436389 1400x14004540321399846525311232.319395613.94207031285.780484 1500x15005204841426578767351324.146313653.2243081378.582993 1600x160058937513970411018441407.439378689.68482641469.744728 1700x170066221914084413488281494.953889736.84780251560.645091 1800x180074032814128215596561585.711844782.90349911654.742173 1900x190082215614170320157661661.610081814.08868291745.015351 2000x200090807914367223350781754.354675861.0361321836.726347

## Chapter 5 Conclusions

This thesis presents two methods for the maximum and minimum weighted bipartite matching problems. In the ant-matching algorithm, we can find a matching which the weight is close to the optimal solution. And if in a large scale weighted bipartite matching problem, using the ant-matching algorithm to find a matching will be faster than using the Hungarian algorithm. In the Metropolis algorithm, we can use the algorithm to find a matching in a very short time, but the weight of the matching as proportions to the optimal solution is not good. If we want to find a matching in a large weighted bipartite graph within a rapid time, the Metropolis algorithm is the best choice.

Besides, with the property of the ant colony optimization algorithm which the pheromone on the path changes gradually, the ant-matching algorithm will be useful in solving the dynamic weighted bipartite matching problems where the vertices and edges in the bipartite graph change with the time. In the Metropolis algorithm, in each iteration the algorithm randomly chooses an edge as a matching edge or not. It will not be influenced by the change of the bipartite graph. Thus, it is applicable on solving the dynamic weighted matching problems.

## 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 Ant Colony Optimization. Proceedings of the Inaugural Workshop on Arti- ficial Life (AL’01), pp. 70–78, Adelaide, Australia, December 2001.

[4] T. St¨utzle, 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 and Computer Science. Wiley, 1999.

[5] I, Wegener. (2005) Simulated Annealing Beats Metropolis in Com- binatorial Optimization. ICALP 2005. LNCS 3580, pp. 589–601.