an ant system algorithm for coloring graphs

28
The Pennsylvania State University The Graduate School Capital College An Ant System Algorithm for Coloring Graphs A Master’s Paper in Computer Science by Chirag Patel c 2002 Chirag Patel Submitted in Partial Fulfillment of the Requirements for the Degree of Master of Science October 2002

Upload: lamdien

Post on 14-Jan-2017

222 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: An Ant System Algorithm for Coloring Graphs

The Pennsylvania State University

The Graduate School

Capital College

An Ant System Algorithm for

Coloring Graphs

A Master’s Paper in

Computer Science

by

Chirag Patel

c©2002 Chirag Patel

Submitted in Partial Fulfillment

of the Requirements

for the Degree of

Master of Science

October 2002

Page 2: An Ant System Algorithm for Coloring Graphs

Abstract

This paper presents an ant system algorithm for the graph coloring problem.

This ant system algorithm has several new features compared to previous ant

system algorithms for the coloring problem. The main idea of the algorithm

is for a colony of ants to color the graph, in which ants use its knowledge

about the local neighborhood, recently visited nodes, and information stored

at each vertex. For proving generality of the algorithm, several instances

from different categories of graphs posted on the COLOR02 Symposium web

site were selected to test the algorithm. The algorithm performed well and

matched the best known results for most benchmark graph instances and was

close to the best known for others. The algorithm performed very well in

comparison to previous heuristic algorithms for the graph coloring problem.

i

Page 3: An Ant System Algorithm for Coloring Graphs

Table of Contents

Abstract i

Acknowledgements iii

List of Figures iv

List of Tables v

1 Introduction 1

2 Ant System Algorithms 3

3 An Ant System Algorithm for Coloring Graph (ASCG) 5

3.1 ASCG Algorithm Frame Work . . . . . . . . . . . . . . . . . . 5

3.2 Initial Coloring using MXRLF . . . . . . . . . . . . . . . . . . 6

3.3 Color a Vertex . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.4 Move the Ant . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.5 Perturbation Methods . . . . . . . . . . . . . . . . . . . . . . 10

3.6 ASCG Parameters . . . . . . . . . . . . . . . . . . . . . . . . 11

4 Experimental Results 13

5 Conclusions 18

References 18

ii

Page 4: An Ant System Algorithm for Coloring Graphs

Acknowledgements

I extend a myriad of thanks to Dr. T. Bui for his timely and continuous

guidance through out this project. His in-depth knowledge on the subject

and insight to the problem helped me a lot in achieving the goals of this

project. I am grateful to the committee members: Dr. Q. Ding, Dr. P.

Naumov, and Dr. L. Null for reviewing this paper. Special thanks to the

Computer Science department for providing hardware and software resources

for test purposes. I also thank my parents, wife, and daughter for their

indirect support of this work.

iii

Page 5: An Ant System Algorithm for Coloring Graphs

List of Figures

1 An ant system algorithm for coloring graphs (ASCG) . . . . . 7

iv

Page 6: An Ant System Algorithm for Coloring Graphs

List of Tables

1 ASCG results for some test instances from the COLOR02 web

site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2 ASCG results compared with heuristic algorithms from the

COLOR02 Symposium and the DIMACS Second Challange . . 16

v

Page 7: An Ant System Algorithm for Coloring Graphs

1 INTRODUCTION 1

1 Introduction

The graph coloring problem is the problem of coloring the vertices of an

undirected graph such that no two adjacent vertices have the same color

where using the smallest number of colors. Graph coloring theory started to

emerge as early as 1852 [23].

Let G = (V, E) be an undirected graph with vertex set V and edge set E.

A k-coloring of G is a mapping f : V −→ C, where |C| = k. The elements

of C are called colors. A k-coloring is a proper k-coloring if for all u, v ∈ V ,

if (u, v) ∈ E then f(u) 6= f(v), that is, adjacent vertices must have different

colors. For a given graph G, the minimum k such that G has a proper k-

coloring is called the chromatic number of G and is denoted by χ(G). Let

f be a k-coloring of G. The conflict at a vertex v under f is the number of

vertices adjacent to v having the same color as v under f . The total conflicts

in G under f is the sum of all the conflict of the vertices under f . The graph

coloring problem is the problem of finding the minimum k such that the given

input graph G has a proper k-coloring. The proper k-coloring problem can

also be defined as the problem of partitioning G in to k independent sets,

where an independent set is a subset of vertices such that there is no edge

between any two vertices in the set. We also call such a set a color class or

a color partition.

It is well known that the graph coloring problem is NP -hard. In fact,

determining whether a given graph can be colored with three colors is NP -

complete. There exists a polynomial time algorithm that can approximate

the chromatic number within O (|V |(log log |V |)2/(log |V |)3) [22]. However,

it is known that we cannot approximate within |V |1/7−ε, for any ε > 0 unless

P = NP [2]. Also, it was recently proved that existing polynomial time

algorithms can not always color within less than O(|V |3/14) of the optimal

coloring [3].

The graph coloring problem arises in a wide variety of applications such as

task scheduling, time tabling, frequency assignment in communication net-

works, register allocation, short circuit testing in PCB design, and traditional

Page 8: An Ant System Algorithm for Coloring Graphs

1 INTRODUCTION 2

map coloring. Since the graph coloring problem is NP -hard and approxima-

tion algorithms are not very promising as mentioned above, much work has

been concentrated on designing heuristic algorithms for the problem. The

constructive method [5][27], iterative method [12], genetic algorithm [32],

local search method [30], tabu techniques [21], and ant system algorithms

