Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix...

26
1 / 26 SSBSE 2011, Szeged, Hungary, September 10-12 Regression Testing Landscape Theory Result Applications Experiments Conclusions & Future Work Elementary Landscape Decomposition of the Test Suite Minimization Problem Francisco Chicano , Javier Ferrer and Enrique Alba

Transcript of Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix...

Page 1: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

1 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Elementary Landscape Decomposition of the Test Suite Minimization Problem

Francisco Chicano, Javier Ferrer and Enrique Alba

Page 2: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

2 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Test Suite Minimization Problem Formalization

•  Given:

Ø  A set of test cases T = {t1, t2, ..., tn}

Ø  A set of program elements to be covered (e.g., branches) M= {m1, m2, ..., mk}

Ø  A coverage matrix

•  Find a subset of tests X ⊆ T maximizing coverage and minimizing the testing cost

•  Binary representation:

t1 t2 t3 ... tn m1 1 0 1 … 1

m2 0 0 1 … 0

… … … … … …

mk 1 1 0 … 0

T=

Page 3: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

3 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  A landscape is a triple (X,N, f) where

Ø  X is the solution space

Ø  N is the neighbourhood operator

Ø  f is the objective function

Landscape Definition Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

The pair (X,N) is called configuration space

s0

s4 s7

s6

s2

s1

s8 s9

s5

s3 2

0

3

5

1

2

4 0

7 6

•  The neighbourhood operator is a function

N: X →P(X)

•  Solution y is neighbour of x if y ∈ N(x)

•  Regular and symmetric neighbourhoods

•  d=|N(x)| ∀ x ∈ X

•  y ∈ N(x) ⇔ x ∈ N(y)

•  Objective function

f: X →R (or N, Z, Q)

Page 4: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

4 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  An elementary function is an eigenvector of the graph Laplacian (plus constant)

•  Graph Laplacian:

•  Elementary function: eigenvector of Δ (plus constant)

Elementary Landscapes: Formal Definition

s0

s4 s7

s6

s2

s1

s8 s9

s5

s3

Adjacency matrix Degree matrix

Depends on the configuration space

Eigenvalue

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Page 5: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

5 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  An elementary landscape is a landscape for which

where

•  Grover’s wave equation

Elementary Landscapes: Characterizations

Linear relationship

Eigenvalue

Depend on the problem/instance

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

def

Page 6: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

6 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  What if the landscape is not elementary?

•  Any landscape can be written as the sum of elementary landscapes

•  There exists a set of eigenfunctions of Δ that form a basis of the function space (Fourier basis)

Landscape Decomposition Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

X X X

e1

e2

Elementary functions

(from the Fourier basis)

Non-elementary function

f Elementary components of f

f < e1,f > < e2,f >

< e2,f >

< e1,f >

Page 7: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

7 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Examples Problem Neighbourhood d k

Symmetric TSP 2-opt n(n-3)/2 n-1 swap two cities n(n-1)/2 2(n-1)

Graph α-Coloring recolor 1 vertex (α-1)n 2α Max Cut one-change n 4 Weight Partition one-change n 4

Problem Neighbourhood d Components

General TSP inversions n(n-1)/2 2 swap two cities n(n-1)/2 2

Subset Sum Problem one-change n 2 MAX k-SAT one-change n k QAP swap two elements n(n-1)/2 3 Test suite minimization one-change n max |vi|

Elem

enta

ry

Land

scap

es

Sum

of e

lem

enta

ry

Land

scap

es

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Page 8: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

8 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  The set of solutions X is the set of binary strings with length n •  Neighborhood used in the proof of our main result: one-change neighborhood

Ø  Two solutions x and y are neighbors iff Hamming(x,y)=1

Binary Search Space

0 1 1 1 0 1 0 0 1 0

0 1 1 1 0 1 0 0 1 0

0 1 1 1 0 1 0 0 0 0

0 1 1 1 0 1 0 1 1 0

0 1 1 1 0 1 1 0 1 0

0 1 1 1 0 0 0 0 1 0

0 1 1 0 0 1 0 0 1 0

0 1 0 1 0 1 0 0 1 0

0 0 1 1 0 1 0 0 1 0

1 1 1 1 0 1 0 0 1 0

0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 0

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Page 9: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

9 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  If f is elementary, the average of f in any sphere and ball of any size around x is a linear expression of f(x)!!!

Spheres around a Solution

H=1 H=2

H=3

Σ f(y’) = λ1 f(x)

Σ f(y’’) = λ2 f(x)

Σ f(y’’’) = λ3 f(x)

n non-null possible values

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Sutton

Whitley

Langdon

Page 10: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

10 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Analysis of the expected fitness

Bit-flip Mutation: Elementary Landscapes

j

j

p=0 → fitness does not change

