• No results found

Design and analysis of different alternating variable searches for search-based software testing

N/A
N/A
Protected

Academic year: 2019

Share "Design and analysis of different alternating variable searches for search-based software testing"

Copied!
20
0
0

Loading.... (view fulltext now)

Full text

(1)

Contents lists available atScienceDirect

Theoretical

Computer

Science

www.elsevier.com/locate/tcs

Design

and

analysis

of

different

alternating

variable

searches

for

search-based

software

testing

,

✩✩

Joseph Kempka,

Phil McMinn

1

,

Dirk Sudholt

,

2

DepartmentofComputerScience,UniversityofSheffield,Sheffield,S1 4DP,UK

a

r

t

i

c

l

e

i

n

f

o

a

b

s

t

r

a

c

t

Articlehistory:

Received26November2013

Receivedinrevisedform17November2014 Accepted11December2014

Availableonline8January2015

Keywords:

Search-basedsoftwareengineering Testdatageneration

Localsearch Runtimeanalysis Theory

Manual software testing is a notoriously expensive part of the software development process, and its automation is of high concern. One aspect of the testing process is the automatic generation of test inputs. This paper studies the Alternating Variable Method (AVM) approach to search-based test input generation. The AVM has been shown to be an effective and efficient means of generating branch-covering inputs for procedural programs. However, there has been little work that has sought to analyse the technique and further improve its performance. This paper proposes two different local searches that may be used in conjunction with the AVM, Geometric and Lattice Search. A theoretical runtime analysis proves that under certain conditions, the use of these searches results in better performance compared to the original AVM. These theoretical results are confirmed by an empirical study with five programs, which shows that increases of speed of over 50% are possible in practice.

©2015 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).

1. Introduction

Testing software for functionalcorrectness can be classifiedas two distinct types of activity, black-boxtesting—where thesoftwareisexercisedwithrespecttoaspecification, formalorotherwise—and white-boxtesting,wheretestinputsare derivedwithrespecttothesoftware’sunderlyingprogramcode.Black-boxandwhite-boxtestingarecomplementary.While black-box testingcan check that all expected functionalityis present, i.e., trapping so-calledfaultsofomission, white-box testingcancheckforfaultsofcommission—unintendedsoftwarebehavioursnotdocumentedinthespecification,butpresent intheimplementation.

The degree to whichwhite-box testinghas beenperformed ismeasured by coverage metrics. The strongestcoverage metric is pathcoverage. A program “path” is simply the sequence of program statements executed through a program, decidedbytheoutcomesofdecisionsatconditionalsstatementssuchas

if

,

while

and

for

etc.,andpathcoverageisthe proportionofall possiblepathsthroughthesoftwarethatwereexercisedbythetests.However, foranyrealisticprogram, fullpathcoverageisanunrealistictargetduetothepotentiallyinfinitenumberofpathsthat maybeinvolved[1].A more achievableandcommongoalisbranchcoverage,whereeverydecisionintheprogramisexecutedastrueandfalse.

ThisarticlewasoriginallyscheduledtobecompiledontheSpecialissueEvolutionaryComputation2013,nowgettingcompiledintoaregularissue. ✩✩ ApreliminaryconferenceversionwithpartsoftheresultsappearedatGECCO2013[11].

*

Correspondingauthor.

1 ThisworkisfundedinpartbytheEPSRCproject“RE-COST”(grantno.EP/I010386).

2 TheresearchleadingtotheseresultshasreceivedfundingfromtheEuropeanUnionSeventhFrameworkProgramme(FP7/2007–2013)undergrant

agreementno.618091(SAGE).

http://dx.doi.org/10.1016/j.tcs.2014.12.009

(2)

Softwaretestingisanexpensiveandlabour-intensiveprocess.Onepotentialwaytolower thecostsinvolvedintesting is togenerateinputsforachievingwhite-boxcoverageautomatically, andatechnique that hasbeenofparticularinterest to researchers inrecentyears isthat of search-basedtestinputgeneration[17,13,16,26].In search-basedtesting, stochastic optimisation techniques are employed todrive the dynamic executionsof a pieceof softwaretowards the coverage ofa certaintestgoal,forexampletheexecutionofaparticularprogrambranch.Duetothenon-linearityofsoftware,itisusually non-obviouswhichinputswillexecutewhichbranches.Search-basedtestingreformulatesthepredicatesinaprogramthat guardtheexecutionofabranchintoa fitnessfunction,such thatinputscloserto satisfyingthose predicatesareawarded better fitness values.Thesefitnessfunctionsmaythen be optimised byan optimisation technique, suchasa randomised searchheuristic,tolocateaninputforaparticularbranch.

A simplelocalsearch optimisation technique thathas beenshowntobe effectiveforcovering branchesofprocedural programs istheAlternatingVariableMethod(AVM) [13].Ina recentempiricalstudybyHarmanandMcMinnwitharange ofCprograms, theAVMwasableto coverthemajorityofbranchesfasterthana geneticalgorithm [9].Thissuggeststhat theunderlyingfitnesslandscapeforcoveringindividualprogrambranchesisrelativelysimplemostofthetime,withmore “heavyweight”population-basedapproacheslikeGeneticAlgorithmsonlyrequiredinaminorityofcases[19].Despitethis, therehasbeenrelativelylittleworkdevotedtoanalysingandimprovingtheperformanceoftheAVMtechnique.

TheAVM canberegardedasageneralframework inwhichalocalsearchstrategyisappliedinturntoeachindividual input vectorvariableoftheprogramundertest.Inthispaper,weview thelocalsearchstrategytobeacomponentofthe overallframeworkthatmaybesubstitutedforanother.TheoriginalAVMappliedanacceleratedhillclimbthat wereferto asIteratedPatternSearch(IPS),where“exploratory”movesinadirectionoffitnessimprovementareproceededby“pattern” steps in thesame direction. Patternsteps iteratively increase insize foraslong asimprovements infitness continue.As soonasfitnesspeaks,exploratorymovesareagainmadetore-establishanewdirection.

Inthispaper,weproposetoreplaceIPSwithtwodifferentapproachesforexploringindividualdimensionsoftheinput vector—GeometricSearch andLatticeSearch (see Section5fordetails andformaldefinitions). Geometric andLatticeSearch are eliminationsearches that are able to find the optimum ofa one dimensional function that is unimodalon a given interval. Theywork bycomparingthefitness valuesoftwo pointsatpredeterminedpositions,usingtheresultto selecta newbutsmallersub-range.The algorithmiteratesuntilitisleftwithonepoint.GeometricSearch splitstherangeintwo bycomparingtwopositionsinthemiddleoftheintervaltodeterminewhetheranoptimumiscontainedinthebottomor tophalfoftheinterval.LatticeSearchcomparespointsthatareoffsetbyFibonaccinumbers.

We examineallthreevariantsoftheAVM throughtheoreticalruntimeanalysesandthroughempiricalexperiments,in ordertounderstandandimprovetheperformanceofthispopularapproachtosearch-basedtestinputgeneration.