[8][9][11][32] are among the well known heuristic techniques used to attack

this notorious problem.

An ant system is an optimization technique that imitates the collective

ability of an ant colony to solve problems [4]. A number of ant system al-

gorithms for the graph coloring problem have been proposed in recent years

[8][9][11]. In this paper we give an ant system algorithm for the graph col-

oring problem. Unlike the ant system algorithm of Costa and Hertz [11],

where the ants are allowed to move from one vertex to any other vertex in

the graph, the ants in our algorithm can only move along the edges of the

graph, staying closer with the ant colony metaphor. Also the results obtained

by each ant in Costa and Hertz’s algorithm were based on sequential and tra-

ditional methods such as RLF [27] or DSATUR [5]. Our method, instead, is

based on local search by each ant using new conflict minimization techniques.

In comparison to Comellas and Ozon’s ant system algorithm [8] for graph

coloring, where each ant colors the entire graph and does just one coloring,

each of our ants colors a portion of the graph and does this in stages, called

cycles. The local coloring that each of our ant does in each cycle is affected

by the colorings of other ants in previous cycles. We also use the concept

of indirect pheromone as information stored at each vertex and in each ant

as local knowledge of the neighborhood. Unfortunately, it was difficult to

compare our results with the previous two ant system algorithm [8][11] re-

sults, as they did not use any standard set of test instances like those used

in the DIMACS Second Challenge [25]. The performance of our algorithm

on a set of 45 graphs selected from the graphs provided by the COLOR02

Computational Symposium web site (http://mat.gsia.cmu.edu/COLOR02/)

Page 9: An Ant System Algorithm for Coloring Graphs

2 ANT SYSTEM ALGORITHMS 3

is very encouraging.1

The rest of the paper is organized as follows. In Section 2 we give a brief

description of ant system algorithms. We describe our algorithm in Section 3

and present the experimental results in Section 4. The conclusion is given in

Section 5.

2 Ant System Algorithms

An Ant Aystem (AS) is a heuristic technique that imitates the behavior of

a colony of ants and its ability to collectively solve problems. For example,

it has been observed by experiments that a colony of ants is able to find the

shortest path to a food source by marking trails with a chemical substance

called pheromone [4][14].

As an ant moves and searches for food, it lays down some pheromone

along its path. As it decides where to move, it looks for pheromone trails

and prefers to follow trails with higher levels of pheromone. Suppose there

are two possible paths to reach a food source. Regardless of the path chosen,

the ant will lay the same amount of pheromone at each step. However, it will

return to its starting point more quickly when it takes the shorter path. It is

then able to return to the food source to collect more food. Thus, in an equal

amount of time, the ant would lay a higher concentration of pheromone over

its path if it takes the shorter path, since it would complete more trips in

the given time. Ants prefer to follow the path with the most accumulation

of pheromone, normally which leads to a shorter path. In addition, some

pheromone evaporates over time although not a significant amount [4][14].

It is also very possible that ants might choose the wrong path in the beginning

and follows it over and over laying more pheromone on it. This in turn forces

other ants to follow that trail, leading to a longer path. We called such

situation a stuck configuration of the ants in this paper.

Computer scientists and engineers were able to transform this model of

1A preliminary version of this paper was presented at the COLOR02 Computational

Symposium [6].

Page 10: An Ant System Algorithm for Coloring Graphs

2 ANT SYSTEM ALGORITHMS 4

collective behavior of social insects and their trail laying and trail follow-

ing behavior to useful optimization and control algorithms [4]. Due to the

simplicity and direct analogy with the Ant System, the Traveling Salesman

Problem was the first problem attacked by Dorigo et. al. in 1991 [14]. The

Traveling Salesman Problem (TSP) is the problem of finding the shortest

tour between n cities visiting each exactly once and finishing the tour at the

starting point. This problem of finding the shortest tour is similar to the

problem of finding the shortest path to a food source, which makes the ap-

plication of the ant system to the traveling salesman problem easy to apply

and understand. The Traveling Salesman Problem can be represented as a

complete weighted graph having n vertices. The weight of an edge is equal to

the distance between the two cities connected by that edge. Also the edges on

this graph are capable of storing artificial pheromone. Now several ants are

randomly placed on such a graph and some initial amount of pheromone is

set for each edge. Each ant visits n vertices only once and constructs a tour.

After completing such a tour, the ant lays down pheromone on the edges it

used. The amount of pheromone laid down depends on the length of the

tour. When another ant tries to construct a tour, it tends to follow the path

having higher pheromone, leading to shorter tour. Over time some amount of

pheromone evaporates but due to the collective behavior, some edges on the

graph still have more pheromone compared to others, which in turn forces the

ants to find a shorter tour. There are still chances that ants might get stuck

in a bad configuration, which leads to an incorrect solution. Numerous local

search and local optimization techniques have been proposed to get the ants

out of such situations. This simple framework of the Ant System has been

successfully applied to several static and dynamic problems with compatible

and robust performance [4]. Various problems that have been the focus of

the Ant System (AS) as well as the Ant Colony Optimization (ACO) [13]

are quadratic assignment, network routing, vehicle routing, frequency assign-

ment, graph coloring, shortest common supersequence, machine scheduling,

multiple knapsack, and sequential ordering problems [4] [28].

The ant system can by applied to any discrete optimization problem, in

Page 11: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)5

which a set of components having a set of possible connections or transitions

exist. Also such a set of components has some constraints. The neighborhood

structure should allow a transition from one component to another in one

logical step [13]. Here are some of the characteristics of an ant and an ant’s

colony [13]. Each ant is capable of finding a solution to the problem, but

