fortran subroutines for approximate solution of maximum independent

0 downloads 0 Views 210KB Size Report
Apr 10, 1997 - reported, illustrating solution quality as a function of running time. Key words. ... a minimum vertex cover of a graph, and all three problems are NP-hard 6]. Further- ..... maxitr: maximum number of GRASP iterations (integer).
FORTRAN SUBROUTINES FOR APPROXIMATE SOLUTION OF MAXIMUM INDEPENDENT SET PROBLEMS USING GRASP M.G.C. RESENDEy , T.A. FEOz , AND S.H. SMITHx

Abstract. Let = ( ) be an undirected graph, where and are the sets of vertices and edges of , respectively. A subset of the vertices  is independent if all of its members are pairwise nonadjacent, i.e. have no edge between them. A solution to the NP-hard maximum independent set problem is an independent set of maximum cardinality. This paper describes a set of FORTRAN subroutines to nd an approximate solution of a maximum independent set problem. A greedy randomized adaptive search procedure (GRASP) is used to produce the solutions. The design and implementation of the code are described in detail, and computational experiments are reported, illustrating solution quality as a function of running time. G

V; E

V

G

S

E

V

Key words. Combinatorial optimization, maximum independent set, maximum clique, local search, GRASP, FORTRAN subroutines

1. Introduction. Let G = (V; E ) be an undirected graph with vertex set V and edge set E . Vertices u; v 2 V are nonadjacent if (u; v) 62 E . A subset of the vertices S  V is independent if all vertices in S are pairwise nonadjacent. In the maximum independent set problem one wants to nd an independent set having the largest cardinality. Finding a maximum independent set is equivalent to nding a maximum clique or a minimum vertex cover of a graph, and all three problems are NP -hard [6]. Furthermore, given  > 0, the size of the maximum independent set cannot be approximated within a factor of jV j unless P = NP [1]. Nevertheless, since practical applications of these three problems are abundant [9], and many instances are larger than what can be handled by exact methods [3, 7], good approximate solutions are often needed and one usually resorts to heuristics. One such heuristic for the maximum independent set problem is the greedy randomized adaptive search procedure (GRASP) introduced by Feo, Resende, and Smith [5]. GRASP [4] is an iterative sampling method for nding approximate solutions to combinatorial optimization problems. GRASP iterations are repeated, each iteration nding an approximate solution to the problem. The best solution found, over all GRASP iterations, is returned by the method as the GRASP solution. Each GRASP iteration is made up of two phases. The rst phase, called the construction phase, builds a solution with the guidance of a greedy function. With the randomization used in the algorithm, the construction phase solution is rarely greedy. In the second phase, called the local search phase, the neighborhood of the constructed solution is searched for an improved solution. Figure 1.1 shows pseudo-code for a greedy algorithm for the maximum independent set problem. The algorithm initializes the working graph G~ = (V~ ; E~ ) to be the original graph, and sets the independent set empty (line 1). The independent set is built up in the loop in lines 2{7. The greedy function that guides the construction is vertex degree with respect to the working graph. It selects among the working graph vertices, the one with minimum degree (line 3) and places that vertex in the  November 1996 (Revised: April 10, 1997) y AT&T Research, Florham Park, NJ 07932 USA z Optimization Alternatives, 901 S Mo Pac Expressway, Austin, x ALK Associates, 1000 Herrontown Road, Princeton, NJ 08540

1

TX 78746 USA USA

2

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

procedure greedy(V ,E ,S ) 1 V~ = V ; E~ = E ; S = ;; 2 for jV~ j > 0 ! 3 s = argminv2V~ fd(v; G~ )g; 4 S = S [ fsg; 5 V~ = V~ n fsg n fu 2 V~ j (s; u) 2 E~ g; 6 E~ = E~ n f(s; u) 2 E~ g; 7 rof end greedy; Fig. 1.1. A greedy algorithm for maximum independent set

procedure construction(V ,E ,S )

1 V~ = V ; E~ = E ; S = ;; 2 for jV~ j > 0 ! 3a d = minv2V~ fd(v; G~ )g; d = maxv2V~ fd(v; G~ )g; 3b RCL = fv 2 V~ j d(v; G~ )  d + (d ? d)g; 3c Pick s at random from RCL; 4 S = S [ fsg; 5 V~ = V~ n fsg n fu 2 V~ j (s; u) 2 E~ g; 6 E~ = E~ n f(s; u) 2 E~ g; 7 rof end construction; Fig. 1.2. GRASP construction phase

independent set (line 4). The greedy function is adaptive, since it changes with the selection of each independent vertex (lines 5{6). To transform greedy into a GRASP construction phase, all that is needed is to change line 3 of the pseudo-code, i.e. the vertex selection scheme. Let d and d be, respectively, the minimum and maximum degrees, over all working vertices, i.e. d = minv2V~ fd(v; G~ )g, where d(v; G~ ) is the degree of vertex v with respect to G~ and d = maxv2V~ fd(v; G~ )g. A restricted candidate list (RCL) for this problem is the set of vertices RCL = fv 2 V~ j d(v; G~ )  d + (d ? d)g; where the parameter , which controls the size of the RCL, is such that 0   1. The vertex selection in the GRASP construction phase is random, restricted to vertices in the RCL. Figure 1.2 shows pseudo-code for the construction phase of GRASP. The pseudocode is identical to greedy with the exception of lines 3a{3c, where the vertex selection is made. Phase 2 of GRASP is local search. To present the local search procedures implemented in this GRASP, de ne a k-tuple of vertices to be a set of k vertices of G. A (k; q)-exchange local search heuristic for the maximum independent set problem seeks to nd a larger independent set by removing all k-tuples K from the independent set S and replacing K by a q-tuple Q, such that q > k, Q \fS n K g = ;, and the resulting set Q [ fS n K g is independent.

FORTRAN Subroutines for Maximum Independent Set using GRASP

3

procedure local(V ,E ,S ,k,q)

1 for all k-tuples K  S ! 2 S~ = S n K ; 3 for all q-tuples Q  V n S~ ! 4 if S~ [ Q is independent w.r.t. G ! 5 S = S~ [ Q; 6 local(V ,E ,S ,k ,q ) 7 8 rof 9 rof end local; Fig. 1.3. GRASP local search phase

procedure grasp(V ,E ,maxitr,S ) 1 S  = ;; 2 for i = 1; : : : ; maxitr ! 3 construction(V ,E ,S ); 4 local(V ,E ,S ,k ,q ); 5 if jS j > jS j ! S  = S 6 rof end grasp;

Fig. 1.4. GRASP for Maximum Independent Set

Figure 1.3 shows pseudo-code for the local search phase of GRASP. The loop in lines 1{9 examines all k-tuples K that are subsets of the independent set S . For each such k-tuple, the loop in lines 3{8, searches for a q-tuple Q such that the K {Q exchange in S improves the size of S . If such an exchange is found, the procedure is recursively applied (line 6) on the new independent set, until the procedure determines that no exchange improves the independent set. The GRASP for maximum independent set is shown in the pseudo-code of Figure 1.4. In each of the maxitr GRASP iterations, a solution is constructed in phase 1 (line 3) and the neighborhood of that solution is searched in phase 2 (line 4). If the independent set found S is the largest so far, it is saved as S  . After the maxitr iterations, S  is output as the GRASP solution. One way to reduce the size of dense graphs and speedup the GRASP iterations is to condition on a k-tuple being in the independent set and apply GRASP to a smaller graph that remains after the conditioning. Feo, Resende, and Smith [5] suggested conditioning on k-tuples having a low degree with respect to the remaining graph. More precisely, let A(K ) be the set of vertices nonadjacent to the independent ktuple K , i.e. A(K ) = fv 2 V n K j (v; u) 62 E; u 2 K g. The freedom (K ) of k-tuple K is the number of vertices in A(K ), i.e. (K ) = jA(K )j. Let L  V be the l vertices of V having the lowest degrees. The pseudo-code in Figure 1.5 illustrates how tuples are generated. The set T is the set of k-tuples. It is initially set empty (line 1). The loop from lines 2{6 places in T all independent k-tuples. In line 7, the k-tuples are sorted in decreasing order of their freedom and the t tuples with the largest freedom are returned in T . The pseudo-code in Figure 1.6 illustrates how conditioning is implemented in a GRASP. In line 1, the t k-tuples having the greatest

4

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

procedure mktup(V ,E ,k,L,t,T ) 1 T = ;; 2 for all k-tuples K  L ! 3 if K is independent ! 4 T = T [ K; 5 6 rof 7

Keep in T the t tuples K1 ; : : : ; Kt having the largest freedom (K1 ); : : : ; (Kt );

end mktup;

Fig. 1.5. GRASP tuple generation

procedure conditioning(V ,E ,k,L,t,T ,maxitr,S ) 1 mktup(V ,E ,k,L,t,T ); 2 S  = ;; tupitr = maxitr=t; 3 for k = 1; : : : ; t ! 4 V~ = V n Kk ; E~ = E n f(u; v) j u 2 Kk or v 2 Kk g; ~ ,tupitr,S ); 5 grasp(V~ ,E 5 S = S [ Kk ; 7 if jS j > jS j ! S  = S 8 rof end conditioning; Fig. 1.6. GRASP with tuple conditioning

freedoms are generated. In line 2, the best independent set S  is initialized empty and the total number of iterations is divided among the t tuples. For each k-tuple, the loop in lines 3{8 conditions on the tuple being in the independent set and applies GRASP a smaller graph in the attempt to nd a large independent set. In line 4, the reduced graph is set up by deleting the k-tuple Kk from the vertex set, and all incident edges to Kk from the edge set. GRASP is applied to the reduced graph G~ = (V~ ; E~ ) in line 5. The independent set for the original graph is set up in line 6 by combining the independent set found by the GRASP on the reduced graph with the k-tuple. If this set is larger than the best found so far, line 7 saves it in S  . The paper is organized as follows. In Section 2, we describe the design and implementation of the set of FORTRAN subroutines distributed with the package. Usage is described in Section 3. Computational testing is presented in Section 4 and concluding remarks are made in Section 5. 2. Design and Implementation. We followed several design guidelines in the implementation of the set of subroutines. The code is written in ANSI standard FORTRAN 77 and is intended to run without modi cation on UNIX platforms (it should run on other environments without modi cation). There are no common blocks in the code and all arrays and variables are passed by parameter. The optimizer is a selfcontained set of subroutines. Input and most output, as well as array declarations and parameter settings, are done independently, outside of the optimizer module. Output in the optimizer module is controlled from outside the module. Error conditions are reported to the calling program with an errcnd variable. The distribution consists of three les: Makefile, driver.f, and gmis.f. The

FORTRAN Subroutines for Maximum Independent Set using GRASP

5

Makefile is used to produce an executable gmis in a UNIX environment. The le driver.f de nes all of the arrays and parameters to be used by the GRASP subroutine gmis.f, sets default parameter values, inputs the parameters that di er from their

default values, inputs the problem data, prints an initial report, calls the GRASP, and outputs the solution. The le gmis.f is the core of the package, with the subroutines that make up the optimizer. The following modules make up the package: program driver An example of a driver for the optimizer. Functions and/or subroutines called: deflt, readp, errprt, iniprt, gmis, and outsol. See Usage Notes. subroutine deflt Sets default values for algorithm and code parameters. Functions and/or subroutines called: None. subroutine readp Inputs problem data. Functions and/or subroutines called: None. subroutine errprt Prints error messages. Functions and/or subroutines called: None. subroutine iniprt Prints summary of algorithm and code parameters and problem dimensions. Functions and/or subroutines called: None. subroutine gmis Main subroutine to control the GRASP iterations. Functions and/or subroutines called: chkerr, mkds, mktup, mkrgrf, grspss, cpi4, insrtq, and removq. subroutine chkerr Checks if parameters have been set correctly. Functions and/or subroutines called: None. subroutine mkds Builds adjacency data structure of graph and computes vertex degrees. Functions and/or subroutines called: None. subroutine mktup Computes the list of k -tuples having freedom between  and ( ?  ), where  = minKk 2L (Kk ) and  = maxKk 2L (Kk ), where Kk is a k-tuple, L  V is the set of l vertices with the smallest degrees and (Kk ) is the freedom of the k-tuple Kk , and is a parameter such that 0   1. Functions and/or subroutines called: insrtq, removq, and tupfdm. subroutine mkrgrf Makes reduced graph my removing k -tuple from original graph. Functions and/or subroutines called: None. subroutine grspss Applies GRASP to construct independent sets. Functions and/or subroutines called: cpi4, build, gls12, and gls23. subroutine cpi4 Copies integer array. Functions and/or subroutines called: None. subroutine insrtq Inserts element into heap. Functions and/or subroutines called: None. subroutine removq Removes top element from heap. Functions and/or subroutines called: None. subroutine tupfdm Computes the freedom of a k -tuple. Functions and/or subroutines called: insrtq. subroutine build GRASP construction phase (phase 1). Functions and/or subroutines called: randp. subroutine gls12 GRASP local search phase (phase 2) using a (1; 2)-exchange.

6

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

Functions and/or subroutines called: None. GRASP local search phase (phase 2) using a (2; 3)-exchange. Functions and/or subroutines called: None. real function randp Portable pseudo-random number generator [10]. Generates an integer number in the range [0; 231 ? 1]. Functions and/or subroutines called: None. subroutine outsol Prints report of GRASP solution found and algorithm and code parameters. Functions and/or subroutines called: None. Subroutine gmis takes as input the problem data (number of vertices (nnode0), number of edges (narcs0), edges, represented by node arrays node1 and node2), GRASP algorithm and code parameters (size of set sought (look4), maximum number of GRASP iterations (maxitr), restricted candidate list parameter (alpha), tuple restriction parameter (beta), pseudo random number generator seed (seed), indicator of local search type (lstype), indicator of local search activation scheme (lswhen), dimension of tuples in conditioning (tupdim), number of vertices of lowest degrees that make up tuples (nlowdg), type of iteration summary (ittype), and a number of auxiliary arrays, and returns the largest independent set found (nkset0) and the independent set array kset0, iteration best solution was found (biter), and tuple on which best solution was found (btup). Parameters are checked for allowable values in subroutine chkerr. If all parameters have valid values, gmis proceeds in mkds to create data structures for vertex adjacency and edge incidence and to compute vertex degrees. If tuples are to be used (tupdim > 0), subroutine mktup creates a list of t tuples to be used for conditioning. For each tuple, gmis calls mkrgrf, which conditions the tuple in the independent set and reduces the graph accordingly, and grspss, which applies GRASP to the reduced graph. If the GRASP solution is the largest so far, it is saved in variable nkset0 and array nkset. If a set of size at least look4 is found, the iterations are prematurely terminated. Before returning control to the driver program, gmis sorts the vertices of the independent set array kset0. Subroutine chkerr checks if parameters alpha, beta, look4, lstype, lswhen, maxitr, tupdim, nlowdg, and seed are set to valid values. If any parameter is set incorrectly and error condition is assigned to the variable errcnd which is returned to gmis. Subroutine mkds builds data structures used by the GRASP procedure from the input graph represented by the arrays node1 and node2. A vertex adjacency list is built in iniad0, adjn0, and ptrn0. A vertex adjacency matrix (in vector form) is built in array incdij. The vertex degrees are set up in array deg0. Subroutine mktup creates a list of tuples in array tuplst. Only the nlowdg vertices having the smallest degrees are allowed to make up the tuples. The procedure enumerates all tuples of size tupdim using the nlowdg low-degree vertices. For each tuple generated, subroutine mktup calls subroutine tupfdm to compute the tuple freedom. The list of tuples contains at most maxtup tuples, such that all but one tuple has freedom between beta * (maxfdm - minfdm) and maxfdm, where minfdm and maxfdm are, respectively, the minimum and maximum freedoms over all tuples, and beta is a user speci ed parameter such that 0  beta  1. An additional tuple having the largest tuple less than beta * (maxfdm - minfdm) is also included in the list of tuples. Subroutine tupfdm computes the freedom of a tuple and inserts the values and pointers to the corresponding tuples into a heap (represented by scalar nfdmq and arrays fdmiq and fdmq). subroutine gls23

FORTRAN Subroutines for Maximum Independent Set using GRASP

7

Subroutine mkrgrf deletes from the original graph all vertices in a given tuple along with any edge emanating from those vertices. The reduced graph is returned to subroutine gmis is scalars nnode and narcs, and arrays iniad, ptrn, adjn, and deg. Arrays fwdmap and invmap map the corresponding vertices in the original and reduced graphs. Subroutine grspss applies maxitr GRASP iterations to the reduced graph produced in subroutine mkrgrf. Each GRASP iterations consists of two phases. The construction phase is done in subroutine build. If a new largest independent set is found in build, it is saved in array kset and its size is saved in scalar nkset. There are two ways that the code activates the local search procedure. This is user-speci ed according to the value of parameter lswhen. If lswhen = 1, local search is carried out every GRASP iteration. If lswhen = 0, local search is done, only if the independent set produced in the construction phase is larger than the average size of the independent sets produced in the construction phase. Another user-speci ed parameter determines which, if any, local search algorithm is used in phase 2. If parameter lstype = 0, then no local search is done. If parameter lstype = 1, the local search done is (1; 2)-exchange in subroutine gls12. If parameter lstype = 2, the local search done is (2; 3)-exchange in subroutine gls23. On return from the local search, if a new largest independent set is found, it is saved in array kset and its size is saved in scalar nkset. Subroutine build is the GRASP construction phase, where an independent set is built, one vertex at a time. The independent set is returned to subroutine grspss in array bkset and the size of the independent set is returned in scalar nbkset. Real function randp is used to produce the pseudo random number used to select an element from the restricted candidate list. The function, described in [10], takes as input an integer scalar seed having a value between 0 and 231 ? 1 and returns by parameter the scalar seed having a new value in the same range. The function also returns by value a real number having value between 0 and 1. Following Schrage [10], in build we use the integer scalar seed to generate a number nselct between 1 and nrcl as follows: nselct = 1 + seed=(2147483647=nrcl). Subroutines gls12 and gls23 perform (1; 2)-exchange local search and (2; 3)exchange local search, respectively. Both are given an independent set produced in the GRASP construction phase and return to grspss an independent set at least as large in array bkset and its size in scalar nbkset. Subroutines insrtq and removq, respectively, insert an element into a heap and remove an element out of a heap, adjusting the heap as well as the number of elements in the heap. Subroutine cpi4 copies an integer array onto another integer array. Subroutine outsol prints a report summarizing the solution process and describing the independent set found. 3. Usage. The subroutines in le gmis.f carry out the approximate optimization of the maximum independent set problem. The user interface with them is subroutine gmis, that must be called from a driver program. Subroutine gmis takes as input parameters the following: Variables needed for input:  alpha: GRASP parameter (real)  beta: conditioning parameter (real)  ittype: indicator of type of iteration report (integer)

8

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

 

{ silent { ittype = 0 { show only improvements { ittype = 1 { show all iterations { ittype = 2

look4: GRASP returns if independent set of size nnode0 is found (integer) lstype: type of local search (integer) no local search { lstype = 0 (1; 2)-exchange local search { lstype = 1 (2; 3)-exchange local search { lstype = 2 lswhen: when local search is done (integer) every GRASP iteration { lswhen = 1

at least equal to look4 

{ { {  { { only when phase 1 solution is greater than or equal to the average phase 1 solution { lswhen = 0  max2a: array dimension (= 2  maxa) (integer)  max2n2: array dimension (= 2  maxn2) (integer)  maxa: array dimension, maximum number of edges (integer)  maxitr: maximum number of GRASP iterations (integer)  maxn: array dimension, maximum number of vertices (integer)  maxn2: array dimension (= maxn  maxn) (integer)  maxt: array dimension, maximum number of tuples (integer)  maxtd: array dimension, maximum tuple dimension (integer)  narcs0: number of edges (integer)  nlowdg: number of vertices of lowest degrees used to form tuples (integer)  nnode0: number of vertices (integer)  out: FORTRAN output device number (integer)  seed: seed for random number generator 2 [0; 231 ? 1] (integer)  tupdim: tuple dimension (integer)  tuplmt: maximum number of tuples allowed (integer)

arrays needed for input:  node1: vertex 1 of edge (dimension maxa)  node2: vertex 2 of edge (dimension maxa) integer arrays needed for work:  adj: indicator array of adjacent nodes (dimension maxn2)  adjn: vertex in adjacency list (copy) (dimension max2a)  adjn0: vertex in adjacency list (original) (dimension max2a)  bkset: set of independent vertices (dimension maxn)  deg: vertex degree (copy) (dimension maxn)  deg0: vertex degree (original) (dimension maxn)  fdmiq: heap of freedom indices (dimension maxt)  fdmq: heap of freedom values (dimension maxt)  fwdmap: node i in original graph is fwdmap(i) in reduced graph (dimension maxn)  incdij: graph incidence matrix (dimension maxn2)  iniad: pointer to start of adjacency list (copy) (dimension maxn)  iniad0: pointer to start of adjacency list (original) (dimension maxn)  invmap: node i in reduced graph is invmap(i) in original graph (dimension maxn) (dimension maxn)  iq: heap of indices (dimension maxn2)  kset: set of independent nodes (dimension maxn2)

integer

FORTRAN Subroutines for Maximum Independent Set using GRASP 10 1 1 1 1 1 1 2 2 2 3 3 3 4 4 4 5 5 6 6 8

9

20 2 3 4 7 8 9 3 6 10 6 8 9 6 9 10 7 9 8 10 9

Fig. 3.1. Sample input data for small graph

 ptrn: pointer to next element of adjacency list (copy) (dimension max2a)  ptrn0: pointer to next element of adjacency list (original) (dimension max2a)  q: heap of values (dimension maxn2)  rcl: restricted candidate list (dimension maxn)  tupind: tuple indices (dimension maxtd)  tuple: list of tuples (dimension max2n2)  tuplst: list of tuples (dimension max2n2)  vtup: tuple vertices (dimension maxtd)

array needed for output: best set of independent vertices (dimension maxn) integer variables needed for output:  biter: GRASP iteration best solution was found  btup: tuple number best solution was found  errcnd: error condition  nkset0: size of best independent set The sample driver program for gmis included in the distribution, is set for graphs having at most 1000 vertices and 10000 edges. All variables and arrays needed by subroutine gmis are de ned. Subroutines deflt, readp, iniprt, outsol, and errprt are, respectively, examples of code that can be used for setting default parameter values, inputting the problem, printing an initial report, printing the nal report, and printing an error report. As an example of the input le needed by the code, as well as the output generated by it, consider the maximum independent set instance whose input le is shown in Figure 3.1. This graph has 10 nodes and 20 arcs. It is easy to verify that the cardinality of a maximum independent set of this graph is 4. To attempt to nd the

integer



kset0:

10

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

--------gmis: GRASP for Max Independent Set-----------i/o device numbers::: in : out :

5 6

memory allocation:::: max nodes : max arcs : max tuples : max tuple dim : array size (Mb):

1000 5000000 50000 5 228.4

algorithm control:::: seed : alpha : beta : look4 : maxitr :

1 0.10 0.10 10 100000

local search control: lstype : lswhen :

1 0

tuple control:::::::: nlowdg : tupdim : tuplmt :

50 0 0

output control::::::: itr summary :

silent

graph dimensions::::: nodes : arcs : density :

10 20 0.444

output-------------------------------------------------------Size of indep set : 4 Found on tuple : 1 Iteration : 1 Independent set : 2 4 5 8 : -------------------------------------------------------------gmis: terminated successfully

Fig. 3.2. Sample output of driver small sample graph

FORTRAN Subroutines for Maximum Independent Set using GRASP

11

largest independent set we set the parameter look4 to 10, the number of nodes in the graph. After 100,000 GRASP iterations, the code produced the output shown in Figure 3.2. An independent set of size 4 was found in the rst GRASP iteration. 4. Computational Results. In this section, we summarize the results of the computational testing carried out on the code. The experiments were done on a Silicon Graphics Challenge computer (196 MHz MIPS R10000 processor), with enough main memory so that swapping was never necessary. The code was compiled with the f77 compiler using ags -O3 -static -mips4. User times are reported, re ecting subroutine gmis only (input and output times are not included) and are timed with the system subroutine etime. To test the code we use a much studied class of random graphs [2]. A graph of this class, denoted by Gn;p , has n nodes and in it edge (i; j ), i; j = 1; : : : ; n; i 6= j , exists with probability p. Let Xk be a stochastic variable denoting the number of independent sets of size k in an instance of G1000;0:5 , then it is known that: E (X14 ) = 4:23  103 P (X14 = 0)  0:02 E (X15 ) = 1:70  101 P (X15 = 0)  0:18 E (X16 ) = 3:19  10?2 P (X16 = 0)  1:00 E (X17 ) = 2:18  10?5 P (X17 = 0)  1:00; i.e. it is probable that independent sets of size 15, but not 16, exist in these graphs. To illustrate the code's e ectiveness and eciency we attempt to nd independent sets of size at least 15 in several instances of G1000;0:5 . The experiment consisted of running the code on 50 randomly generated instances of G1000;0:5 generated with the FORTRAN code listed in Figure 4.1, using random number generator seeds 1; 2; : : : ; 50 for the portable random number generator of Schrage [10]. The GRASP was run 10 times on each instance, each run with a di erent random number generator seed (the seeds were 1; 2; : : : ; 10). The following parameter setting was used on all runs: maxitr = 10000, = = 0:1, look4 = 16, lstype = 1, lswhen = 0, tuplmt = 1000, nlowdg = 50, and tupdim = 2. With these settings we use tuples of dimension 2, considering the 50 lowest degree nodes for tuple generation. The number of tuples generated varied from 552 to 713, and correspondingly, the number of GRASP iterations per tuple were in the range from 140 to 181. The local search phase of GRASP was activated only when the solution constructed in phase 1 was at least as good as the average phase 1 solution. The local search algorithm used was (1; 2)-exchange. The algorithm produced independent sets of size 15 for 48 of the 50 instances. No independent set of size 16 was found. On the two instances for which no set of size 15 was found, all 10 runs found sets of size 14. Of the 480 runs on the instances where sets of size 15 were found, 12 runs found at best sets of size 14, whereas the remaining 468 runs found sets of size 15. Figures 4.2{4.3 show solution quality as a function of running times. Figure 4.2 shows the time when the rst set of a certain size is found. Figure 4.3 shows on the 480 runs for which a set of size 15 was found, the total number of runs that had found such a set by a given time. 5. Concluding remarks. In this paper we described a set of FORTRAN subroutines for nding approximate solutions of the maximum independent set problem using the greedy randomized adaptive search procedure (GRASP) introduced in Feo, Resende and Smith [5]. The subroutines described in this paper are a new implementation of the GRASP described in [5] and di er slightly from what was described there.

12

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

10 20

30

program gngrf integer maxm parameter (maxm=1000000) integer n,m,i,j,v1(maxm),v2(maxm),seed real randp,p read (5,*) n,p,seed m=0 do 20 i=1,n-1 do 10 j=i+1,n if (randp(seed).lt.p) then m=m+1 v1(m)=i v2(m)=j endif continue continue write(6,*) n,m do 30 i=1,m write (6,*) v1(i),v2(i) continue stop end real function randp(ix) integer a,p,ix,b15,b16,xhi,xalo,leftlo,fhi,k data a/16807/,b15/32768/,b16/65536/,p/2147483647/ xhi=ix/b16 xalo=(ix-xhi*b16)*a leftlo=xalo/b16 fhi=xhi*a+leftlo k=fhi/b15 ix=(((xalo-leftlo*b16)-p)+(fhi-k*b15)*b16)+k if (ix.lt.0) ix=ix+p randp=float(ix)*4.656612875e-10 return end

Fig. 4.1. FORTRAN code for random instance generation

Though independent set of size 15 were usually found in less than 100 cpu seconds for the majority of instances, they were usually not found while scanning the rst tuple. Figure 5.1 shows the distribution of tuples scanned before the rst independent set of size 15 was found. Running times can be sped up by using a parallel computer and allocating di erent tuples to di erent processors. This was done in [5] and a linear speedup was observed. If no conditioning is done, then di erent GRASP iterations can be allocated to di erent processors, as for example, was done in [8].

13

FORTRAN Subroutines for Maximum Independent Set using GRASP

indep. set size

15

    

14



13



12



11



0.1

1

10 cpu seconds (logscale)

100

1000

Fig. 4.2. Independent set size found as a function of CPU time

cum. runs for which indep. sets of size 15 were found

450 400 350 300 250 200 150 100 50 0.1

                                   1

10 cpu seconds (logscale)

100

1000

Fig. 4.3. Cumulative number of runs for which independent sets of size at least 15 have been found as a function of CPU time

14

M.G.C. RESENDE, T.A. FEO AND S.H. SMITH

r

30 frequency 20 10

r r r

rrrrrrr r rrr r rrr r r rr r rr r rr r rrr r r r r

0

100

rr r r r

rr r r r

r

r r

200

r

r

300

r

r rrr

r

rr r

400

r

r r

500

600

700

tuples scanned to nd rst independent set of size 15 Fig. 5.1. Frequency of tuples scanned to nd rst independent set of size 15

FORTRAN Subroutines for Maximum Independent Set using GRASP

15

REFERENCES [1] Arora, S., Lund, C., Motwan, R., Sudan, M., and Szegedy, M. Proof veri cation and hardness of approximation problems. In Proceedings of the 33rd IEEE Symposium on Foundations of Computer Science (October 1992), pp. 14{23. [2] Bollobas, B. Random graphs. Academic Press, 1985. [3] Carraghan, R., and Pardalos, P. An exact algorithm for the maximum clique problem. Operations Research Letters 9 (1990), 375{382. [4] Feo, T. A., and Resende, M. G. Greedy randomized adaptive search procedures. Journal of Global Optimization 6 (1995), 109{133. [5] Feo, T. A., Resende, M. G., and Smith, S. H. A greedy randomized adaptive search procedure for maximum independent set. Operations Research 42 (1994), 860{878. [6] Garey, M., and Johnson, D. Computers and intractability - A guide to the theory of NPcompleteness. W.H. Freeman and Company, 1979. [7] Johnson, D. S., and Trick, M. A., Eds. Cliques, Coloring, and Satis ability: Second DIMACS Implementation Challenge, vol. 26 of DIMACS Series on Discrete Mathematics and Theoretical Computer Science. American Mathematical Society, 1996. [8] Pardalos, P., Pitsoulis, L., and Resende, M. A parallel GRASP implementation for the quadratic assignment problem. In Parallel algorithms for irregularly structured problems, A. Ferreira and J. Rolim, Eds. Kluwer Academic Publishers, 1995, pp. 111{130. [9] Pardalos, P., and Xue, J. The maximum clique problem. Journal of Global Optimization 4 (1994), 301{328. [10] Schrage, L. A more portable Fortran random number generator. ACM Transactions on Mathematical Software 5 (1979), 132{138.

Suggest Documents