WhilepriortheoreticalruntimeanalysesoftheoriginalAVMwithIPSinvolvedspecificprogramsandbranches[2,3],we furnishamoregeneralresult,provingthatforallunimodalfunctionsGeometricandLatticeSearcharefasterthanIPS,when usedintheframeworkofAVM.Inamoregeneralsense,GeometricandLatticeSearchconvergefastertolocaloptimathan IPS.Thesetheoretical resultsarecomplementedbyanempiricalstudyonopensourceprograms,involvingunimodalaswell asnon-unimodalfitnesslandscapes.Onmostbranchesthealternativelocalsearchesperformsignificantlybetter thanIPS. Thisincludesunimodallandscapes,inagreementwithourtheory,aswellasnon-unimodalones,wheretheassumptionsof our theoryare notmet.Thisindicatesthat fasterconvergencetolocaloptima isbeneficialona broadrangeofinstances. Theonlydeparturefromthispatternwasfoundforonecomplexlandscapeofatypeforwhich—asobservedinpriorstudies

[9,19]—a GeneticAlgorithmissignificantlybetterthanAVM.Afurthertheoreticalanalysisforthischallengingbranchshows that worse performanceisduetothekindoflocaloptimabeingreturned bylocalsearch.Onthisbranch,thealternative localsearchesarefasterinfindingsomelocaloptimum,butwhichlocaloptimumisreturnedhasanadverseeffectonglobal searchperformanceinthisspecificcase.

Thecontributionsofthispaperarethereforeasfollows:

1. TheincorporationoftwodifferentlocalsearchesGeometricSearch andLatticeSearchintotheAVMapproachforfinding testinputsforprograms(Section5).

2. Atheoreticalruntime analysisofthe localsearch usedin theoriginal AVM approach,IPS(Section 4),andGeometric andLatticeSearch,onunimodalfunctions.Startingatdistancesuptodfromtheglobaloptimum,IPShasaworst-case (regardingthechoiceofthestartingpoint)runningtimeof

Θ((

logd

)

2

)

oneveryunimodalfunction.Thesameholdsfor itsaverage-caseperformanceonasimpleunimodalfunction.GeometricandLatticeSearchperformwellonallunimodal functionsastheyonlyneedtime O

(

logd

)

intheworstcase(Sections5.1and5.2).

3. AnempiricalanalysisoftheAVM,comparing IPS,Geometric andLatticeSearchon fiveprograms,includingunimodal and non-unimodal functions, complementing our theoretical results on unimodal functionsand providing additional evidence that the alternative local searches also speed up search on non-unimodal functions, possibly due to their fasterconvergencetolocaloptima(Section6).

(3)
[image:3.561.73.476.58.170.2]

Fig. 1.Exampleprogramforwhichbranch-coveringtestinputsarerequired,andapartialcontrolflowgraph(CFG)showingfitnessfunctioncomputation (AL=approach level,BD=branch distance)forexecutionofthetruebranchfromthesecond“if”statementoftheprogramatCFGnode(3) (correspond-ingcontrolflowgraphnodenumbersappeartotheleftofrelevantcodestatements).

2. Background

Weintroducethefitnessfunctionandtherepresentationusedinthispaperforsearch-basedtestinputgeneration,the AVMalgorithm,andimportantbackgroundtotheoreticalruntimeanalysis.

2.1. Representationandfitnessfunction

Thefitnessfunctionforcoveringindividualprogrambranchesisamultivariatefunction mf

(

x

)

R

,thattakesaninput vectorx

=

(

x1

,

x2

,

. . . ,

xn

)

,i.e.,anorderedlistofargumentsthatarepassed toaprocedure.Inthispaper,weassumexcan

bemodelledasasequenceofintegers.Ourcontributionsnaturallyextendtorationalnumbers,whenthesearerepresented usingfixed-pointrepresentations(i.e.,afixednumberofdigitsisusedforbothintegerandfractionalpartsofanumber).

The fitness function measures how “close” an input vector was to executing a target branch. It is minimised by the search,witha zerovalue indicatingan input thatcoversthe branch.The fitnessfunctionhastwo components,whichwe describewiththeaidoftheexampleinFig. 1andtheexecutionofthetruebranchfromcontrolflowgraphnode (3).

Theapproachlevelrelatestothe decisionpointsinthe programappearing enroute toreaching thetarget branch,and reflectsthenumberofcontrolflowgraph(CFG)nodesunexecutedbyxonwhichthetargetbranchisdirectlyortransitively controldependent.ThesearedecisionnodesintheCFGthatmustbeexecutedwithaspecificoutcome,otherwisethetarget cannot be reached.Forexample,inFig. 1 the targetbranch iscontroldependent onthe

if

statementsatCFGnodes (1) and (3),asdemonstratedbythe (partially-drawn)CFG.Ifthe“wrong”choicesaremadeateitherofthesedecisionpoints (i.e.,thecondition evaluatestotruefornode (1)orfalsefornode (3)),thetargetisunexecutedbythepathtakenthrough thecontrol structure oftheprogram. Ifthetruebranch istakenatCFGnode (1),the approachlevel is 1,since node (3) is unexecuted.Ifthe false branchis takenfromnode (1),the approach levelis 0,since all control dependencieswill be executed.

Thebranchdistanceiscomputedfromthevaluesofvariablesatpredicateswherecontrolflowdivergedfromthetargetat somecontroldependentCFGnode.Itisintendedasameasureof“howfar”theinputwasfromexecutingaconditioninthe requiredway,sothatcontrolflow isdirectedtowards,ratherthanawayfromthecurrenttarget inquestion.Forexample, in Fig. 1, ifthe input takesthe truebranch atCFG node (1),the branchdistance is computedusingthe formula

y

x

. Withthisformula,inputsarerewardedonthebasisofhowclosetheyaretomaking

y

equal

x

,whichwouldresultinthe alternative(anddesired)falsebranchbeingtakeninsteadofthetruebranch.Ifthesearchsucceedsinfindinganinputthat resultsinthefalsebranchbeingtakenatCFGnode (1),butthentakesthefalsebranchatCFGnode (3),thebranchdistance iscomputedusingtheformula

|

x

y

|

.Thisformularewardsinputsthatareclosetobeingequal,inordertoencouragethe searchtowardsinputsthatresultinthedesiredtruebranchtobetakenintheexecutionpath.

(4)
[image:4.561.162.389.97.173.2]

Table 1

Tracey’sbranchdistancefunctionsforrelationalpredicates(fromreference [29]).ThevalueK,K>0,referstoaconstantwhichisalwaysaddedifthe predicateisnottrue.

Relational predicate Branch distance computation

Boolean ifTRUEthen 0 elseK

a=b if|ab| =0 then 0 else|ab| +K

a=b if|ab| =0 then 0 elseK

a<b ifab<0 then 0 else(ab)+K

ab ifab≤0 then 0 else(ab)+K

a>b ifba<0 then 0 else(ba)+K

ab ifba≤0 then 0 else(ba)+K

Inpractice,themaximumbranchdistancevariesfrombranchtobranch,dependingonthetypesofthevariablesinvolved in thebranchpredicate. Insteadof applyingcostlyanalysisto determinevariabletypes,it iseasier,inpractice,to simply apply agenericnormalisationfunction.Inthispaperweusethefunctionnorm