quality of the solution emerges out of the collective interaction among the

ants. Each ant has private knowledge of the local neighborhood and the node

it is visiting but ants only communicate with each other using an indirect

mechanism such as sensing the information stored as pheromone trails. Each

ant also has knowledge of the path it has followed so far. An ant can have

start and termination conditions. Ants can lay online or offline pheromone,

that is, they can lay pheromone as they build the solution or delay laying

pheromone until they are done building the solution. Ants die after each

such solution has been built.

3 An Ant System Algorithm for Coloring

Graph (ASCG)

In this section we describe an ant system algorithm for the graph coloring

problem (ASCG). The main idea of the algorithm is for a set of ants to color

the graph. The ants are randomly distributed to the vertices of the input

graph and each ant follows the same set of rules to color the vertices of the

graph. Various parameters used in this algorithm are described in Section 3.6.

The entire algorithm is summarized in Figure 1 and the following subsections

describe various components of ASCG algorithm in detail.

3.1 ASCG Algorithm Frame Work

Let G = (V, E) be the input graph. We first determine an upper bound on the

chromatic number, χ(G), of G, by running a slightly modified version of the

XRLF algorithm [24][27], which we call MXRLF, on G. Let the upper bound

found by MXRLF be k. We distribute a colony of nAnts randomly to the

Page 12: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)6

vertices of the graph that is initially colored as described in Section 3.2. The

algorithm runs for a number of cycles. During each cycle in the algorithm, we

activate one ant at a time. We activate another ant only when the current ant

finishes its coloring task. Each ant explores and re-colors a limited local area

of the graph without any global knowledge of the graph, using only colors

from the set of q available colors, where q < k. When all the ants have finished

coloring at the end of a cycle, we have a coloring of G. After each cycle we

compute the total conflicts of the current coloring. If the total conflicts of

the current coloring is zero, we reduce the number of available colors q by

1 and continue with the next cycle. If there is no reduction in the number

of total conflicts for the last few cycles (determined by a constant called

STAGNANT CYCLES), then we increase the number of available colors q by 1

(up to k, the number of colors used by MXRLF). We also maintain the best

coloring found so far and update that value after each cycle, if appropriate.

There are nCycles cycles in the algorithm, where we set nCycles = 6|V |.However, if there is no progress, i.e., no reduction in the number of colors

used for BREAK CYCLES cycles, then the algorithm is terminated.

In our algorithm, we use indirect pheromone, which is similar to explicit

pheromone used in [9]. The indirect pheromone is information stored at each

vertex and in each ant’s memory as local knowledge of the neighborhood.

Each vertex has information about its current color and color conflict with

its neighbors stored as memory. Each ant keeps its knowledge about recently

visited vertices. The ants use this combined information while moving over

the graph and coloring the vertex at its current position. By following the

vertex with maximum conflict, the ants try to reduce the number of conflicts

in their current neighborhood to zero or as small as possible.

3.2 Initial Coloring using MXRLF

MXRLF is mainly based on RLF but also uses some features of XRLF. Let

P be a set of uncolored vertices not adjacent to any colored vertices and R

a set of uncolored vertices adjacent to at least one colored vertex. MXRLF

Page 13: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)7

1 Algorithm ASCG(G = (V , C))2 begin3 Use MXRLF to obtain a k-coloring of G (Note: k ≥ χ(G))4 q ←− αk //initial number of available colors5 Keep random βk color classes //rename the colors as appropriate6 Distribute remaining vertices into γk color classes7

8 bestColors ←− k9 Compute the conflict at each vertex and the total conflict of G

10

11 Distribute nAnts randomly on the vertices of G12

13 for cycle = 1 to nCycles do14 for ant = 1 to nAnts do15 ant colors its current vertex16 ant updates local conflict costs in current neighborhood17 while ant has not exceeded its MOVE LIMIT do18 ant updates its recentlyVisited tabu list19 ant moves to another vertex using a path of length 220 endwhile21 endfor22

23 update totalConflict cost for the entire graph G24

25 if totalConflict = 0 and bestColors > q then26 bestColoring ←− currentColoring27 bestColors ←− q28 q ←− q − 129 endif30

31 if no improvement in bestColors for the last STAGNANT CYCLES32 cycles and q has not changed for Q CHANGECYCLES cycles then33 q ←− q + 1 //precondition: q < k34

35 if q has not changed for JOLT CYCLES then36 perform a jolt operation37 if there was no improvement in the last BREAK CYCLES then38 break39 endfor40 Output results41 end ASCG

Figure 1: An ant system algorithm for coloring graphs (ASCG)

Page 14: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)8

avoids using vertices from R, while building a color class. We used the same

technique used in RLF [27], i.e., choosing the first vertex with the maximum

degree to add to the first color class. Then we sequentially add the next vertex

to the current color class from P having the maximum degree in R. Ties are

broken by selecting the vertex with the minimum degree in P . Repeat the

above process until P is empty or the color class size limit has exceeded

[24]. We used MXRLF SET LIMIT factor times |V | as the color class size limit.

This process is repeated recursively until the entire graph is colored. As our

intention was to quickly find an upper bound on the chromatic number, we

omitted the exhaustive search method for building the color classes of the

XRLF algorithm [24].

MXRLF also determines a proper k-coloring of G. Note that k is an upper

bound on χ(G) that we are looking for. Except for a few trivial benchmark

graph instances, ASCG was able to improve upon the initial k.

The initial number of colors available to the ants is set to be q = dαke,where α is a parameter. From the k color classes of the k-coloring produced

by MXRLF, we select at random dβke color classes to be kept, where β is

