Recycling Solutions for Vertex Coloring Heuristics

01/27/2019 ∙ by Yasutaka Uchida, et al. ∙ National University Corporation Otaru University of Commerce 0

The vertex coloring problem is a well-known NP-hard problem and has many applications in scheduling. A conventional approach to the problem solves the k-colorability problem iteratively, decreasing k one by one. Whether a heuristic algorithm finds a legal k-coloring quickly or not is largely affected by an initial solution. We propose a simple initial solution generator, the recycle method, which makes use of the legal (k+1)-coloring that has been found. An initial solution generated by the method is expected to guide a general heuristic algorithm to find a legal k-coloring quickly, as demonstrated by experimental studies.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Background.

For a given graph , a coloring is an assignment of colors to the vertices in , and it is a -coloring if it uses at most colors. A coloring is legal if any two adjacent vertices are given different colors. The -colorability (-Col) problem asks whether there exists a legal -coloring for . If the answer is yes, then we say that is -colorable. The vertex coloring (VCol) problem asks for a legal -coloring for the smallest . The smallest that admits a legal -coloring is called the chromatic number of .

Due to their theoretical interest as well as possible applications, the -Col problem and the VCol problem have attracted many researchers from various areas such as discrete mathematics [1, 2], optimization [12] and scheduling [14, 16]. The -Col problem is NP-complete [7] and thus the VCol problem is NP-hard. For these problems, many exact algorithms and heuristics have been proposed so far [18].

The VCol problem is often tackled by solving the -Col problem iteratively. The iterative scheme is described as follows; starting from an appropriate integer , we search for a legal -coloring. If it is found, then we decrease by one and solve the -Col problem again. The process is repeated until a termination condition is satisfied. Finally, it outputs a legal -coloring with the smallest among those found by then.

A typical heuristic algorithm for the -Col problem searches a solution space that contains illegal -colorings as well as legal -colorings, or that contains partial -colorings. As a clue of the solution search, the algorithm uses a penalty function that evaluates a solution by how far it is from the legality. Whether a legal -coloring is found quickly or not heavily depends on an initial solution, or of an initial population of solutions.

Proposal.

In the present paper, we propose a simple but effective method, named the recycle method, for generating an initial solution for the -Col problem. Suppose solving the -Col problem after a legal -coloring is found. The proposed method generates an initial solution by modifying this legal -coloring. More precisely, it chooses some of the colors and then recolors all vertices that have the chosen colors so that one of the colors disappears from graph. Consequently, we have a -coloring although it must be illegal in general. We use it as an initial solution of a heuristic algorithm for the -Col problem.

Related studies.

To determine the “first” initial solution, we may employ various constructive algorithms in the literature such as a random coloring, a greedy method, Dsatur [4], Rlf [14], Danger [8], and GRASP [13]. However, most of the previous studies hardly pay attention to how to generate an initial solution for the -Col problem during the iterative scheme; they utilize a random -coloring or a simple greedy method. For example, Lewis et al. [15] stated that “the method of initial solution generation is not critical” in Tabucol’s performance, where Tabucol [11] is a well-known tabu search algorithm in the literature. We claim that, however, it could draw critical difference in many instances.

In previous studies, an initial solution is constructed randomly or by the greedy method from scratch, where the legal -coloring that has been found is ignored. The fewer becomes, the poorer solutions must be generated because the -Col problem tends to be harder when gets close to the chromatic number [19]. Existing algorithms dispose of a legal -coloring, as it were, which is precious itself especially when is small to some extent. The recycle method makes use of it to generate an initial solution. Although the idea is simple, the recycle method accelerates improvement of the color number significantly, especially in an early stage of the iterative scheme. Moreover, Tabucol with the recycle method can achieve a smaller color number than Tabucol with the greedy initial solution generator.

Organization of the paper.