(

d

(

x

))

=

1

1

.

001−d(x),whered

(

x

)

returns the value ofr

+

K for

x andnorm

(

d

(

x

))

is the normalised branch distance.The complete fitness value is computedby normalisingthebranchdistanceandaddingittotheapproachlevel,i.e.,mf

(

x

)

=

AL

(

x

)

+

norm

(

d

(

x

))

[31].Astheco-domain ofnorm is

[

0

,

1

)

andtheapproachleveltakesintegervalues,thelatteralwaysrepresentsthedominatingterminthefitness function.Inother words,asearchpoint xhasabetter fitnessthan

y ifitsapproachlevelissmaller,oriftheyhaveequal approach levels, but

xhas asmaller branchingdistance.The choice ofthenormalisation functionis notimportantwhen only therelative rankingofsolutionsis ofconcern—asinthispaper—and identicalrankingsare produced(e.g.,whenthe constant 1

.

001 isreplaced in norm with any other basegreater than 1); or,the lexicographic ordering of a bi-objective functionconsistingoftheapproachlevelandthebranchdistanceisminimised.

2.2. Thealternatingvariablemethod(AVM)

The AVMcan be viewedasa generalframeworkthat proceedsfromarandom starting pointinthe searchspace, and works by calling a local search function on each element of the input vector inturn. That is,while the local search is performing“moves”ononecomponentofthevector,thevaluesforallotherdimensionsremainfixed.If,duringthissearch, afitnessofzeroisfound,theAVMterminateswiththebranch-coveringinput.If,however,alocaloptimumisreached,the AVM advancestothenextelement.Ifthefitnesscannotbe improvedaftercyclingthroughallelements, theAVMrestarts from another randomly-generated input, continuing the search for a branch-covering input until the number of fitness functionevaluationsexceedsapredefinedmaximum.

Algorithm 1 describesthe AVM framework moreformally.The initial vector ischosen uniformlyatrandom using the function random

( )

. The algorithm transforms the multivariate fitness function mf into a one dimensional projection f (line 5).Thefunction f isequivalenttoevaluatingmf withaninputvectorwhereallcomponentsexceptxiaresetto

con-stantsandxiissubstitutedbythefreeparameterx.Thefunction f ispassedtoalocalsearchalgorithmcalledlocal_search,

alongwithxi,thestartingpointforthesearch.Thevariablec countshowmanyvariablesAVMhasoptimisedsincethelast

improvementofmf;itrestartswithauniformrandomvalueforxonceithascycledthroughallnvariableswithno suc-cessfulimprovementinfitness.Thefitnessfunctionkeepstrackofthenumberoffitnessevaluations,maintainingamapping of previously evaluatedvectorsto their corresponding fitnessvalues.Oncea branching-covering inputvector isfound, or whenthenumberofevaluationsexceedsthemaximum(i.e.,thesearchhasfailed),anexceptionisraisedtoterminatethe search(notshowninouralgorithmsforspaceandsimplicity).

Algorithm1TheAVMframeworkforoptimizingx

=

(

x1

,

. . . ,

xn

)

. 1:while true do

2: letx:=random()

3: leti:=1,c:=0 4: whilec<ndo

5: let f:x

mf(x1,. . . ,xi−1,x,xi+1,. . . ,xn)

6: letx:=local_search(f,xi)

7: ifmf(x)<mf(x)then 8: letx:= x,c:=0

9: else

10: letc:=c+1

11: leti:=(imodn)+1

2.3. Runtimeanalysisandrelatedwork

(5)
[image:5.561.42.501.59.206.2]

Fig. 2.Examplesofdifferentfitnesslandscapes,includingsimpleexamplecodeforasinglevariablexthatgeneratestheselandscapes;abs(x)denotesthe absolutevalueofx.Toeasepresentation,weusedK=0 inthebranchdistanceandthebase1.001 ofthenormalisationfunctionwaschangedto1.1 for generatingtheseplots.Thefunctionin(b)resultsfromthestrictlyunimodalfunction (a)andaddingglobaloptimaforx<0.In (d)valuesx<3 leadtoa highfitnessvaluebecauseoftheworseapproachlevel.

algorithms. Runtime analysis has established itself asa leading theory in randomised search heuristics, with many new resultsinthelast15years [25,4,10].Inparticular,inthearea ofsearch-basedsoftwareengineeringrecentresultsinclude computinginput-outputsequences[14,15],testinputgeneration[3],andsoftwareprojectscheduling[21,22].Thefollowing paragraphsreviewrelatedworkinruntimeanalysis.

Arcuri,Lehre,andYao [3]were thefirsttopresentaruntimeanalysisofsearch-basedinput generation.Theyfocussed onthetriangleclassificationproblem,whichinvolvesthreeintegervariablesdescribingsidelengthsofapotential triangle. Thetaskistoclassifytheinputasascalene,equilateral,orisoscelestriangle,ornotrepresentingatriangle.Theiranalysis waslimitedtothetimeforcoveringtheequilateralbranchoftheproblem.Iftherangeofinputvaluescontainsnnumbers, the expected time of random search is

Θ(

n2

)

. Hill climbing needs expected time

Θ(

n

)

, i.e., in every iteration a single

variableisincreasedordecreasedby 1.FortheAVMtheyprovedanupperboundof O

((

logn

)

2

)

andaweakerlowerbound of

Ω(

logn

)

[3].

Lateron,Arcuri[2]extendedtheanalysisoftheAVMtoallbranchesofthetriangleclassificationproblem,showingthat theexpectedrunningtimeisboundedfromabovebyO

((

logn

)

2

)

onallbranches.Certainbrancheswithmanyglobaloptima (cf.Fig. 2(b)onp.5)onlyneed O

(

logn

)

time.InthispaperweextendhisresultsbyprovinganupperboundofO

((

logn

)

2

)

forallstrictlyunimodalfunctions(andfunctionswithfurtherglobaloptima).

The performance ofsearch heuristicson unimodal functions was also studied by Dietzfelbinger, Rowe, Wegener, and Woelfel [6,5]. Theyshowed that algorithms that randomly displace thecurrent position ofa search algorithm using any fixed probability distribution needatleast

Ω((

logd

)

2

)

time inthe worst case, whenthe initial distanceto theoptimum

ischosenfrom

{

1

,

. . . ,

d

}

.Thus,noalgorithmusingsuchafixeddistributioncandobetterthantheoriginal AVM.Inother words,everylocalsearchstrategyaimingatbetterperformance needstouseaprobabilitydistribution,orsearchstrategy, thatdependsontheinitialpoint.ThisisthecaseforallAVMvariantsconsideredhere.

3. Preliminaries

Ourtheoreticalanalysesfocusonthe timeforfindingalocaloptimumusinglocalsearchwithin theframeworkofthe AVM. Recallthat these localsearches are executed on one coordinate ofthe multivariate fitness function. We count the numberoffunctionevaluations,alsocalledfitnessevaluations,madeby localsearchuntilanoptimumisfoundforthefirst time.Themotivationforconsideringfitnessevaluationsisthatsuchanevaluationisthemostcostlyoperationasitinvolves executingtheprogram.Insomecaseswecountuniquefitnessevaluations,i.e.,thenumberofdifferentsearchpointsevaluated. Thisreflectsthefact thatitiseasyto cachepastevaluations,soevaluatingthesamepointtwice onlyincursinsignificant additionalcost.