another parameter such that β ≤ γ. The remaining vertices that do not

belong to the selected color classes are then distributed randomly into dγkecolor classes, where β ≤ γ ≤ α. Note that the color classes are renumbered

so that all colors are in the set {1, . . . , dαke}. This coloring is then used as

a starting point for the ants. Note that this coloring may not be a proper

coloring of G. Next we compute the initial conflict at each vertex as well as

the total conflicts of this coloring in G.

3.3 Color a Vertex

When an ant is at a vertex, its objective is to re-color that vertex using the

smallest available color number so that the conflict at that vertex is zero.

If that is not possible, the ant will try to select the smallest color number

from the list of available colors that will minimize the conflict at that vertex.

Furthermore, if zero conflict is not possible, the ant will try to select a color

Page 15: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)9

that it has not used in a previous location. This will prevent any additional

conflict to the previous vertices that the ant has colored. When there is

a choice among several available colors satisfying the requirement, the ant

picks one at random. We then update the conflict at this vertex. Note that

the ant does not have knowledge of the total conflicts for the entire graph.

We also experimented with using the following two variations for coloring

a vertex, but the above strategy yielded the best results.

Method 1: During each stage of coloring, an ant randomly picks one

color from the available colors such that the conflict at that vertex is zero.

If there is no such color then it randomly picks one color from the set of q

available colors.

Method 2: In this method, we color a pair of vertices together. When

an ant moves from its current position to the next position, it also makes one

more move. It makes a pair of these last two vertices and then colors both

at a same time, using same or different colors.

3.4 Move the Ant

After an ant finishes coloring its current vertex it moves to another vertex

and tries to color it. Each ant will make MOVE LIMIT such moves before it

stops. The ant moves to another vertex by taking a path of length two.

The first edge in the path is selected at random among all edges connected

to its current vertex. The second edge in the path is selected so that the

ant will end up in a vertex that has the maximum conflict among all vertices

adjacent to the vertex at the end of the first edge. Ties are broken arbitrarily.

Additionally, each ant also has a recently visited tabu list containing recently

visited vertices that it cannot revisit. This helps the ant to move away

from its recent visits and allows the ant to escape out of local loops. This

new technique gives the ant the added capability to do coloring, leaving the

common color configuration intact. This prevents any additional conflict to

the previous node that the ant has just colored.

We also generalized the above concept for any further experiments as

Page 16: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)10

described below. We parameterized the distance of how far an ant moves from

its current location to next location. As a part of this scheme, we designed

three different techniques to move an ant. In each of the following methods,

the ant moves from its current vertex to the next vertex by selecting one of

its adjacent vertices using the rules for that method’s intermediate moves.

Method 1: An ant randomly picks one of its neighbor vertices and moves

to it from its current position. The ant uses this rule for the entire length of

the path. For example, when an ant has a path of length two, it randomly

picks an adjacent vertex and moves to it. The ant repeats the same rule one

more time from its new position.

Method 2: An ant takes all but the last move for the entire length of

the path randomly using Method 1. The last move is to a neighboring vertex

having the maximum conflict. Any ties are broken arbitrarily.

Method 3: An ant moves through the entire length of the path by

selecting an adjacent vertex having maximum conflict. In this method, during

each move an ant picks an adjacent vertex having maximum conflict. The

ant repeats this rule for all the moves for the entire length of the path.

These move methods and their variations have ample potential for im-

proving results with its combination of various local coloring methods. These

methods follows ACO meta-heuristics, as the move using this method could

be treated as one logical move.

3.5 Perturbation Methods

The ants might get stuck in a local optima or a bad configuration. To help

move the algorithm out of a local optima or the stuck configuration, we add

a perturbation to the coloring, which we call a jolt. This jolt method acts like

the effects of a storm, flood, fire etc., which forces a natural colony of ants to

restructure and find new food sources. In the ASCG algorithm, if there is no

reduction in the number of colors used for JOLT CYCLES cycles, we activate

the jolt method. The jolt method picks vertices that have conflict in the top

10%, and randomly re-colors the neighbors of these vertices using 80% of the

Page 17: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)11

current set of available colors. This will initially introduce more conflicts but

will also allow ants to use more unused colors. This in turn may reduce the

local conflict to zero and also reduce the total conflicts of the entire graph.

As a part of our experiments, we also designed two additional methods,

which can be used in various combinations for further studies.

Method 1: In this method, we took 20% of the color classes having

larger set size and 20% of the color classes having smaller set size. We

re-color those using a small number of available color leaving some colors

unused. This allows ants to rebuild part of the solution having more choices

of unused colors, which may not add any further conflict.

Method 2: In this method, we took 20% of the color classes having

higher color number and re-color all vertices in those using the remaining

80% colors. This also allows removing some color configuration in which

ants might be stuck and also allows ants with more unused color choices that

in turn reduces the local conflict to minimum, if not to zero.

3.6 ASCG Parameters

In what follows, we give a brief description for each important parameter

used in the ASCG algorithm. Initially we tested our algorithm using various

parameters on a small set of test graphs like circle, line, tree, caterpillar,

lattice, and a few from DIMACS Second Challenge benchmark instances.

When we finalized the parameters for running it on the larger test graphs of

varying classes, the COLOR02 web site was not even in existence. This set

of parameters is generalized for all classes of the benchmark graphs and not

tuned for solving coloring problem for a particular class of graphs. Following

are the ASCG algorithm parameters.

nAnts is the number of ants in a colony and was set to 20% of the number

of vertices in the graph. For efficiency reasons we do not allow nAnts

to exceed 100.

nCycles is the number of cycles in the entire coloring process and was set