We prepare notations and terminologies in Section 2. The recycle method is assumed to be used as an initial solution generator of any heuristic for the -Col problem, in the iterative scheme for the VCol problem. We review the iterative scheme for the VCol problem and major search strategies for the -Col problem in Section 3. In Section 4, we overview the recycle method and describe how we use it as an initial solution generator of a heuristic algorithm for the -Col problem. We also derive upper bounds on penalty values for some configurations of the recycle method. In Section 5, we demonstrate the effectiveness of the recycle method by computational studies on 20 hard DIMACS instances, followed by concluding remark in Section 6.

2 Preliminaries

For a positive integer , let . For a given graph , we represent a -coloring by a function . If holds for some , then we say that vertices and and an edge are conflicting. A coloring is legal if holds whenever , and otherwise, it is illegal. For , let be is the set of vertices that are given a color , that is, . We call the color class of a color . By , the vertex set is partitioned into . Each color class is an independent set (i.e., no two vertices in the set are adjacent) iff is legal. The chromatic number of , denoted by , is the smallest that admits a legal -coloring.

3 Iterative Scheme for the Vertex Coloring Problem

We describe the conventional iterative scheme for solving the VCol problem as follows.

1:Construct a legal coloring by a constructive method (e.g., Dsatur).
2:the number of colors used in .
3:loop
4:     .
5:     Search for a legal -coloring (i.e., solve the -Col problem) until a termination condition is satisfied; if the condition is satisfied during the search, then break the loop.
6:end loop
7:Output the legal -coloring that was found in the above.

To search for a legal -coloring in line 5, the search space and the penalty function must be defined. The penalty function evaluates a -coloring in by how far is from the legality. It is defined so that iff is legal. Then the -Col problem is reduced to the problem of minimizing the penalty function within the search space. To reach to a legal -coloring as soon as possible, if one exists, it is important to start the search with a good initial solution.

For the -Col problem, two search strategies are well-known in the literature [6].

-fixed penalty.

In this strategy, the solution space is the set of all possible -colorings. We may call a -coloring complete when we emphasize contrast to a “partial” -coloring that is introduced below. We denote the set of complete -colorings by . To evaluate , the number of conflicting edges would be a natural penalty function. Denoted by , it is defined to be .

Tabucol [11] is a well-known tabu search algorithm that employs the search strategy. It explores the search space , using as the penalty function. Although it was born more than 30 years ago, the algorithm and its extension are still used as subroutines in modern metaheuristics [5, 6, 17, 9, 22, 20].

-fixed partial legal.

The search space is the set of what we call partial -colorings. Let us denote by a dummy color. We define a partial -coloring to be a function such that, for every edge , holds whenever . In other words, a partial -coloring admits uncolored vertices, which are represented by , but does not admit conflicting edges. We denote the set of partial -colorings by . It is natural to evaluate a partial -coloring by the number of uncolored vertices. Denoted by , this penalty function is defined to be .

The search strategy was first introduced by Morgenstern [21]. Blöchliger and Zufferey [3] proposed a tabu search algorithm named Partialcol based on the search strategy. Their intensive experimental studies show that it is competitive with Tabucol.

4 Recycle Method

By the recycle method, we mean any method that constructs a -coloring from a given -coloring, as an initial solution for the -Col problem which is assumed to be solved in the iterative scheme for the VCol problem. When we solve the -Col problem, the -Col problem has already been solved, and thus a legal -coloring is available.

Describing the motivation in Section 4.1, we sketch the algorithm to generate an initial solution in Section 4.2. We conduct theoretical analyses on penalty values in Section 4.3.

4.1 Motivation

For the -Col

 problem, it is known that easy-hard-easy phase transition exists with respect to

 [10, 19]. The peak of difficulty is said to lie around . In the iterative scheme, as gets smaller, the -Col problem must be harder. A conventional greedy method must yield a poor initial solution for such .

On the other hand, a legal -coloring should be precious; it is a solution that one cannot obtain easily. We expect that a “good” -coloring could be obtained by slight modification of the legal -coloring. In fact, when is small enough, most of color classes in a legal -coloring are large independent sets while some color classes could be small. For example, Table 1 shows the distribution of color class sizes in a good solution for the C2000.5 instance that is found by Wu and Hao [22]. We expect that, even though some color classes are recolored arbitrarily so that there remain at most colors, we could obtain a -coloring whose penalty value is small enough.