In our analyses we consider local search minimising a function f:D

R

for a finite domain D

Z,

which can be regardedaprojection ofthemultivariate fitnessfunctionmf.Foreaseofpresentation, weassume f

(

x

)

= ∞

forall x

/

D. This includessettings where f is thebranch distancebefore orafter normalisation.As alreadynoted inSection 2.1,the precise choice of a normalisation function is irrelevant in our work; all local searches analysed in this work only use informationabouttheranksofsearchpoints.Soeverystrictlyincreasingnormalisationfunctionleadstothesamesequences ofsearchpointsqueriedandhencethesameperformance.

(6)

Intheremainder,wewilldealwiththefollowingfunctionclasses,illustratedinFig. 2.Afunction f:D

R

withdomain D

R

iscalledstrictlyunimodalifitonlyhasasinglelocaloptimum.If f istobeminimised(the caseofmaximisationis symmetric)thismeansthat

f

(

1

) >

f

(

2

) >

f

(

opt

) <

f

(

r1

) <

f

(

r2

)

(1)

forall

1

<

2

<

opt

<

r1

<

r2,whereopt

=

min

(

f

)

istheglobalminimumof f.Inotherwords, f isstrictlydecreasingon D

(

−∞

,

opt

]

andstrictlyincreasing on D

∩ [

opt

,

)

.Theupperboundsobtainedintheremainder fortherunningtime ofAVMonstrictlyunimodalfunctionsalsoapplytofunctions f thatresultfromtakingastrictlyunimodalfunction f and assigningfunctionvaluesmin

(

f

)

tofurtherpoints,formally:

∀x

D:f

(

x

)

f

(

x

),

min

f

.

(2) Fig. 2(b)showsonesuchexample.Notethatingeneralglobaloptimaarenotrequiredtoformoneinterval.

In orderto classify real-world fitnesslandscapes inSection 6, we alsoconsider weaklyunimodal functions, definedas functionswhereall localoptimaarealsoglobaloptima.Incontrasttostrictly unimodalfunctionswithadditionaloptima, weaklyunimodalfunctionsmaycontainseveral“basinsofattraction”,seeFig. 2(c).Multimodalfunctions,ontheotherhand, aredefinedasfunctionswithmultiplelocaloptimasuchthatnotalllocaloptimaarealsoglobaloptima,seeFig. 2(d).

Notethatbothweaklyunimodalandmultimodalfunctionscanbedecomposedintoseveralstrictlyunimodalfunctions, each ofwhichhastheir own“basinofattraction”.Thelattercanbe definedasaninterval,asubset ofthedomain,where f isstrictlyunimodal.Forexample,inFigs. 2(c)and 2(d)wehavetwobasinsofattractions

[−

10

,

0

]

and

[

0

,

10

]

(boundary points can bepartoftwo basinsofattractions). OuranalysesofAVM variantsfinding globaloptima onstrictly unimodal functionscarryovertofindinglocaloptimaonweaklyunimodalandmultimodalfunctionsundertheassumptionthatAVM neverleavesthestarting point’sbasinofattraction.Fig. 2(c)givesanexampleofalandscapewherethisassumptionholds foralmostallstartingpoints.

4. AnalysisoftheoriginalAVM

4.1. OriginalAVMwithIPS

TheoriginalAVMduetoKorel[13]usesthefollowinglocalsearch,showninAlgorithm 2,thatwenameIteratedPattern Search (IPS). Startingatx,IPSfirst evaluatespoints x

1 andx

+

1 to identifyagradient.Unless xisa localoptimum,it then performsaso-calledpatternsearch, movinginthedirectionofdecreasing f-values.The stepsizedoubleswitheach step,sowhenthegradientistowardsincreasingindicesIPStraversesthepoints

x

,

x

+

1

,

x

+

1

+

2

,

x

+

1

+

2

+

4

, . . . ,

x

+

1

+

2

+

4

+ · · · +

2j

.

Since

ij=02j

=

2j+1

1 thissequenceisequalto

x

,

x

+

21

1

,

x

+

22

1

,

x

+

23

1

, . . . ,

x

+

2j+1

1

.

Pattern search stopsifthenext point doesnotimprovethe fitness,which happensonunimodalfunctionswhenthe op-timum isbeingovershot. Thisprocess isiterated;that is,IPSthenstarts anotherexploration.Ifthe functionisunimodal, IPSgetsclosetotheoptimumovertime.However,thislinesearchcanberelativelyslow.ThereasonisthatIPSaccelerates duringexploration,butafterovershootingtheoptimumIPSstartsanotherexplorationfromscratch.

Algorithm2IteratedPatternSearch,startingatx

D.

1:while true do

2: iff(x−1)f(x)and f(x+1)f(x)returnx 3: iff(x−1)<f(x+1)thenletk:= −1elseletk:=1 4: whilef(x+k)<f(x)do

5: letx:=x

+

k,k:=2k

4.2. UpperboundfororiginalAVM

WestartourinvestigationswithIteratedPatternSearch,thelocalsearchusedintheoriginalAVM[13].Anupperbound O

(

log2n

)

(for domainsize n) was provenforAVM withIPSin [3],forthe specialcasethat thereis alinear relationship betweenthefunctionvalueandthedistancetotheoptimum.Thefollowingstatementholdsforarbitrarystrictlyunimodal functions.Hereandintheremainderlog denotesthebinarylogarithmlog2.

(7)

Thelaststatementimpliesthatwegetanupperboundoforder O

((

logd

)

2

)

formanyfurthercommonfunctions. Exam-plesarefunctionswhereopt isaglobaloptimumandallpointsx

>

opt or x

<

opt areglobaloptimaaswell(seeFig. 2(b)). Inparticular,allfunctionsconsideredinArcuri’swork[2]arecoveredbythisstatement.However,forfunctionswithmany globaloptimatheupperboundmaynotbetight[2].

ProofofTheorem 1. Weallowthealgorithmtotraversepoints outsideof D,butassumethatallx

/

D areworsethanall x

D.

WeconsiderpassesofIPS,corresponding tooneiterationoftheouterwhileloopinAlgorithm 2:a passstartswithan exploratorysearch examiningthetwo neighbouringsolutions ofthecurrentpoint(index

±

1). Itthen performsa pattern search,doublingthedistancetravelledineachstep.Notethatapassstartingwiththeoptimummakesexactly3queries.If apassqueriespointsuptoadistanceof

i

j=02j

=

2i+1

1 fromtheinitialvalue,itqueriesi

+

3 values.

Withoutlossofgenerality assumethat thecurrentpositionis0andtheoptimum isatd.Ifd

=

1 weneed4queries, henceweassumeinthefollowingthatd

2.Weclaimthatwithinatmost2passesthedistancetotheoptimumhasbeen reducedtoatmost

d

/

2

.Leti betheuniqueintegersuchthat2i

1

d

<

2i+1