at 6 times the number of vertices in the graph.

Page 18: An Ant System Algorithm for Coloring Graphs

3 AN ANT SYSTEM ALGORITHM FOR COLORING GRAPH (ASCG)12

α is the percentage of k colors from MXRLF. dαkeis the initial number of

colors available to the ants. We set α = 80%.

β is the percentage of color classes from MXRLF that are to be kept in an

initial coloring of the graph for the ants to start. We set β = 50%.

γ is the percentage of color classes that are to be used while distributing

remaining vertices after selecting initial dβke color classes. We set

γ = 70%.

STAGNANT CYCLES is the number of consecutive cycles for which the algo-

rithm makes no improvement before the number of available colors is

adjusted. This value is set to 5.

MXRLF SET LIMIT is the color class/partition size limit in RLF. We set this

at 0.7 of |V |.

MOVE LIMIT is the number of vertices an ant can visit before it stops.

MOVE LIMIT =

d(0.25× |V |)e, if nAnts < 100

d(20 + |V |/nAnts)e, otherwise

where |V | is the number of vertices in the graph.

R SIZE LIMIT is the length of a tabu list of recently visited vertices. An

ant will avoid revisiting those vertices in its tabu list allowing a more

diverse exploration of the graph. R SIZE LIMIT = dMOVE LIMIT/3e

Q CHANGE CYCLES is the number of cycles that must be passed without progress

before q, the number of available colors, is incremented by 1. This value

is set to 5.

JOLT CYCLES is the number of cycles during which the value of q has not

improved, before a jolt is applied to the coloring creating a perturbation

of the current coloring configuration. This value is set to one half of

the number of vertices in the graph. JOLT CYCLES = d(|V |/2)e

Page 19: An Ant System Algorithm for Coloring Graphs

4 EXPERIMENTAL RESULTS 13

BREAK CYCLES is the number of cycles during which the value of q has not

improved before the algorithm is terminated. This value is set at 2.5

times the number of vertices. BREAK CYCLES = d(|V | × 2.5)e

4 Experimental Results

In this section we present the results of our algorithm on 45 graphs selected

from http://mat.gsia.cmu.edu/COLOR02/ to represent the various classes of

benchmark graphs. Also our selection was based on the test results that are

available from the papers presented during the DIMACS Second Challenge

or the COLOR02 Symposium. These graphs have up to 1,000 vertices and

up to 307,350 edges with varying edge density.

The algorithm was implemented in C++. It was run on a 1.6 GHz Intel

Pentium4, DELL Inspiron notebook PC with 512 MB of RAM. Windows XP

was the operating system on this system.

For each of the 45 graphs we ran our algorithm for 50 trials. Of the 45

selected graphs there are 32 graphs with either known chromatic number

or best known bound on the chromatic numbers. Of these 32 graphs, our

algorithm found matching bounds for 28 of them. For the remaining 4 graphs,

our algorithm got slightly poor results, but close to the known bounds. For

the 13 graphs that have no known lower bound, we compared our results with

results from other algorithms and our algorithm did well in the comparison.

The results are summarized in Table 1. For each graph, we list the name

of the graph, category of the graph (CAT), number of vertices (V), number

of edges (E), the chromatic number or the best known bound on the chro-

matic number (BK), minimum (Min), average (Avg), maximum (Max), and

standard deviation (SD) of the results produced by our algorithm in 50 trials.

We also list the average running time (in seconds) out of the 50 trials. It

should be noted that the standard deviations of the results are quite small,

all less than 1.

In Table 2, we compared our results with those of several papers from

the DIMACS Second Challenge and the COLOR02 Symposium. We selected

Page 20: An Ant System Algorithm for Coloring Graphs

4 EXPERIMENTAL RESULTS 14

the heuristics of [7] [10] [16] [31] from the COLOR02 Symposium, which was

held in September 2002 at Cornell University. We also selected the heuristics

of [12] [19] [26] from the DIMACS Second Challenge held in October 1993,

which are robust and proved algorithms. In comparison to those, almost all

of our results were very competitive and outstanding.

Machine Benchmark: The DIMACS Second Challenge and the COLOR02

Symposium required participants to run machine benchmark. This allows

comparing results of various algorithms on the same base line. The Standard

Machine runs this benchmark in 100 seconds which is considered as a base

machine. The code for the DFMAX program and test instance was used

from http://mat.gsia.cmu.edu/COLOR02/ and we modified it to run on the

Windows platform. DFMAX finds a max clique from a graph instance read

in DIMACS binary format, but we also modified it to read DIMACS ASCII

graph format. We ran this machine benchmark on our test system and the

results for the r500.5.b graph instance are as below.

DFMAX(r500.5)

51.00 s(user) 00.00 s(sys) 52.00 s(real)

Best: 345 204 148 480 16 336 76 223 260 403 141 382 289

where user, sys, and real are the user, system and real running time (in

seconds) for the DFMAX bechmark program. Best is the list of vertices in

the maximum clique returned for r500.5 input graph.

Description of Benchmark Graph Categories: Here is the brief de-

scription of the various benchmark graph categories included in our results

as found on the COLOR02 web site.

DSJ: (From David Johnson ([email protected])) Random graphs used in

[24]. DSJC are standard (n, p) random graphs. DSJR are geometric graphs,

with DSJR.*c being complements of geometric graphs. In some papers, the

edge count is twice that given here since both (i, j) and (j, i) are counted.

CUL: (From Joe Culberson ([email protected])) Quasi-random coloring

problem with flatness zero.

Page 21: An Ant System Algorithm for Coloring Graphs

