Docsity

Simulated Annealing and Software Test Data Generation | CMSC 818, Study Guides, Projects, Research of Computer Science

Partial preview of the text

Download Simulated Annealing and Software Test Data Generation | CMSC 818 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Simulated Annealing and Software

Test Data Generation

Surat Pyari^ M.Sc.

(Mathematics with specialization in Computer Application)

Dayalbagh Educational Institute

Content

{^ Metaheuristic search techniques inSoftware Test Data Generation {^ Metaheuristic search techniques^ z

Hill Climbing z Stochastic Hill Climbing z Simulated Annealing {^ Test Data Generation with SimulatedAnnealing^ z

Testing Specification Failure z The Dynamic Approach z Example

Metaheuristic Search Techniquesin Software Test Data Generation {^ Metaheuristic search techniques are high-level frameworks which utilise heuristicsin order to find solutions to combinatorialproblems at a reasonable computationalcost

Metaheuristic Search Technique {^ Metaheuristic techniques have beenapplied to automate test datageneration in the following areas:^ z^

The coverage of specific programstructures, as part of structural, White-box testing strategy; z The exercising of some specific programfeature, as desired by a specification; z Attempting to automatically disprovecertain grey-box properties regardingthe operation of a piece of software, z To verify non-functional properties

Objective Function

{^ Objective functions compare andcontrast solutions of the search withrespect to the overall search goal {^ Whether a better objective value is, inpractice, a higher value or a lowervalue, is dependent on whether thesearch is seeking to minimize ormaximize the objective function

Metaheuristic Search Techniques^ HillClimbing

SimulatedAnnealing

EvolutionaryAlgorithms^ GeneticAlgorithms

Hill Climbing

{^ “Steepest ascent” climbing strategy:^ z

All neighbours are evaluated, with theneighbour offering the greatestimprovement chosen to replace thecurrent solution {^ “Random ascent” strategy:^ z

Neighbours are examined at random andthe first neighbour to offer animprovement is chosen

Steepest Ascent Hill Climbing

Algorithm

Procedure iterated hill climber Begin^ t^ <— 0initialize

best repeat

local^ <— FALSEselect a current point v

at randomc

evaluate v

c repeat^ select all new points in the neighbourhood of v

c

select the point v

from the set of new pointsn^ with the best value of evaluation function

eval

if^ eval (v

) is better thann^

eval (v )c^

then^ v

<— vc n else^ local

<— TRUE

until^ local t <— t+1 if^ v^ is better than bestc^^ then

best^ <— v

c

until^ t = MAX end

Advantage of Hill Climbing

{^ Easy to apply

Structure of a Stochastic Hill-

Climber

Procedure

stochastic hill-climber Begin t <— 0select a current string v

at randomc^

evaluate v

c Repeat^ select the string v

from the neighbourhood of vn^

c

select v

with probability 1/[1+en^

{ eval ( v

) -^ eval c (^ )}/Tvn

]

t <— t+1 until^ t=MAX end

Probability of Acceptance as a

function of T

T^

(-13/T) e

p

1 5 1020501010

0.000002 0.0743 0.2725 0.52 0.77 0.9999…..

1.00 0.93 0.78 0.66 0.56 0.5….

Eval(v

)=107c Eval(v

)=120n {^ Conclusion :

if T

is huge thesearch becomerandom, if T issmall thestochastic hillclimber revertsan ordinary hill climber

Probability of Acceptance as a

function of eval(v

)n

eval(vn)

V=eval(vc)-eval(vn)

v/10 e p

(^80100107120150)

(^2770) -13 -

14.88^ 2.01^ 1.00^ 0.27^ 0.

0.06 0.33 0.50 0.78 0.

Eval(v

)=107c T=10 {^ Conclusion :

if the new point is better, the

probability of acceptance is greater than 0.5.

Simulated Annealing

{^ Better candidate solutions are alwaysaccepted {^ Worse candidate solution are acceptedalways in a controlled manner to escapefrom a locally optimal solutions

Structure of Simulated Annealing Procedure

Simulated_Annealing Begin^ t <— 0initialize Tselect a current point vc at randomevaluate vc^ repeat

repeat^ select a new point vn in the neighbourhoodof vc^ if

eval (vc)<

eval (vn) then vc <— vn else if^ random[0,1)<e

{ eva l(vc) -

eval (vn)}/T

then^ vc <— vn until^ (termination condition)T <— g(T,t)t <— t+1 until (halting criterion) end