1.Notethatpatternsearchqueries2i

1

and2i+1

1 asthepointsarestrictlyimprovingin

[

0

,

2i

1

]

.Weconsidertwocases.Firstassumethat2i

1 isbetterthan 2i+1

1.Thenpatternsearchstopsat2i

1 andsinced

2i+1

2 thenewdistancetotheoptimumisatmost

d

/

2

.The numberofqueriesmadeisatmosti

+

3,andsinced

2i

1

2i−1thisisatmost logd

+

4.

Now consider the case that 2i

1 is worse than 2i+1

1. This implies 2i

d

2i+1

2. Then pattern search will query2i+2

1 andstopat2i+1

1 as2i+2

1 isworsethan2i+1

1.Thesecondpasswilltraversepositions2i+1

21

,

2i+1

22

,

2i+1

23

. . .

.Since byunimodality allpoints in

[

0

,

2i

]

areincreasingly better,patternsearch willstop atsome

2i+1

2j with0

j

i.Astheoptimummustbewithin

[

max

(

2i

,

2i+1

2j+1

),

2i+1

2j−1

]

,andthenewcurrentpointis 2i+1

2j,thedistancebetweenthecurrentpointandtheoptimumhasdecreasedtoatmost 2j for j

<

iand2i−1for j

=

i. Inbothcasesthenewdistanceisboundedby

d

/

2

.

Intheworstcase,weneedonepassqueryinguptoi

+

4 values,andasecondpassqueryinguptoi

+

3 points.Thetotal is2i

+

7

2

logd

+

7 asd

2i.

The total numberofqueries made, T

(

d

)

, isthen subjectto the followingrecurrence: T

(

0

)

=

3, T

(

1

)

=

4,and T

(

d

)

2

logd

+

7

+

T

(

d

/

2

)

ford

>

1.Thefloorfunctionsinthisformulaimplythat,whenrepeatedlyexpandingtermsT

(

·

)

,we getthesamerecurrenceforT

(

d

)

asforT

(

2logd

)

.Solvingthelattergives

T

(

d

)

logd

k=1

(

2k

+

7

)

+

T

(

1

)

2

·

logd

(

logd

+

1

)

2

+

7

logd

+

T

(

1

)

(

logd

)

2

+

8 logd

+

4

.

Thelast remarkofthestatement holdstruesinceaddingfurtherglobaloptimacanonlydecreasetheexpectedtimeuntil someglobaloptimumisfound.

2

4.3. OriginalAVMisslowintheworstcase

The followingresultshowsthat theupperbound fromTheorem 1isasymptotically tight.Both boundstogether show thattheworst-caserunningtimeofIPSisoforder

Θ((

logd

)

2

)

,wheninitialpointsup todistancedareallowed.Notethat theresultappliestoeveryunimodalfunction,henceAVMalwayshasabadworst-caseperformance.

Theorem2.ConsiderIteratedPatternSearchminimisinganarbitrarystrictlyunimodalfunction f:

Z

R

.Iftherearefeasiblestarting pointswithdistances0

,

1

,

. . . ,

d totheoptimum,theworstcasenumberofuniquefitnessevaluationsisatleast

(

logd

)

2

10

O

(

logd

).

Proof. Wecanassumew.l.o.g.thattheoptimumisatposition 0.IfthedomainD isboundedononeside,weconsideran extendedfunction f wherethedomainis

Z

and f

(

x

)

= ∞

forall x

/

D.

The challenge in proving the statement is that it holds for an arbitrary unimodalfunction f. We do not know any details of thisunimodal function; we only knowfrom (1)that f is monotonically decreasingin the negative range and monotonically increasing in the positive range. This shape implies that when IPS overshoots the optimum by travelling (w.l.o.g.towardsincreasingindices)fromapoint

<

0 towardsr

>

0,thecomparisonof f

()

and f

(

r

)

determineswhether apassofIPSwillstopat

orr,triggeringthenextpassfromthere.Notethatthesearetheonlytwopossibilitiesdueto(1). Notethatthedistancetotheoptimumfor

andrisnoreliableindicatorforthecomparisonof f

()

and f

(

r

)

:evenif,say,

(8)

Themainideaoftheproof istoconsidertwoworst-casestartingpointswithinarangethatgrowswithaparameter i: a point

i

<

0 left ofthe optimum andanother point ri

>

0 right of the optimum.Having a worst-casepoint on either

sideoftheoptimumisnecessaryasIPSmaystopapassoneithersideoftheoptimum.Weprovidealowerboundforthe fastest timestarting from either

i orri.Then we consider alarger rangeforparameter i

+

1 anddetermine worst-case

points

i+1 andri+1.Thesepointsarechosenbasedon

i

,

riandthecomparisonof f

(

i

)

and f

(

ri

)

,insuchawaythatIPS

startingfromeither

i+1 orri+1 willstopapassatthebettersearchpointamong

iandri.Astheabove-mentionedlower

bound appliestothefastesttimefromeither

i orri,thisallowsustoaddthislowerboundtothetimeittakestotravel

from

i+1 orri+1 to

i orri.Wegeta newlower boundforthefastesttime fromeither

i+1 orri+1.The claimedlower

boundthenfollowsbyinductionoveri.

Formalisingthisidea,wedefine Ts

(,

r

)

asthenumberofdifferentsearchpointsevaluatedwhenIPSstartsins,counting

evaluationsfromtheset

{

,

. . . ,

r

}

only.Ifs

/

DweletTs

(,

r

)

:= ∞

.LetT

(,

r

)

:=

min

{

T

(,

r

),

Tr

(,

r

)

}

bethesmallestsuch

numberwhenstartingfromeither

orr.

Define

0

=

r0

=

0 andT

(

0

,

r0

)

=

1.Assumewehave

i

0

riforsomei

N

0,suchthat

iandriarenotbothoutside f’sdomain.Let

Δ

i

:=

2log(rii)+1 fori

N

and

Δ

0

:=

1 bethesmallestpowerof 2suchthat

Δ

i

>

ri

i.

We define newpoints

i+1

,

ri+1 according tothe followingcasedistinction.First assume f

(

i

)

>

f

(

ri

)

,whichimplies f

(

x

)

>

f

(

ri

)

forallx

i.Italsoimpliesthatriexists.Letri+1

:=

ri

+

Δ

i

1 and

i+1

:=

ri

2

Δ

i

+

1.IfIPSstartsatri+1,

itwillsamplepointsat

ri+1

,

ri+1

21

1

, . . . ,

ri+1

2log(Δi)

1

=

r

i

,

ri

Δ

i

andsincethefitnessimprovesineverystepbutthelastone,IPSwillstopatriandrestartexplorationfromthere.Allpoints

butri

Δ

iareguaranteedtoexistandarecontainedin

{

i+1

,

. . . ,

ri+1

}

;soIPSevaluates

Δ

i

+

1 differentsearchpointsfrom

that set beforerestartingexploration.From ri IPSneedstime atleast T

(

i

,

ri

)

1 sincesofar IPShasevaluated asingle

searchpointfromtheset

{

i

,

. . . ,

ri

}

,namelyri.Wethushaveestablishedtherecurrence

Ti+1