Size of color class Total
8 9 10 11 12 13 14 15 16
Number 2 4 15 10 16 14 14 18 53 146
Table 1: The distribution of color class sizes in a solution for the C2000.5 instance [22]; the current best known number is 145 [9]

4.2 Algorithm

We provide a rough sketch of the recycle method to generate a -coloring from a given legal -coloring, which we denote by . We consider the two search strategies that we mentioned in Section 3.

-fixed penalty:

The input of the recycle method is , where is a nonempty color subset and is a color. For every and , we change the color of to a color in . Because the color disappears and there remain at most colors, we have a -coloring by degenerating the region to .

-fixed partial legal:

The input of the recycle method is a nonempty subset . For every and , we assign to . Again, because there remain at most colors and a dummy color , we have a partial -coloring by degenerating the region to .

We have freedom in designing details of the recycle method. In both strategies, the subset may be chosen randomly, or a set of colors whose color classes are smallest. In the -fixed penalty, the color to be removed is chosen at random or can be a color whose color class is the smallest. We can change the color of a vertex in into one in arbitrarily.

The recycle method is efficient and easy to implement. For example, let be a color such that is a smallest color class in a legal -coloring . If we use , then it takes time to determine . When we employ the -fixed penalty strategy, we have . To recolor the vertices in the color class , random recoloring requires time and the greedy method (described in the next subsection) takes time.

Although the recycle method is quite simple, we have not seen the similar idea in all booklets and papers in the reference list that we believe mostly cover the algorithmic research of the VCol problem.

4.3 Upper Bounds on Penalty Values

Interestingly, our expectation that the recycle method should be helpful for a heuristic algorithm is partly supported by theoretical analyses. For some configurations of the recycle method, we can derive an upper bound on the penalty value, with respect to the graph size and .

We denote a given legal -coloring by . Without loss of generality, we assume that is a smallest color class, that is, holds for any .

-fixed penalty.

We consider a configuration of the recycle method such that the smallest color class is recolored, that is, and . The color that is assigned to may be chosen randomly from , or by a greedy method, that is, a color that produces fewest conflicting edges is assigned to . In each case, we can derive an upper bound on the penalty value. Let us define to be the set of -colorings that are obtained by recoloring vertices in , that is,

For any -coloring , we can derive an upper bound on the penalty value .

Proposition 1

Let be a legal -coloring such that holds for any . Any satisfies .

Proof: Because is a partition of and is a smallest set among them, we have . We claim that no edge should exist for because is independent, and that every edge between and (, ) is not conflicting in because . Then every conflicting edge in is incident to a vertex in . Because the degree of a vertex is at most , the number of edges incident to vertices in is at most .  

We compare with a completely random -coloring such that every vertex is colored by

with probability

. Because each edge is conflicting with probability , the expectation of is from its linearity. Any has a penalty value at most , which may be comparable to .

We can derive a better upper bound on the penalty value of the -coloring that is constructed by the greedy method, that is, we choose the color of each so that fewest conflicting edges are produced. The upper bound is , which is smaller than the above bound by a factor of .

Proposition 2

Let be a legal -coloring such that holds for any . There is such that .

Proof: Because is a legal -coloring, any neighbor of a vertex is assigned a color in . There is a color in that appears at most times among the ’s neighborhood. To recolor , we let , which counts at most conflicting edges. Since , we have .  

Note that, in the proof, the -coloring is obtained by the greedy method.

-fixed partial legal.

We consider the recycle method with . That is, we generate a partial -coloring from a legal -coloring by assigning the dummy color to a smallest color class whereas the other color classes remain the same. Also in this case, we can derive an upper bound on the penalty value.

Proposition 3

Let be a legal -coloring such that holds for any . and be a partial -coloring such that for all and for all . It holds that .

Proof: The bound is due to .  

Again, let us compare with a random partial -coloring, say , that is constructed as follows; we first assign a random color from to every vertex in . Then, while there is a conflicting edge, we repeat removing the color of a conflicting vertex (i.e., is assigned to the vertex). Because the expected number of conflicting edges is , the expected penalty value is at most , while our partial -coloring attains .

