Elementary Landscape Decomposition of the Test Suite Minimization Problem
Abstract
Landscape theory provides a formal framework in which combinatorial optimization problems can be theoretically characterized as a sum of a special kind of landscape called elementary landscape. The decomposition of the objective function of a problem into its elementary components provides additional knowledge on the problem that can be exploited to create new search methods for the problem. We analyze the Test Suite Minimization problem in Regression Testing from the point of view of landscape theory. We find the elementary landscape decomposition of the problem and propose a practical application of such decomposition for the search.
Full text
Elementary Landsap e Deomp osition of the Test Suite Minimization Problem Franiso Chiano, Javier Ferrer, and Enrique Alba University of Malaga, Spain, f hiano,ferrer,alba g l.uma.e s Abstrat. Landsap e theory provides a formal framework in whih ombinatorial optimization problems an b e theoretially haraterized as a sum of a speial kind of landsape alled elementary landsape. The de- omp osition of the ob jetive funtion of a problem into its elementary omp onents provides additional knowledge on the problem that an b e exploited to reate new searh metho ds for the problem. We analyze the Test Suite Minimization problem in Regression Testing from the p oint of view of landsape theory. We nd the elementary landsap e de- omp osition of the problem and propose a pratial appliation of suh deomp osition for the searh. Keywords: Fitness landsap es, test suite minimization, regression testing, elementary landsap es 1 Intro dution The theory of landsap es fouses on the analysis of the struture of the searh spae that is indued by the ombined inuenes of the ob jetive funtion of the optimization problem and the hoie neighb orho o d operator [8℄. In the eld of ombinatorial optimization, this theory has been used to haraterize optimization problems and to obtain global statistis of the problems [11℄. However, in reent years, researhers have been interested in the appliations of landsap e theory to improve the searh algorithms [5℄. A landsape for a ombinatorial optimization problem is a triple ( X ; N ; f ), where f : X 7! R denes the ob jetive funtion and the neighborhood operator funtion N ( x ) generates the set of p oints reahable from x 2 X in a single appliation of the neighborho o d operator. If y 2 N ( x ) then y is a neighb or of x . There exists a speial kind of landsap es, alled elementary landsapes , whih are of partiular interest due to their prop erties [12℄. We dene and analyze the elementary landsapes in Setion 2, but we an advane that they are hara- terized by the Grover's wave equation : avg f f ( y ) g y 2 N ( x ) = f ( x ) + d f f ( x ) where d is the size of the neighb orho o d, j N ( x ) j , whih we assume is the same for all the solutions in the searh spae, f is the average solution evaluation over
the entire searh spae, is a harateristi onstant and avg f f ( y ) g y 2 N ( x ) is the average of the ob jetive funtion f omputed in its neighb orho o d: avg f f ( y ) g y 2 N ( x ) = 1 j N ( x ) j X y 2 N ( x ) f ( y ) (1) For a given problem instane whose ob jetive funtion is elementary, the values f and an b e easily omputed in an eÆient way, usually from the problem data. Thus, the wave equation makes it possible to ompute the average value of the tness funtion f evaluated over all of the neighbors of x using only the value f ( x ), without evaluating any of the neighb ors. This means that in elementary landsapes we get additional information from a single solution evaluation. We get an idea of what is the quality of the solutions around the urrent one. This information an b e used to design more lever searh strategies and op erators whih eetively use the information. Lu et al. [5℄ provide a nie example of the appliation of the landsap e analysis to improve the p erformane of a searh metho d. In their work, the performane of the Sampling Hill Climbing is improved by avoiding the evaluation of non-promising solutions. The average tness value in the neighborho o d of the solutions omputed with (1) is at the ore of their prop osal. When the landsape is not elementary it is always p ossible to write the objetive funtion as a sum of elementary omponents, alled elementary landsape deomposition of a problem [1℄. Then, Grover's wave equation an be applied to eah elementary omponent and all the results are summed to give the average tness in the neighb orho o d of a solution. Furthermore, for some problems the average annot be limited to the neighborho o d of a solution, but it an b e extended to the seond-order neighrb ors (neighb ors of neighb ors), third-order neighbors, and, in general, to any arbitrary region around a given solution, inluding the whole searh spae. Sutton et al. [10℄ show how to ompute the averages over spheres and bal ls of arbitrary radius around a given solution in p olynomial time using the elementary landsap e deomp osition of real-valued funtions over binary strings. In [9℄ they prop ose a metho d that uses these averages over the balls around a solution to esap e from plateaus in the MAXk -SAT problem. The empirial results notied an improvement when the metho d was applied. Langdon [4℄ also analyzed the spheres of arbitrary radius from the point of view of landsap e theory, highlighting that the Walsh funtions are eigenvetors of the spheres and the mutation matrix in GAs. If we extend the landsap e analysis of the ob jetive funtion f to their powers ( f 2 , f 3 , et.), Grover's wave equation allows one to ompute higher-order moments of the tness distribution around a solution and, with them, the variane, the skewness and the kurtosis of this distribution. Sutton et al. [10℄ provide an algorithm for this omputation. We analyze here the Test Suite Minimization problem in regression testing from the p oint of view of landsap e theory. This software engineering problem onsists in seleting a set of test ases from a large test suite that satises a given ondition, like maximizing the overage and minimizing the orale ost [13℄.
The remainder of the pap er is organized as follows. In Setion 2 we present the mathematial tools required to understand the rest of the paper and Se- tion 3 formally denes the Test Suite Minimization problem. Setion 4 presents the two main ontributions: the elementary landsape deomp osition of the objetive funtion of the problem and its square. We provide losed-form formulas for b oth f and f 2 . In the mathematial development we inlude a novel appliation of the Krawthouk matries to the landsap e analysis. Setion 5 proposes an appliation of the deomp ositions of f and f 2 and presents a short exp erimental study showing the b enets (and drawbaks) of the prop osal. Finally, with Setion 6 we onlude the paper. 2 Bakground In this setion we present some fundamental results of landsap e theory. We will only fo us on the relevant information required to understand the rest of the pap er. The interested reader an deep en on this topi in [7℄. Let ( X ; N ; f ) b e a landsap e, where X is a nite set of solutions, f : X ! R is a real-valued funtion dened on X and N : X ! P ( X ) is the neighborho o d op erator. The adjaeny and degree matries of the neighb orho o d N are dened as: A xy = 1 if y 2 N ( x ) 0 otherwise ; D xy = j N ( x ) j if x = y 0 otherwise (2) We restrit our attention to regular neighb orho o ds, where j N ( x ) j = d > 0 for a onstant d , for all x 2 X . Then, the degree matrix is D = dI , where I is the identity matrix. The Laplaian matrix asso iated to the neighb orho o d is dened by = A D . In the ase of regular neighb orho o ds it is = A dI . Any disrete funtion, f , dened over the set of andidate solutions an b e haraterized as a vetor in R j X j . Any j X j j X j matrix an b e interpreted as a linear map that ats on vetors in R j X j . For example, the adjaeny matrix A ats on funtion f as follows A f = 0 B B B P y 2 N ( x 1 ) f ( y ) P y 2 N ( x 2 ) f ( y ) . . . P y 2 N ( x j X j ) f ( y ) 1 C C C A ; ( A f )( x ) = X y 2 N ( x ) f ( y ) (3) Thus, the omp onent x of ( A f ) is the sum of the funtion value of all the neighb ors of x . Stadler denes the lass of elementary landsapes where the funtion f is an eigenvetor (or eigenfuntion) of the Laplaian up to an additive onstant [8℄. Formally, we have the following Denition 1. Let ( X ; N ; f ) be a landsape and the Laplaian matrix of the onguration spae. The funtion f is said to be elementary if there exists a onstant b , whih we al l oset , and an eigenvalue of suh that ( )( f b ) = ( f b ) . The landsape itself is elementary if f is elementary.
We use instead of in the denition to avoid negative eigenvalues. In onneted neighb orho o ds (the ones we onsider here) the oset b is the average value of the funtion over the whole searh spae: b = f . Taking into aount basi results of linear algebra, it an b e proved that if f is elementary with eigenvalue , af + b is also elementary with the same eigenvalue . Furthermore, in regular neighborho o ds, if g is an eigenfuntion of with eigenvalue then g is also an eigenvalue of A , the adjaeny matrix, with eigenvalue d . The average value of the tness funtion in the neighb orho o d of a solution an b e omputed using the expression avg f f ( y ) g y 2 N ( x ) = 1 d ( A f )( x ). If f is an elementary funtion with eigenvalue , then the average is omputed as: avg f f ( y ) g y 2 N ( x ) = avg y 2 N ( x ) f f ( y ) f g + f = 1 d ( A ( f f ))( x ) + f = d d ( f ( x ) f ) + f = f ( x ) + d ( f f ( x )) and we get Grover's wave equation. In the previous expression we used the fat that f f is an eigenfuntion of A with eigenvalue d . The previous denitions are general onepts of landsap e theory. Let us fo us now on the binary strings with the one-hange neighb orho o d, whih is the representation and the neighborho o d we use in the test suite minimization problem. In this ase the solution set X is the set of all binary strings of size n . Two solutions x and y are neighb oring if one an b e obtained from the other by ipping a bit, that is, if the Hamming distane b etween the solutions, denoted with H ( x; y ), is 1. We dene the sphere of radius k around a solution x as the set of all solutions lying at Hamming distane k from x [10℄. A bal l of radius k is the set of all the solutions lying at Hamming distane lower or equal to k . In analogy to the adjaeny matrix we dene the sphere and ball matries of radius k as: S ( k ) xy = 1 if H ( x; y ) = k 0 otherwise ; B ( k ) xy = k X =0 S ( ) xy = 1 if H ( x; y ) k 0 otherwise (4) Sine the ball matries are based on the sphere matries we an fous on the latter. The sphere matrix of radius one is the adjaeny matrix of the one-hange neighb orho o d, A , and the sphere matrix of radius zero is the identity matrix, I . Following [10℄, the matries S ( k ) an be dened using the reurrene: S (0) = I ; S (1) = A ; S ( k +1) = 1 k + 1 A S ( k ) ( n k + 1) S ( k 1) (5) With the help of the reurrene we an write all the matries S ( k ) as polynomials in A , the adjaeny matrix. For example, S (2) = 1 2 A 2 nI . As we previously noted, the eigenvetors of the Laplaian matrix are eigenvetors of the adjaeny matrix A . On the other hand, if f is eigenvetor of A , then it is also an eigenvetor of any polynomial in A . As a onsequene, all the funtions that are elementary are eigenvetors (up to an additive onstant) of S ( k ) and
their eigenvalues an be omputed using the same p olynomial in A that gives the expression for S ( k ) . The same is true for the ball matries B ( k ) , sine they are a sum of sphere matries. Let us dene the following series of polynomials: S (0) ( x ) = 1 (6) S (1) ( x ) = x (7) S ( k +1) ( x ) = 1 k + 1 x S ( k ) ( x ) ( n k + 1) S ( k 1) ( x ) (8) We use the same name for the p olynomials and the matries related to the spheres. The reader should notie, however, that the polynomials will b e always presented with their argument and the matries have no argument. That is, S ( k ) is the matrix and S ( k ) ( x ) is the p olynomial. Using the previous p olynomials, the matrix S ( k ) an b e written as S ( k ) ( A ) (the p olynomial S ( k ) ( x ) evaluated in the matrix A ) and any eigenvetor g of A with eigenvalue is also an eigenvetor of S ( k ) ( A ) with eigenvalue S ( k ) ( ). One relevant set of eigenvetors of the Laplaian in the binary representation is that of Walsh funtions [11℄. Furthermore, the Walsh funtions form an orthogonal basis of eigenvetors in the onguration spae. Thus, they have b een used to nd the elementary landsape deomp osition of problems with a binary representation like the SAT [6℄. We will use these funtions to provide the landsap e deomp osition of the ob jetive funtion of the test suite minimization problem. Given the spae of binary strings of length n , B n , a (non-normalized) Walsh funtion with parameter w 2 B n is dened as: w ( x ) = n Y i =1 ( 1) w i x i = ( 1) P n i =1 w i x i (9) Two useful prop erties of Walsh funtions are w v = w + v where w + v is the bitwise sum in Z 2 of w and v ; and 2 w = w w = 2 w = 0 = 1. We dene the order of a Walsh funtion w as the value h w j w i = P n i =1 w i , that is, the numb er of ones in w . A Walsh funtion with order p is elementary with eigenvalue = 2 p [8℄. The average value of a Walsh funtion of order p > 0 is zero, that is, w = 0 if w has at least one 1. The only Walsh funtion of order p = 0 is 0 = 1, whih is a onstant. In the mathematial development of Setion 4 we will use, among others, Walsh funtions of order 1 and 2. Thus, we present here a sp eial ompat notation for those binary strings having only one or two bits set to 1. We will denote with i the binary string with p osition i set to 1 and the rest set to 0. We also denote with i; j ( i 6 = j ) the binary string with positions i and j set to 1 and the rest to 0. We omit the length of the string n , but it will b e lear from the ontext. For example, if we are onsidering binary strings in B 4 we have 1= 1000 and 2 ; 3 = 0110. Using this notation we an write i ( x ) = ( 1) x i = 1 2 x i (10) Given a set of binary strings W and a binary string u we denote with W ^ u the set of binary strings that an b e omputed as the bitwise AND of a string
in W and u , that is, W ^ u = f w ^ u j w 2 W g . For example, B 4 ^ 0101 = f 0000 ; 0001 ; 0100 ; 0101 g . Sine the Walsh funtions form an orthogonal basis of R 2 n , any arbitrary pseudob o olean funtion an be written as a weighted sum of Walsh funtions in the following way: f = X w 2 B n a w w (11) where the values a w are alled Walsh o eÆients. We an group together the Walsh funtions having the same order to nd the elementary landsap e deomp osition of the funtion. That is: f ( p ) = X w 2 B n h w j w i = p a w w (12) where eah f ( p ) is an elementary funtion with eigenvalue 2 p . The funtion f an b e written as a sum of the n + 1 elementary omponents, that is: f = P n p =0 f ( p ) . Thus, any funtion an b e deomp osed in a sum of at most n elementary landsap es, sine we an add the onstant value f (0) to any of the other elementary omp onents. One we know that the p ossible eigenvalues of the elementary omponents of any funtion f are 2 p with 0 p n , we an ompute the p ossible eigenvalues of the sphere matries. Sine the size of the neighb orho o d is d = n , we onlude that the only p ossible eigenvalues for the spheres are S ( k ) ( n 2 p ) with p 2 f 0 ; 1 ;:::;n g . With the help of Eqs. (6) to (8) we an write a reurrene formula for the eigenvalues of the sphere matries whose solution is S ( k ) ( n 2 p ) = K ( n ) k;p , where K ( n ) k;p is the ( k ; p ) element of the n -th Krawthouk matrix [10℄, whih is an ( n + 1) ( n + 1) integer matrix. We will use Krawthouk matries to simplify the expressions and redue the omputation of the elementary omp onents of the test suite minimization. The interested reader an deepen on Krawthouk matries in [3℄. One important prop erty of the Krawthouk matries that will b e useful in Setion 4 is: (1 + x ) n p (1 x ) p = n X k =0 x k K ( n ) k;p (13) Eah omp onent f ( p ) of the elementary landsape deomp osition of f is an eigenfuntion of the sphere matrix of radius r with eigenvalue S ( r ) ( n 2 p ) = K ( n ) r;p . Thus, we an ompute the average tness value in a sphere of radius r around a solution x as: avg f f ( y ) g y jH ( y ;x )= r = n r 1 n X p =0 K ( n ) r;p f ( p ) ( x ) (14)
We an also ompute the -th moment of the funtion f in a sphere of radius r if we know the elementary landsape deomp osition of f : = avg f f ( y ) g y jH ( y ;x )= r = n r 1 n X p =0 K ( n ) r;p ( f ) ( p ) ( x ) (15) 3 Test Suite Minimization Problem When a piee of software is mo died, the new software is tested using some previous test ases in order to hek if new errors were introdued. This hek is known as regression testing . In [14℄ Yo o and Harman provide a very omplete survey on searh-based tehniques for regression testing. They distinguish three dierent related problems: test suite minimization, test ase seletion and test ase prioritization. The problem we fae here is the test suite minimization [13℄. We dene the problem as follows. Let T = f t 1 ; t 2 ;:::;t n g b e a set of tests for a program and let M = f m 1 ; m 2 ;:::;m k g b e a set of elements of the program that we want to over with the tests. After running all the tests T we nd that eah test an over several program elements. This information is stored in a matrix T that is dened as: T ij = 1 if node m i is overed by test t j 0 otherwise (16) We dene the overage of a subset of tests X T as: ov er ag e ( X ) = jf i j9 j 2 X ; T ij = 1 gj (17) The problem onsists in nding a subset X T suh that the overage is maximized while the numb er of tests ases in the set j X j is minimized. We an dene the ob jetive funtion of the problem as the weighted sum of the overage and the number of tests. Thus, the ob jetive funtion an be written as: f ( X ) = ov er ag e ( X ) j X j (18) where is a onstant that set the relative importane of the ost and overage. It an b e interpreted as the ost of a test measured in the same units as the b enet of a new overed element in the software. We assume here that all the elements in M to b e overed have the same value for the user and the ost of testing one test in T is the same for all of them. We defer to future work the analysis of the ob jetive funtion when this assumption is not true. Although the funtion prop osed is a weighted sum, whih simplies the landsap e analysis, non-linear funtions an b e also used and analyzed. In the following we will use binary strings to represent the solutions of the problem. Thus, we intro due the deision variables x j 2 B for 1 j n . The variable x j is 1 if test t j is inluded in the solution and 0 otherwise. With
this binary representation the overage, the numb er of ones of a string and the ob jetive funtion f an b e written as: ov er ag e ( x ) = k X i =1 n max j =1 f T ij x j g ; ones ( x ) = n X j =1 x j (19) f ( x ) = k X i =1 n max j =1 f T ij x j g ones ( x ) (20) 4 Elementary Landsap e Deomp osition In this setion we present two of the main ontributions of this work: the elementary landsap e deomp osition of f and f 2 . In order to simplify the equations let us intro due some notation. Let us dene the sets V i = f j j T ij = 1 g . V i ontains the indies of the tests whih over the element m i . We also use in the following the term T i to refer to the binary string omp osed of the elements of the i -th row of matrix T . T i is a binary mask with 1s in the positions that app ear in V i . 4.1 Deomp osition of f The goal of this setion is to nd the Walsh deomp osition of f . We rst de- omp ose the funtions ov er ag e ( x ) and ones ( x ) into elementary landsap es and then we ombine the results. Let us start by analyzing the ov er ag e funtion and, in partiular, let us write the maximum in its denition as a weighted sum of Walsh funtions with the help of (10). n max j =1 f T ij x j g = 1 n Y j =1 (1 T ij x j ) = 1 Y j 2 V i (1 x j ) = 1 Y j 2 V i 1 + j ( x ) 2 = 1 2 j V i j Y j 2 V i (1 + j ( x )) (21) We an expand the produt of Walsh funtions in (21) using u v = u + v to get the Walsh deomp osition of max n j =1 . n max j =1 f T ij x j g = 1 2 j V i j Y j 2 V i (1 + j ( x )) = 1 2 j V i j X W 2P ( V i ) Y j 2 W j ( x ) (22) = 1 2 j V i j X w 2 B n ^ T i w ( x ) Using the Walsh deomp osition we an obtain that elementary landsap e deomp osition. The elementary omponents are the sums of weighted Walsh funtions having the same order (numb er of ones in the string w ). We an distinguish two ases: the onstant elementary omp onent (with order 0) and
the non-onstant omp onents. Then, the elementary landsap e deomp osition of max n j =1 is: n max j =1 f T ij x j g (0) = 1 1 2 j V i j (23) n max j =1 f T ij x j g ( p ) = 1 2 j V i j X w 2 B n ^ T i h w ; w i = p w ( x ) where p > 0 (24) Eqs. (23) and (24) are the elementary landsap e deomp osition of the overage of one single software element. We just have to add all the omp onents of all the k elements to get the elementary landsap e deomp osition of ov er ag e ( x ). However, we should highlight that the previous expression is not very eÆient to ompute the omp onents of the maximum. We an observe that it requires to ompute a sum of j V i j p Walsh funtions. Before ombining all the piees to get the elementary landsape deomp osition of the ob jetive funtion of the problem, we need rst to nd a simpler and more eÆient expression for the elementary omp onents of the overage of one single element. Up to the b est of our knowledge, this is the rst time that the following mathematial development is performed in the literature. The essene of the development, however, is useful by itself and an b e applied to other problems with binary representation in whih the Walsh analysis an b e applied (like the Max-SAT problem). We will fous on the summation of (24). Let us rewrite this expression again as: X w 2 B n ^ T i h w ; w i = p w ( x ) = X W 2 P ( V i ) j W j = p Y j 2 W j ( x ) (25) Now we an identify the seond memb er of the previous expression with the o eÆient of a p olynomial. Let us onsider the p olynomial Q ( i ) x ( z ) dened as: Q ( i ) x ( z ) = Y j 2 V i ( z + j ( x )) = j V i j X l =0 z l 0 B B B X W 2 P ( V i ) j W j = j V i j l Y j 2 W j ( x ) 1 C C C A = j V i j X l =0 q l z l (26) From (26) we onlude that the summation in (25) is the o eÆient of z j V i j p in the polynomial Q ( i ) x ( z ), that is, q j V i j p . Aording to (10) and (26) we an write Q ( i ) x ( z ) = ( z + 1) n ( i ) 0 ( z 1) n ( i ) 1 where n ( i ) 0 and n ( i ) 1 are the numb er of zeros and ones, respetively, in the positions x j of the solution with j 2 V i . It should b e lear that n ( i ) 0 + n ( i ) 1 = j V i j . Now we an prot from the fat that, aording to (13), the p olynomials Q ( i ) x ( z ) are related to the Krawthouk matries by Q ( i ) x ( z ) = ( 1) n ( i ) 1 P j V i j l =0 K j V i j l;n ( i ) 1 z l and we an write q l = ( 1) n ( i ) 1 K j V i j l;n ( i ) 1 . Finally