(

i+1

,

ri+1

)

Δ

i

+

T

(

i

,

ri

).

(3)

Similarly,if

i+1existsandIPSstartsfromthere,itwillsamplepointsat

i+1

,

i+1

+

21

1

, . . . ,

i+1

+

2log(Δi)

1

=

ri

Δ

i

,

ri

,

ri

+

2

Δ

i

.

Thefitnessimprovesineachstepbutthelastone,andsoIPSwillstopatri andstartexplorationfromthere.Notcounting

theevaluationofri

+

2

Δ

i,IPSevaluates

Δ

i

+

2 searchpoints,henceasaboveweget

Tri+1

(

i+1

,

ri+1

)

Δ

i

+

T

(

i

,

ri

)

+

1

.

(4)

Putting(3)and(4)together,wehaveshown

T

(

i+1

,

ri+1

)

Δ

i

+

T

(

i

,

ri

).

Thisalsoholds when

i+1

/

D asthen Ti+1

(

i

,

ri

)

= ∞

.The case f

(

i

)

<

f

(

ri

)

issymmetric,andif f

(

i

)

=

f

(

ri

)

we also

getthesamerecurrenceasIPSstopsatri asinthecase f

(

i

)

>

f

(

ri

)

whenstartingfrom

i+1 andIPSstopsat

i asonthe

othercasewhenstartingfromri+1.

Itfollowsthat

T

(

i

,

ri

)

i−1

j=1

Δ

j

+

T

(

0

,

r0

)

1

+

i−1

j=1

log

(

rj

j

).

Note thatfori

1 the differenceri+1

i+1 doesnotdependon whether f

(

i

)

>

f

(

ri

)

ornot,hencew.l.o.g.we usethe

definitionof

i+1

,

ri+1 fromthecase f

(

i

)

>

f

(

ri

)

.Alongwith

Δ

i

ri

i

+

1 weget

ri+1

i+1

=

ri

+

Δ

i

1

(

ri

2

Δ

i

+

1

)

=

3

Δ

i

2

>

3

(

ri

i

).

Expandingandusingr1

1

=

2 yields

ri+1

i+1

>

2

·

3i

.

Thus,

T

(

i

,

ri

)

1

+

i−1

j=1

log

2

·

3j−1

=

i

+

i−2

j=0

log

3j

=

i

+

log

(

3

)

·

(

i

2

)(

i

1

)

2

>

log

(

3

)

2

·

i

(9)

Itiseasytoverifybyinductionthatri

7i−1and

|

i

|

7i−1 foralli

N

.Puttingi

:=

log7

(

d

)

+

1 alongwithi

log7

(

d

)

=

log7

(

2

)

·

log2

(

d

)

thengivesalowerboundof

log

(

3

)

2

·

log7

(

2

)

2

·

(

logd

)

2

O

(

logd

) >

(

logd

)

2

10

O

(

logd

).

2

4.4. OriginalAVMisslowonaverage

The bad worst-case performance ofIPS is not simply dueto a few unlucky choicesof theinitial point. In fact, most startingpointsleadtoarunningtimeoforder

Θ((

logd

)

2

)

.Toseethis,weconsiderthespecificfunction f

(

x

)

= |

x

|

,whichis equivalenttothenormalisedfunctionfromFig. 2(a).Weshowthatwhenthestartingpointischosensuchthatthedistance betweenstartingpointandtargetisuniforminsomeinterval,thenwestillgetalowerboundoforder

(

logd

)

2.

Notethat f

(

x

)

= |

x

|

isquiteaneasyfunctionaspointsclosertotheoptimum 0arebetter thanpointsthatarefurther awayfromit.ThisencouragesIPStostopattheclosestpointtotheoptimumtraversedinapatternsearch,butwestillget atimeof

Ω((

logd

)

2

)

.

Theorem3.ConsiderIteratedPatternSearchminimisingthefunction f

(

x

)

= |

x

|

suchthatthestartingpointischosenuniformlyat randomfrom

{−

2i

,

. . . ,

2i

1

}

,forsomei

N

0.Theexpectednumberofuniquefitnessevaluationsisatleast i

2

6.

Note that thechoice of the initial starting point corresponds to choosing arandom integer in thetwo’s complement representationoni

+

1-bitwords,thestandardmethodforrepresentingsignedintegersinprogramminglanguages.

ProofofTheorem 3. Let T

(

i

)

denotethe expectednumber ofdifferent search points queried when the starting point is chosenuniformlyatrandomfrom

{−

2i

,

. . . ,

2i

1

}

.Theclaim T

(

i

)

i2

/

6 istrivialfori

=

0 andi

=

1.

IfIPSstartsatsomevaluex

<

0 (thecasex

>

0 issymmetric),IPSwillstartapatternsearchexploringpointswithhigher indices,queryingpointsatx1

:=

x

+

20,x2

:=

x

+

20

+

21,x3

:=

x

+

20

+

21

+

22,etc.(Wedonotcountapotentialevaluation

ofthepointatx

1 sinceitmightnot beinthedomainoffeasiblesearch points.)Letxj

:=

x

+

j−1

=02

=

x

+

2j

1 for

1

j

i bethefirstsearchpointqueriedwherexj

0.NowIPSwillstoppatternsearchandcontinuewitheitherxj−1 or xj,dependingonwhichisbetter.Ifxj isbetter,IPSwillalsoqueryxj+1;butasthismightbeoutofrange,wedonotcount

apotentialevaluationofxj+1.

Duetothefitnessfunctionused,thepointwiththesmallerabsolutevaluefromeitherxj−1orxjisbetter.Notethattheir

indexdifferenceisxj

xj−1

=

2j−1,soxj

∈ {

0

,

. . . ,

2j−1

1

}

.Ifxj

∈ {

0

,

. . . ,

2j−2

1

}

,xj isbetterthanxj−1,andIPSstarts

anotherpassat

{

0

,

. . . ,

2j−2

1

}

.Otherwise, xj−1 isbetter andIPSwillstartanotherpassat

{−

2j−2

,

2j−2

+

1

,

. . . ,

1

}

.

Allthesepositionsareattainedwiththesameprobability,henceweareinthesamesettingasdescribedinthestatement, with j

2 inplaceofi.

The probability of stoppingat xj being thefirst point where xj

0 (xj

0 whenstarting atx

>

0), for 1

j

i, is

2

·

2j−1

/

2i+1

=

2ji−1astherearexj

xj−1

=

2j−1positionsforxwherethishappenswhenx

<

0 andthesameholdsfor x

>

0.Recallthatallinitialpositionsarechosenuniformlyatrandom,andthereare2i+1 feasiblepositions.

Whilegettingtoxj IPShasqueriedatleast j

+

1 mutuallydifferentpointsx

,

x1

,

. . . ,

xj.Then theremainingtime isat

leastT

(

j

2

)

1;thereasonforsubtracting1isthatwehavealreadyqueriedxj.DefiningT

(

1

)

:=

0,wehaveestablished

thefollowingrecurrence

T

(

i

)

i

j=1

2ji−1

·

j

+

1

+

T

(

j

2

)

1

=

i

j=1

j

·

2ji−1

+

i

j=1