5 Computational Studies

In this section, we present computational results to show how the recycle method is effective, in comparison with the conventional greedy method, as an initial solution generator of Tabucol [11] and Partialcol [3] in the iterative scheme. Recall that Tabucol employs the -fixed penalty strategy whereas Partialcol employs the -fixed partial strategy.

5.1 Initial Solution Generators

We summarize the initial solution generators to be compared.

Recycle method.

Given the number of colors and a legal -coloring , we consider two types of initial solution generators based on the recycle method. One is to choose a color whose color class is the smallest (i.e., for ) and let . In the -fixed penalty strategy, is automatically set to . Vertices in are recolored to ones in randomly (-fixed penalty) or to (-fixed partial). We denote by this initial solution generator.

The other is to choose colors from at random, say , and let . The in the -fixed penalty strategy is set to without loss of generality. Vertices in are recolored to ones in randomly (-fixed penalty) or to (-fixed partial). We denote by this initial solution generator. In the experiments, we set to 1, 2 and 3.

Greedy method.

Given the number of colors, the greedy method visits the vertices in a random order. For a visited vertex , if there is a color such that assigning to does not produce a conflicting edge, then we assign the smallest to . Otherwise, we assign a random color in to (-fixed penalty) or leave uncolored (-fixed partial). We denote by Gr the initial solution generator.

5.2 Experimental Settings