4 EXPERIMENTAL RESULTS 15

ASCG ResultsInstance CAT V E BK Min Avg Max SD time(s)DSJC125.1.col DSJ 125 736 5 5 5.96 6 0.20 1.72DSJC125.5.col DSJ 125 3891 ? 18 18.00 18 0.00 3.44DSJC125.9.col DSJ 125 6961 ? 42 43.96 44 0.28 4.16DSJC250.5.col DSJ 250 15668 ? 22 22.9 23 0.30 17.84DSJC250.9.col DSJ 250 27897 ? 72 72.94 74 0.37 36.26DSJC500.1.col DSJ 500 12458 ? 13 13.00 13 0.00 102.58DSJC500.5.col DSJ 500 62624 ? 51 51.84 53 0.42 230.32DSJC1000.1.col DSJ 1000 49629 ? 21 21.86 22 0.35 464.18DSJC1000.5.col DSJ 1000 249826 ? 91 92.66 93 0.51 1072.54DSJR500.1.col DSJ 500 3555 12 12 12.00 12 0.00 72.00DSJR500.1C.col DSJ 500 121275 ? 85 85.44 86 0.50 288.42DSJR500.5.col DSJ 500 58862 ? 128 129.58 130 0.53 292.16fpsol2.i.1.col REG 496 11654 65 65 65.00 65 0.00 119.96fpsol2.i.3.col REG 425 8688 30 30 30.00 30 0.00 92.98mulsol.i.1.col REG 197 3925 49 49 49.00 49 0.00 8.48mulsol.i.3.col REG 184 3916 31 31 31.00 31 0.00 8.06zeroin.i.1.col REG 211 4100 49 49 49.00 49 0.00 10.44zeroin.i.3.col REG 206 3540 30 30 30.00 30 0.00 10.64latin square 10.col LAT 900 307350 ? 101 102.60 104 0.72 948.20school1.col SCH 385 19095 14 14 14.00 14 0.00 73.58school1 nsh.col SCh 352 14612 14 14 14.00 14 0.00 50.38le450 15a.col LEI 450 8168 15 15 15.52 16 0.50 86.42le450 15b.col LEI 450 8169 15 15 15.48 16 0.50 88.90le450 25a.col LEI 450 8260 25 25 25.00 25 0.00 79.38le450 5a.col LEI 450 5714 5 5 5.90 6 0.30 73.72le450 5b.col LEI 450 5734 5 5 5.94 6 0.23 65.02games120.col SGB 120 638 9 9 9.00 9 0.00 1.49miles250.col SGB 128 387 8 8 8.00 8 0.00 1.61miles500.col SGB 128 1170 20 20 20.00 20 0.00 2.50miles750.col SGB 128 2113 31 31 31.00 31 0.00 3.68queen9 9.col SGB 81 2112 10 10 10.14 11 0.35 1.12queen13 13.col SGB 169 6656 13 14 14.96 15 0.20 6.42queen16 16.col SGB 256 12640 ? 18 18.00 18 0.00 19.96myciel6.col MYC 95 755 7 7 7.00 7 0.00 0.92myciel7.col MYC 191 2360 8 8 8.00 8 0.00 6.16mug88 25.col MIZ 88 146 4 4 4.00 4 0.00 0.40mug100 25.col MIZ 100 166 4 4 4.00 4 0.00 0.681-insertions 4.col CAR 67 232 4 4 4.46 5 0.50 0.242-insertions 4.col CAR 149 541 4 4 4.78 5 0.41 2.083-insertions 4.col CAR 281 1046 3 5 5.00 5 0.00 12.483-insertions 5.col CAR 1406 9695 ? 6 6.00 6 0.00 711.744-insertions 3.col CAR 79 156 3 4 4.00 4 0.00 0.29qg.order30.col GOM 900 26100 30 30 30.00 30 0.00 369.24flat300 20 0.col CUL 300 21375 20 20 20.00 20 0.00 44.98flat300 28 0.col CUL 300 21695 28 33 33.34 34 0.47 51.22

Table 1: ASCG results for some test instances from the COLOR02 web site

Page 22: An Ant System Algorithm for Coloring Graphs

4 EXPERIMENTAL RESULTS 16

ASCG comparisionCOLOR02 DIMACS

Instance Best Known ASCG [10] [16] [31] [7] [12] [19] [26]DSJC125.1.col 5 5 7DSJC125.5.col ? 18 20 21 18 20 17DSJC125.9.col ? 42 46DSJC250.5.col ? 22 37 28 32 35 29DSJC250.9.col ? 72 79DSJC500.1.col ? 13 16 12 20 12DSJC500.5.col ? 51 66 48 50 57 65 52DSJC1000.1.COL ? 21 20 41DSJC1000.5.COL ? 91 84 102 117 99DSJR500.1.COL 12 12 12 12 12 12DSJR500.1C.COL ? 85 88 105 85 87 85DSJR500.5.col ? 128 155 124 128 126 128fpsol2.i.1.col 65 65 65fpsol2.i.3.col 30 30 30 33mulsol.i.1.col 49 49 49 49mulsol.i.3.col 31 31 31zeroin.i.1.col 49 49 49zeroin.i.3.col 30 30 30latin square 10.col ? 101 99 105 130 109school1.col 14 14 37 14 29 14school1 nsh.col 14 14 33 14 26 14le450 15a.col 15 15 18 23 15 15 17 16le450 15b.col 15 15 18 23 15 15 17 15le450 25a.col 25 25 30le450 5a.col 5 5 14 5le450 5b.col 5 5 13 5games120.col 9 9miles250.col 8 8 9miles500.col 20 20 32miles750.col 31 31queen9 9.col 10 10queen13 13.col 13 14 14queen16 16.col ? 18 21 18myciel6.col 7 7myciel7.col 8 8mug88 25.col 4 4mug100 25.col 4 41-insertions 4.col 4 42-insertions 4.col 4 4 5 5 53-insertions 4.col 3 5 5 5 53-insertions 5.col ? 6 6 29 64-insertions 3.col 3 4qg.order30.col 30 30 36flat300 20.col 20 20 20 39 20flat300 28.col 28 33 31 35 41 33