2ji−1

·

T

(

j

2

)

=

i−1

j=0

(

j

+

1

)

·

2ji

+

i−2

j=−1

2ji+1

·

T

(

j

)

=

i−1

j=0

(

j

+

1

)

·

2ji

+

i−2

j=0

2ji+1

·

T

(

j

)

asT

(

1

)

=

0.Alongwith

i

j=10

(

j

+

1

)

·

2ji

=

i

1

+

2−i,weget

T

(

i

)

i

1

+

2−i

+

i−2

j=0

(10)

Assumeforaninductionthat T

(

j

)

j2

/

6 all0

j

<

i.Then

T

(

i

)

i

1

+

2−i

+

i−1

j=0

2ji

·

j

2

6

=

i

1

+

2−i

+

1 6

·

i−1

j=0

2ji

·

j2

=

i

1

+

2−i

+

1 6

·

4i

+

6

+

i2

6

·

2−i

=

i2

6

+

i

3

whichimpliestheclaim.

2

5. AlternativelocalsearchesfortheAVM

We now show that other local searches used in the framework provided by AVM only require

Θ(

logd

)

evaluations insteadof

Θ((

logd

)

2

)

.ThisyieldssignificantspeedupsoverAVM’soriginallocalsearchmethodIPS,iftheinitialdistanced totheoptimumisnotverysmall.

Our results formally only hold for unimodalfunctions, butthey also indicate more generallythat the alternate local searchesconvergefastertolocaloptima.Thereasonisthatthebasinofattractionaroundalocaloptimumhastheproperties ofa unimodalfunction.So,ouranalysisisapplicablewheneverthesearch doesnot leavetheinitialbasin ofattraction.It further canbe used toestimate theremaining runningtime afterthe searchhas reachedacertain basin ofattractionas above.

5.1. AVMwithgeometricsearch

Weproposetousemorecleverlocalsearchesthatlocatetheoptimumofaunimodalfunctionmoreefficientlyafterthe firstexploration.ThefollowingGeometricSearchusesavariantofbinarysearch.Theideaistoperformapatternsearch,and thentousebinarysearchtohomeinonthetarget.Therebyweareusingthefollowingfact:ifpatternsearchqueriessearch points xj−1

,

xj

,

xj+1,stoppingatxj,weknowthat f

(

xj−1

)

>

f

(

xj

)

f

(

xj+1

)

.Thisimpliesthat,if f isunimodal,theglobal

minimum mustlie intheset

{

xj−1

,

. . . ,

xj+1

}

.Wecall it“GeometricSearch” sincethe initialpatternsearch isperformed

withageometricsequenceofnumbers.

Algorithm3GeometricSearch,startingatx

D.

1:if f(x−1)f(x)and f(x+1)f(x)returnx 2:if f(x−1)<f(x

+

1)then letk

:= −

1else letk:=1 3:while f(x+k)<f(x)do

4: letx:=x+k,k:=2k

5:let:=min(xk/2,x+k),r:=max(xk/2,x+k)

6:while<rdo

7: if f((+r)/2)<f((+r)/2 +1)then

8: r:= (+r)/2

9: else

10: := (+r)/2 +1

11:return

ThefollowingresultshowsthatAVMwithGeometricSearchfindstheoptimumofanyunimodalfunctionintime loga-rithmicintheinitialdistance.

Theorem4.Consideraone-dimensionalsearchonaunimodalfunction f:

Z

R

whered

1denotestheinitialdistancefromthe startingpointtotheoptimum.ThenGeometricSearchfindsanoptimumafterqueryingatmost3logd

+

5searchpoints.

Proof. Letibesuchthat2i

d

<

2i+1.BythesameargumentsasintheproofofTheorem 1patternsearchstopsateither

2i

1 or2i+1

1 afterqueryingatmosti

+

3 points.Wepessimisticallyassumethatitstopsat2i+1

1,whichresultsin thealgorithmputting

:=

2i

1 andr

:=

2i+2

1.Weclaimthateachiterationofbinarysearchupdates

,

rtowards

,

r suchthatr

(

r

)/

2

.Ifr

=

(

+

r

)/

2

wehave

r

=

+

r

2

=

r

(11)

Otherwise,

=

+2r

+

1 andusing

x

1

≤ −

x

forx

R

weget

r

=

r

+

r

2

1

r

+

+

r

2

=

r

2

.

Initially r

<

2i+2, andduetothe floorfunctionswe get thesame recurrence asfor2i+1.Two queriesare neededto replacethecurrentdistancebyitsfloored half,endingat0withnofurtherqueries.Henceweneedan additionalamount of2i

+

2 queries,leadingtoatotalof3i

+

5

3logd

+

5 queries.

2

Itiseasytoseethat,inthesettingofTheorem 4,GeometricSearchalwaysneeds3logd

±

O

(

1

)

queries:theinitialpattern search queries logd

±

O

(

1

)

points before proceedingto an elimination search on an interval oflength

Ω(

d

)

. Geometric Search onlystops afterthisinterval hasbeen reducedto asingle point. Sincehalving thisinterval makes 2queries, this processrequires2logd

±

O

(

1

)

furtherqueries.

5.2. AVMwithLatticeSearch

LatticeSearch[23,Section 8.2]isarefinementofFibonacciSearch[12]forintegerdomains.TheideaofFibonaccisearch istoevaluatesearchpointsaccordingtoFibonaccinumbers F1

=

1

,

F2

=

1,andFn+2

=

Fn

+

Fn+1 forn

N

insuchaway

that only onenew search pointneeds to be evaluated ineach iteration. Assumewe know that theoptimum isin some interval

[

,

+

Fn

]

.Fibonaccisearch wouldthen compare

+

Fn−2 and

+

Fn−1.If f

(

+

Fn−2

)

f

(

+

Fn−1

)

we know

thatanoptimummustbeintheinterval

[

,

+

Fn−1

]

,andweiteratebycomparing

+

Fn−3 and

+

Fn−2.Thelatterpoint

has alreadybeen evaluated, hence only one newevaluation is required.Likewise, if f

(

+

Fn−2

)

>

f

(

+

Fn−1

)

then an

optimummustliein

[

+

Fn−2

,

Fn

]

andweiteratebysetting

:=

+

Fn−2 andevaluating

+

Fn−3 and

+

Fn−2.Since

+

Fn−3

=

+

Fn−1,ithasalreadybeenevaluated,againleavingjustonenewevaluation.

In terms of unique evaluations, Fibonacci search is faster than Geometric search. Kiefer [12] showed that Fibonacci Search incontinuousdomains isanoptimalsearch techniqueinthefollowingsense. Considerall searchtechniquesusing afixednumberoffunctionevaluations.ThenFibonaccisearch hasthelargestpossibleintervalofinputvaluesforwhichit guaranteestofindasolutionwhosequalitydiffersbyatmost

ε

>

0 fromthatofanoptimum.

LatticeSearchfurtherrefinesthisprinciplebyexploitingthatforintegerdomainsinthecase f

(

+

Fn−2

)

f

(

+

Fn−1

)

thelastpoint

+

Fn−1 cannotbetheuniqueoptimum,hencetheintervalreducesbyonefurtherpointto