We downloaded the source codes of Tabucol and Partialcol (written in C) from R. Lewis’s website (http://rhydlewis.eu/resources/gCol.zip). In the program, Gr is used as the initial solution generator for the -Col problem. We rewrote the source codes so that and are available for the initial solution generators.

For the termination condition of the iterative scheme (see Section 3), we set the upper limit of computation time to 600 seconds. In line 1 of the iterative scheme, the first initial solution is constructed by Dsatur [4]. Both Tabucol and Partialcol are tabu search algorithms. The tabu tenure is set to , where , is the number of conflicting vertices, and is an integer that is picked up from at uniform random. This setting of the tabu tenure is recommended in the literature [5, 3, 15].

For benchmark instances, we take 20 DIMACS instances that are regarded as hard in [3]. The instance names are shown in Table 2, where the number after the first alphabets represents the number of vertices (e.g., the DSJC1000.5 instance consists of 1000 vertices). The 20 instances are downloadable from https://mat.gsia.cmu.edu/COLOR/instances.html. Each instance is solved 50 times with different random seeds.

All the experiments are conducted on a workstation that carries an Intel Core i7-4770 Processor (up to 3.90GHz by means of Turbo Boost Technology) and 8GB main memory. The installed OS is Ubuntu 16.04.

5.3 Results

Due to space limitation, we show results only for Tabucol. We guarantee that we observed similar results for Partialcol. We also observed that computation time of the initial solution generators is negligible in comparison with the tabu search.

Penalty values.

We have claimed that the recycle method should generate a good initial solution. We show that the claim is true in terms of penalty value, by using an illustrative example.

In Fig. 1, we show penalty values of initial solutions of Tabucol with different initial solution generators. The figure shows the result for the DSJC1000.5 instance, and we observed similar tendencies for others.

Figure 1: Penalty values of initial solutions for the DSJC1000.5 instance. The maximum color number of the first initial solution is 118. Hence, for , neither the recycle method nor the greedy method is applied. We let the penalty value be zero for convenience.

In the figure, the horizontal axis indicates the number of colors, whereas the vertical axis indicates the penalty value (average over 50 trials) of an initial solution. Apparently, the greedy method yields worse initial solutions than the recycle method. When gets smaller, the penalty value of the greedy method is increasing more and more. On the other hand, the penalty values of the recycle method do not make a remarkable change comparatively. Among the recycle method, the penalty value of , which recolors most vertices, is the largest in general, followed by , , and .

Speed of improvement.

Next, we show that the recycle method could accelerate the solution search. In Fig. 2, we show how the color number is improved along with computation time. The horizontal axis indicates computation time (average over trials), and the vertical axis indicates . As shown, Tabucol with the recycle method finds legal -colorings for faster than Tabucol with the greedy method.

Figure 2: Improvement of with respect to computation time for the DSJC1000.5 instance

Note that or does not find a legal 88-coloring in the 50 trials although it finds a legal 89-coloring faster than the greedy method. When is small to some extent, an initial solution generated by the recycle method can be a stagnated locally optimal solution in the search space. In such a case, we hardly see merit of the recycle method. We may say that, however, the recycle method could improve faster than the greedy method, especially in early iterations of the iterative scheme.

Solution quality.

Finally, we compare the smallest color number attained by different initial solution generators. We show the results in Table 2, where we omit due to space limitation. We note that their results are competitive with . For instances such that is not equal between and Gr, we indicate the smaller by boldface. The column “first” indicates the averaged color number of the first initial solution constructed by Dsatur. The column “Greedy” indicates the color number attained by Tabucol in the experiments in [3], where the time limit is set to 3600 seconds. Note that Tabucol in [3] utilizes the greedy method for generation of initial solutions for the -Col problem as well as the first initial solution, whereas we employ Dsatur to generate the first initial solution.

First initial solution generator
Dsatur Greedy
Instance first Gr
DSJC1000.1 26.1 20 (6) 20 (4) 20
DSJC1000.5 115.7 88 (3) 88 (2) 89
DSJC1000.9 301.8 225 (6) 226 (32) 227
DSJC500.1 15.7 12 (50) 12 (50) 12
DSJC500.5 65.2 49 (13) 49 (8) 49
DSJC500.9 164.4 126 (2) 126 (1) 127
DSJR500.1c 88.7 86 (11) 88 (7) 85
DSJR500.5 130.2 124 (4) 127 (1) 126
R1000.1c 105.2 98 (33) 98 (11) 98
R1000.5 250.0 240 (4) 247 (1) 249
R250.1c 65.3 64 (26) N/A 66
R250.5 67.1 66 (35) 66 (3) 67
flat1000500 114.4 50 (50) 56 (2) 50
flat1000600 114.4 60 (50) 73 (2) 60
flat1000760 114.5 87 (1) 87 (2) 88
flat300280 42.0 28 (4) 30 (1) 31
le45015c 23.7 15 (2) 15 (3) 16
le45015d 24.2 16 (50) 16 (49) 15
le45025c 29.0 26 (50) 26 (50) 26
le45025d 28.6 26 (50) 26 (50) 26
Table 2: Smallest color numbers attained by Tabucol with two initial solution generators and Gr. The N/A means that no improvement is made from the first initial solution. Parentheses indicate the number of trials in which is attained.

As indicated by boldface, in eight instances (i.e., DSJC1000.9, DSJR500.1c, DSJR500.5, R1000.5, R250.1c, flat1000500, flat1000600 and flat300280), the recycle method attains that cannot be achieved by Gr. The recycle method is competitive with or even better than the results of Tabucol in [3], except DSJR500.1c and le45015d, which are obtained for the time limit of 3600 seconds, six times longer than ours.

Let us emphasize that, in the R1000.5 instance, the recycle method achieves . We claim that this number should be outstanding for local search algorithms such as Tabucol and Partialcol. These algorithms achieve just at best in more intensive experiments in [3], where the time limit is set to 10 hours, 60 times longer than ours. Admitting that different computers are used in the experiments, we dare to claim that the recycle method should be more helpful for local search algorithms to find a legal coloring efficiently.

There are some instances such that the recycle method is less effective. For example, in the flat1000760 and le45015c instances, the greedy method Gr yields the smallest more frequently than the recycle method . However, the difference in the two instances seems less significant than in the above eight instances.

6 Concluding Remark

In the present paper, we proposed the recycle method, an initial solution generator of a general heuristic algorithm for the -Col problem that is assumed to be solved in the iterative scheme. Experimental results show that the recycle method accelerates improvement of the color number in early iterations of the iterative scheme, in comparison with the conventional greedy method. Moreover, the recycle method can make the algorithms achieve a smaller color number than the greedy method. We also analyzed upper bounds on the penalty value for some configurations of the recycle method.

Our future work includes application of the recycle method to population based methods (i.e., multi-solution search) such as genetic algorithms. Most of state-of-the-art heuristic algorithms that are shown to be effective employ population based methods 

[22, 20].

The recycle method generates an initial solution efficiently, and its implementation is quite easy. We hope that the recycle method serves as a standard initial solution generator for the -Col problem in the iterative scheme.

References

  • [1] K. Appel and W. Haken. Every planar map is four colorable. Bulletin of the American Mathematical Society, 82(5):711–712, 1976.
  • [2] K. Appel, W. Haken, and J. Koch. Every planar map is four colorable. Part II: Reducibility. Illinois Journal of Mathematics, 21(3):491–567, 1977.
  • [3] I. Blöchliger and N. Zufferey. A graph coloring heuristic using partial solutions and a reactive tabu scheme. Computers & Operations Research, 35:960–975, 2008.
  • [4] D. Brélaz. New methods to color the vertices of a graph. Communications of the ACM, 22(4):251–256, 1979.
  • [5] P. Galinier and J.K. Hao.

    Hybrid evolutionary algorithms for graph coloring.

    Journal of Combinatorial Optimization

    , 3:379–397, 1999.
  • [6] P. Galinier and A. Hertz. A survey of local search methods for graph coloring. Computers & Operations Research, 33(9):2547–2562, 2006.
  • [7] M.R. Garey and D.S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Company, 1979.
  • [8] F. Glover, M. Parker, and J. Ryan. Coloring by tabu branch and bound. In D.S. Johnson and M. Trick, editors, Cliques, Coloring, and Satisfiability: Second DIMACS Implementation Challenge, volume 26. American Mathematical Society, 1996.
  • [9] J.K. Hao and Q. Wu. Improving the extraction and expansion method for large graph coloring. Discrete Applied Mathematics, 160(16):2397–2407, 2012.
  • [10] F. Herrmann and A. Hertz. Finding the chromatic number by means of critical graphs. Journal of Experimental Algorithmics, 7:10–, 2002.
  • [11] A. Hertz and D. de Werra. Using tabu search techniques for graph coloring. Computing, 39(4):345–351, 1987.
  • [12] B. Korte and J. Vygen. Combinatorial Optimization: Theory and Algorithms. Springer Publishing Company, Incorporated, 5th edition, 2012.
  • [13] M. Laguna and R. Marti. A GRASP for coloring sparse graphs. Computational Optimization and Applications, 19:165–178, 2001.
  • [14] F.T. Leighton. A graph coloring algorithm for large scheduling problems. Journal of Research of the National Bureau of Standards, 84:489–503, 1979.
  • [15] R. Lewis, J. Thompson, C. Mumford, and J. Gillard. A wide-ranging computational comparison of high-performance graph colouring algorithms. Computers & Operations Research, 39(9):1933–1950, 2012.
  • [16] R.M.R. Lewis. A Guide to Graph Colouring: Algorithms and Applications. Springer, Cham, Switzerland, 2016.
  • [17] Z. Lu and J.K. Hao. A memetic algorithm for graph coloring. European Journal of Operational Research, 203:241–250, 2010.
  • [18] E. Malaguti and P. Toth. A survey on vertex coloring problems. International Transactions in Operational Research, 17:1–34, 2010.
  • [19] Z. Mann. Complexity of coloring random graphs: An experimental study of the hardest region. Journal of Experimental Algorithmics, 23(1.3):1–19, 2018.
  • [20] L. Moalic and A. Gondran. Variations on memetic algorithms for graph coloring problems. Journal of Heuristics, 24:1–24, 2018.
  • [21] C. Morgenstern. Distributed coloration neighborhood search. Discrete Mathematics and Theoretical Computer Science, 26:335–358, 1996.
  • [22] Q. Wu and J.K. Hao. Coloring large graphs based on independent set extraction. Computers & Operations Research, 39(2):283–290, 2012.