Table 2: ASCG results compared with heuristic algorithms from theCOLOR02 Symposium and the DIMACS Second Challange

Page 23: An Ant System Algorithm for Coloring Graphs

4 EXPERIMENTAL RESULTS 17

REG: (From Gary Lewandowski ([email protected])) Problem based on reg-

ister allocation for variables in real codes.

LEI: (From Craig Morgenstern ([email protected])) Leighton

graphs with guaranteed coloring size, which were referenced in [27].

SCH: (From Gary Lewandowski ([email protected])) Class scheduling

graphs, with and without study halls.

LAT: (From Gary Lewandowski ([email protected])) Latin square prob-

lem.

SGB: (From Michael Trick ([email protected])) Graphs from Donald Knuth’s

Stanford GraphBase. These can be divided into:

Game Graphs: The games played in a college football season

can be represented by a graph where the nodes represent each

college team. Two teams are connected by an edge if they

played each other during the season. Knuth gives the graph

for the 1990 college football season.

Miles Graphs: These graphs are similar to geometric graphs in

that nodes are placed in space with two nodes connected if

they are close enough. These graphs, however, are not ran-

dom. The nodes represent a set of United States cities and

the distance between them is given by road mileage. These

graphs are also due to Knuth.

Queen Graphs: Given an n by n chessboard, a queen graph is

a graph on n2 nodes, each corresponding to a square of the

board. Two nodes are connected by an edge if the correspond-

ing squares are in the same row, column, or diagonal.

MYC: (From Michael Trick ([email protected])) Graphs based on the My-

cielski transformation. These graphs are difficult to solve because they are

triangle free (clique number 2) but the coloring number increases in problem

size.

Page 24: An Ant System Algorithm for Coloring Graphs

5 CONCLUSIONS 18