[

,

+

Fn−1

1

]

.

Likewise,intheothercasetheintervalbecomes

[

+

Fn−2

+

1

,

Fn

]

.Inbothcasestheintervalisreducedby1point,compared

to Fibonacci search. Thesegains accumulate in each iteration, and LatticeSearch onintegers needs even fewer function evaluationsthanFibonacciSearchonacomparablecontinuousdomain.

It isknownthat Latticesearch canfind theminimumof aunimodalfunction ona domainofintegers

{

1

, . . . ,

Fn

1

}

using n

2 function evaluations [23, p. 190] (note that Monahan [23, p. 190] uses the definition F0

=

1, F1

=

1, F2

=

2

,

. . .

).

ThelocalsearchusingLatticeSearchisshowninAlgorithm 4.

Algorithm4LatticeSearch,startingatx

D.

1:iff(x−1)f(x)and f(x+1)f(x)returnx 2:iff(x−1)<f(x+1)thenletk:= −1else letk:=1 3:whilef(x+k)<f(x)do

4: letx

:=

x+k,k:=2k

5:let

:=

min(xk/2,x+k),r:=max(xk/2,x+k)

6:letn:=min{n|Fnrl+2}

7:whilen>3do

8: if+Fn−1−1≤rand f(+Fn−2−1)

f(+Fn−1−1)then

9: let

:=

+Fn−2

10: letn:=n−1 11:return

Notethattheinitialpatternsearchisdoneinageometricfashion,i.e.,increasingthestepsizegeometricallyasinIPSand Geometric Search. Thereis arelatedsearch technique calledFibonaccianSearching [7](notto beconfused withFibonacci Search) where patternsearch is done by means of Fibonacci numbers.The reasonthat we are using geometric pattern searchisthatitisgenerallyfaster.

LatticeSearchfurtherimprovestheleadingconstantprecedingthelogdterm;usingFibonaccinumberstosearchforthe optimumintheintervalidentifiedbypatternsearchismoreefficientthanthebinarysearchusedinourGeometricSearch procedure.

(12)

Proof. Asinthepreviousproofs,patternsearchstopsafterqueryingatmost

logd

+

3

logd

+

4 points.Afterwards,lattice searchisrunonanintervalofsizeatmost 4d.

Let Fm bethesmallestFibonaccinumbersuchthat Fm

2

4d.WeknowthatLatticeSearch onaset

{

1

, . . . ,

Fm

1

}

usesm

2 functionevaluations[23,p. 190]withourdefinitionof Fm.Thiscorrespondstooursettingafteratrivialindex

transformation.

Usingawell-knownclosedformulaforFm,

Fm

=

(

1

+

5

)

m

(

1

5

)

m

2m

·

5

,

wegetforoddm,using

(

1

5

)

m

<

0,

Fm

1

5

·

1

+

5 2

m

.

Forevenm,weclearlyhave

Fm

Fm−1

1

5

·

1

+

5 2

m−1

=

2

5

+

5

·

1

+

5 2

m

.

Therefore,therequiredinequality Fm

4d

+

2 isimpliedby

1

+

5 2

m

(

4d

+

2

)

·

5

+

5 2

m

log

((

4d

+

2

)

·

√ 5+5

2

)

log

(

1+ √

5

2

)

.

The last term on the right-hand side is upper-bounded by 1

.

45logd

+

5. It follows that lattice search requires at most m

2

1

.

45logd

+

3 evaluations.Alongwiththetimeforpatternsearchthisprovestheclaim.

2

6. Experiments

WenowprovideanempiricalcomparisonoftheAVMusingouralternativelocalsearchestocomplementourtheoretical results.Wefirstshowresultsonsimplefunctions,designedtoprovideadditionalempiricalevidenceaboutthebetter scala-bilityofthealternativelocalsearches.However,real-worldprogramsarenotsostraightforward,involvingfitnesslandscapes ofvaryingshapes.Therefore,followingsomesimpleinitialexperiments,wecontinueontoperformingexperimentswithfive real-worldprograms.

6.1. Experimentswithunimodalfunctions

WereturntothesimpleandillustrativeproblemfromFig. 2(a)withjustasinglevariable,recallingthatthiscorresponds tothefollowingprogram:

void is_zero(int x) {

if (x == 0) { /* TARGET BRANCH */ }

}

The goalistofindaninput xthatisequaltozero.Theapproachleveliszero(sincethebranchingcondition isalways reached), andthebranchdistanceis norm

(

|

x

|

)

.Becausethe localsearchesdonot relyon comparingabsolutevalues,but insteadtheircorrespondingranks,thisproblemisequivalenttominimisingthefitnessfunction f

(

x

)

= |

x

|

(wherethebranch distanceisnotnormalised)asanalysedinTheorem 3.

Studyingthissimpleprogramallows ustoisolatetheimpactoftherangeandtheinitialdistancedfromtheoptimum ontherunningtimeoftheAVM.Ourtheoreticalresultsshowthat,whenthestartingpointischosenuniformlyatrandom fromaset

{−

d

,

. . . ,

d

1

}

fordapowerof 2,theAVMwithIPSwilltake

Θ((

logd

)

2

)

stepswhereastheAVMwithGeometric SearchorLatticeSearchwillsucceedinonly O

(

logd

)

steps.Ourtheoreticalresultsalsogiveboundswithpreciseconstants andprecisesmall-orderterms;experimentscanrevealfurtherinsightsintohowtighttheseboundsare.

Figure

Fig. 1. Exampleing program for which branch-covering test inputs are required, and a partial control flow graph (CFG) showing fitness function computation(AL = approach level, BD = branch distance) for execution of the true branch from the second “if” statement of the program at CFG node (3) (correspond- control flow graph node numbers appear to the left of relevant code statements).
Table 1
Fig. 2. Examples of different fitness landscapes, including simple example code for a single variable x that generates these landscapes; abs(x) denotes theabsolute value of x
Fig. 3. Comparisons of mean number of unique fitness evaluations for three strictly unimodal target branches with various local searches
+6

References

Related documents

Once you are settled and have explored the hotel, get ready for a private dinner at the hotel's restaurant with your fellow Adventurers and other guests of the hotel!. *The roads

Examining the traits of the ransomware shows that while the first encrypting ransomware was uncovered in 1989, the first use of strong cryptographic principles was

Each workshop involves a background briefing of the latest spray trial results, a practical exercise with spray equipment to measure water and sprayer air volume

responsible purpose, subject to proper attribution of authorship (Community standards, rather than copyright law, will continue to provide the mechanism for enforcement of

In league like MLS, where the level of parity is so high, good teams are losing matches to statistically “inferior” opponents on the road at a higher rate than other

(whether District, State or National) or by the Criminal Court then before issuing notice to the doctor or hospital against whom the complaint was made the Consumer Forum

These documents are made available for personal study and research purposes only, in accordance with the Canadian Copyright Act and the Creative Commons license—CC

Abbreviations: ALF, acute liver failure; ALFSG, Acute Liver Failure Study Group; APAP, acetaminophen overdose; BP, Bodily Pain; CDC, Centers for Disease Control and Prevention;