p=1/2 → start from scratch

p=1 → the same fitness When f(x) >

When f(x) <

j

j

p=1 → flip around

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Sutton

Whitley

Howe

Chicano

Alba

Page 11: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

11 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Analysis of the expected fitness

•  Example (j=1,2,3):

p=1/2 → start from scratch

p≈0.23 → maximum expectation

The traditinal p=1/n could be around here

Landscape Definition Elementary Landscapes Landscape decomposition Binary Space

Bit-flip Mutation: General Case

Page 12: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

12 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  The elementary landscape decomposition of

is

ELD of f ELD of f2

Elementary Landscape Decomposition of f

constant expression

Tests that cover mi

Tests in the solution that cover mi

Krawtchouk matrix

Computable in

O(nk)

Page 13: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

13 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  The elementary landscape decomposition of f2 is

ELD of f ELD of f2

Elementary Landscape Decomposition of f2

Page 14: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

14 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  The elementary landscape decomposition of f2 is

ELD of f ELD of f2

Elementary Landscape Decomposition of f2

Page 15: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

15 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  The elementary landscape decomposition of f2 is Computable in

O(nk2)

Number of tests that cover mi or mi’

Number of tests in the solution that cover mi or mi’

ELD of f ELD of f2

Elementary Landscape Decomposition of f2

Page 16: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

16 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Selection operator

•  We can design a selection operator selecting the individuals according to the expected fitness value after the mutation

Selection Operator Selection Mutation GLS

X

Expectation Expectation Minimizing

Mutation

Mutation

Page 17: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

17 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Mutation operator

•  Given one individual x, we can compute the expectation against p

•  If this operator is used the expected improvement is maximum in one step

(Sutton, Whitley and Howe in GECCO 2011)

1.  Take the probability p for which the expectation is maximum

2.  Use this probability to mutate the individual

Selection Mutation GLS

Mutation Operator

Page 18: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

18 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  With the Elementary Landscape Decomposition (ELD) we can compute:

•  With the ELD of f and f2 we can compute for any sphere and ball around a solution:

•  Distribution of values around the average

Selection Mutation GLS

Guarded Local Search

: the average : the standard deviation

Chebyshev inequality

At least 75% of the samples are in the interval

f

Best

Apply local search

Page 19: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

19 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  With the Elementary Landscape Decomposition (ELD) we can compute:

•  With the ELD of f and f2 we can compute for any sphere and ball around a solution:

•  Distribution of values around the average

Selection Mutation GLS

Guarded Local Search

: the average : the standard deviation

Chebyshev inequality

At least 75% of the samples are in the interval

f

Best

Don’t apply local search

Page 20: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

20 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Steady state genetic algorithm: bit-flip (p=0.01), one-point crossover, elitist replacement

•  GA (no local search)

•  GLSr (guarded local search up to radius r)

•  LSr (always local search in a ball of radius r)

•  Instances from the Software-artifact Infrastructure Repository (SIR)

•  printtokens

•  printtokens2

•  schedule

•  schedule2

•  totinfo

•  replace

Guarded Local Search: Experimental Setting

n=100 test cases Oracle cost c=1..5

Selection Mutation GLS

100 independent runs k=100-200 items to cover

Page 21: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

21 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Guarded Local Search: Results c=1 c=3 c=5

printtokens1

schedule

Selection Mutation GLS

Page 22: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

22 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Guarded Local Search: Results c=1 c=3 c=5

Selection Mutation GLS

Page 23: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

23 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Guarded Local Search: Results c=1 c=3 c=5

Selection Mutation GLS

Page 24: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

24 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

Guarded Local Search: Results

Time (secs.)

Selection Mutation GLS

Page 25: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

25 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Regression Testing

Landscape Theory Result

Applications Experiments

Conclusions & Future Work

•  Landscape theory provides a promising technique to analyze SBSE problems

•  We give the elementary landscape decomposition of the test suite minimization problem

•  Using the ELD we can efficiently compute statistics in the neighbourhood of a solution

•  We provide a proof-of-concept by proposing a Guarded Local Search operator using the information gained with the ELD

Conclusions

Future Work

•  The main drawback of the GLD is runtime: parallelize computation with GPUs

•  Expressions for higher order moments (ELD of fc)

•  Remove the current constraint on the oracle cost

•  Connection with moments of MAX-SAT

Conclusions & Future Work

Page 26: Elementary Landscape Decomposition of the Test Suite ... · s9 s5 s3 Adjacency matrix Degree matrix Depends on the configuration space Eigenvalue Landscape Definition Elementary Landscapes

26 / 26 SSBSE 2011, Szeged, Hungary, September 10-12

Thanks for your attention !!!

Elementary Landscape Decomposition of the Test Suite Minimization Problem