MIZ: (From Kuzunori Mizuno ([email protected]) Graphs that

are almost 3-colorable, but have a hard-to-find clique of 4 embedded [29].

CAR: (From M. Caramia [email protected] and P. Dell’Olmo

[email protected]) k-Insertion graphs and Full Insertion graphs are

a generalization of myciel graphs with inserted nodes to increase graph size

but not density.

GOM: (From Carla Gomes [email protected]) Quasigroup or latin square

completion problems(standard encoding). A partially filled n by n table is

given, in which no symbol occurs twice in a row or a column. The problem

is to determinine that the remaining entries of the table can be filled in such

a way that we obtain a complete latin square [20].

5 Conclusions

In this paper we have presented an ant system algorithm for the graph col-

oring problem that performs well on a set of 45 graphs selected from a set

of benchmark graphs. Our algorithm found matching bounds on the 28 test

graphs with known bounds. It did not match the 4 remaining instances but

the results are close to the best known or lower bound for those test in-

stances. The overall results were comparable with other heuristic algorithms

presented at the COLOR02 Symposium and the DIMACS Second Challenge.

It is noticeable that the algorithm did poorly on random graphs, which was

also the case for the other competitive algorithms. This ant system algorithm

uses indirect pheromone. Direct pheromone update, in terms of each ant’s

move and which color it used, is one of the features that might improve some

results and remains a task for future studies.

References

[1] J. Abril, F. Comellas, A. Cortes, J. Ozon and M. Vaquer, “A Multi-

Agent System for Frequency Assignment in Cellular Radio Networks”,

Page 25: An Ant System Algorithm for Coloring Graphs

REFERENCES 19

IEEE Transactions on Vehicular Technology, 49(5) September 2000, pp.

1558–1564.

[2] M. Bellare, O. Goldreich and M. Sudan, “Free Bits, PCPs and Non-

Approximability - Towards Tight Results”, SIAM J. Comp. 27, 1998,

pp. 804–915.

[3] A. Blum, D. Karger “An O(n3/14)−Coloring Algorithm for 3-Colorable

Graphs”, Information Processing Letters, 61(1), January 1997. pp. 49–

53.

[4] E. Bonabeau, M. Dorigo and G. Theraulaz, “Inspiration for Optimiza-

tion from Social Insect Behavior”, Nature, Vol. 406, July 6, 2000, pp.

39–42.

[5] D. Brelaz, “New Methods to Color the Vertices of a Graph”, Commu-

nications of the ACM, 22(4), April 1979, pp. 251–256.

[6] T. N. Bui and C. Patel, “An Ant system Algorithm for Coloring

Graphs”, Computational Symposium on Graph Coloring and its Gen-

eralizations, COLOR02, Cornell University, September 2002.

[7] M. Chiarandini, T. Stutzle, “An Application of Iterated Local Search to

Graph Coloring Problem”, Computational Symposium on Graph Color-

ing and its Generalizations, COLOR02, Cornell University, September

2002.

[8] F. Comellas and J. Ozon, “Graph Coloring Algorithms for Assign-

ment Problems in Radio Networks,” Applications of Neural Networks

to Telecommunications 2, 1995, pp. 49–56.

[9] F. Comellas and J. Ozon, “An Ant Algorithm for the Graph Coloring

Problem,” ANTS’98 - From Ant Colonies to Artificial Ants: First In-

ternational Workshop on Ant Colony Optimization, Brussels, Belgium,

October 15-16, 1998.

Page 26: An Ant System Algorithm for Coloring Graphs

REFERENCES 20

[10] C. Coritoru, H. Luchian, O. Gheorghies, A. Apetrei, “A New Genetic

Graph Coloring Heuristic”, Computational Symposium on Graph Col-

oring and its generalizations, COLOR02, Cornell University, September

2002.

[11] D. Costa and A. Hertz, “Ants Can Colour Graphs,” Journal of Opera-

tional Research Society, Vol. 48, 1997, pp. 295–305.

[12] J. Culberson, F. Luo, “Exploring the k-colorable landscape with Iterated

Greedy”, Cliques, Coloring and Satisfiability – Second DIMACS Imple-

mentation Challenge 1993, American Mathematical Society, Volume 26

(1996), pp. 245–284.

[13] M. Dorigo and G. Di Caro, “The Ant Colony Optimization Meta-

Heuristic,” New Ideas in Optimization, McGraw-Hill, 1999, pp. 11–32.

[14] M. Dorigo and L. Gambardella, “Ant Colony System: A Cooperative

Learning Approach to the Traveling Salesman Problem,” IEEE Trans.

on Evol. Computation, 1(1), 1997, pp. 53–66.

[15] C. Fleurent, J. Ferland, “Genetic and Hybrid Algorithms for Graph

Coloring”, Annals of Operations Research, Volume 63, 1996, pp. 437–

461.

[16] P. Galinier, A. Hertz, N. Zufferey, “Adaptive Memory Algorithms for

Graph Coloring”, Computational Symposium on Graph Coloring and its

Generalizations, COLOR02, Cornell University, September 2002.

[17] P. Galinier ad J. Hao, “Hybrid Evolutionary Algorithms for Graph Col-

oring”, Journal of Combinatorial Optimization, October 1998.

[18] L. M. Gambardella and M. Dorigo, “An Ant Colony System Hybridized

with a New Local Search for the Sequential Ordering Problem,” IN-

FORMS Journal on Computing, 12(3), Summer 2000.

[19] F. Glover, M.Parker, J. Ryan, “Coloring by Tabu Branch and Bound”,

Cliques, Coloring and Satisfiability – Second DIMACS Implementation

Page 27: An Ant System Algorithm for Coloring Graphs

REFERENCES 21

Challenge 1993, American Mathematical Society, Volume 26 (1996), pp.

285–307.

[20] C. Gomes, D. Shmoys, “Completing Quasigroups or Latin Squares:

A Structed Graph Coloring Problem”, Computational Symposium on

Graph Coloring and its generalizations, COLOR02, Cornell University,

September 2002.

[21] A. Hertz, D. Werra, “Using Tabu Search Techniques for Graph Color-

ing”, Computing, Volume 39, 1987, pp. 345–351.

[22] M. M. Halldorsson, “A Still Better Performance Guarantee for Approx-

imate Graph Coloring”, Information Processing Letters, 45, 1993, pp.

19–23.

[23] T. R. Jensen and B. Toft, Graph Coloring Problems, Wiley-Insterscience

Series in Discrete Mathematics and Optimization, 1995.

[24] D. Johnson, C. Aragon, L. McGeoch and C. Schevon, “Optimization

by Simulated Annealing: An Experimental Evaluation; Part II, Graph

Coloring and Number Partitioning,” Operations Research, 39(3), May–

June 1991, pp. 378–406.

[25] D. S. Johnson and M. A. Trick (Editors), Cliques, Coloring and Satisfia-

bility – Second DIMACS Implementation Challenge 1993, DIMACS Se-

ries in Discrete Mathematics and Theoretical Computer Science, Amer-

ican Mathematical Society, Volume 26 (1996).

[26] G. Lewandowski, A. Condon, “Experiments with Parallel Graph Color-

ing Heuristics and Applications of Graph Coloring”, Cliques, Coloring

and Satisfiability – Second DIMACS Implementation Challenge 1993,

American Mathematical Society, Volume 26 (1996), pp. 309-334.

[27] F. T. Leighton, “A Graph Coloring Algorithm for Large Scheduling

Problems”, Journal of Research of the National Bureau of Standards,

84(6), 1979, pp. 489–506.

Page 28: An Ant System Algorithm for Coloring Graphs

REFERENCES 22

[28] V. Maniezzo and A. Carbonaro, “Ant Colony Optimization: An

Overview”, Essays and Surveys in Metaheuristics, C. Ribeiro editor,

Kluwer Academic Publishers, 2001, pp. 21–44.

[29] K. Mizuno, S. Nishihara, “Toward Ordered Generation of Exceptionally

Hard Instance for Graph 3-Colorability”, Computational Symposium on

Graph Coloring and its Generalizations, COLOR02, Cornell University,

September 2002.

[30] C. Morgenstern, “Distributed Coloration Neighborhood Search”,

Cliques, Coloring and Satisfiability – Second DIMACS Implementation

Challenge 1993, American Mathematical Society, Volume 26 (1996), pp.

335–358.

[31] V. Phan, S. Skiena, “Coloring Graphs with a General Heuristic Search

Engine” Computational Symposium on Graph Coloring and its Gener-

alizations, COLOR02, September 2002.

[32] T. White, B. Pagurek, F. Oppacher, “ASGA: Improving the Ant System

by Integration with Genetic Algorithms”, Proceedings of the 3rd Confer-

ence on Genetic Programming (GP/SGA 98), July 1998, pp. 610–617.