Sie sind auf Seite 1von 23

HILL CLIMBING

Heuristic Search
Aheuristic techniqueoftencalledsimplyaheuristic,isanyapproachto
problemsolving,learning,ordiscoverythatemploysapracticalmethodnot
guaranteedtobeoptimalorperfect,butsufficientfortheimmediategoals
Heuristicfunctionprobablyleadstoasolutionbutnotineverycase.
Wherefindinganoptimalsolutionisimpossibleorimpractical,heuristic
methodscanbeusedtospeeduptheprocessoffindingasatisfactorysolution.
Heuristicshelptoreducethenumberofalternativesfromanexponential
numbertoapolynomialnumber.
Eg:usingaruleofthumb,aneducatedguess,anintuitivejudgment,
stereotyping,profiling,orcommonsense.

Types of heuristic search

GenerateandTest
HillClimbing
BestFirstSearch
ProblemReduction
Constraintsatisfaction
Means-endsanalysis

Hill Climbing
Incomputerscience,hill climbingisaniterativealgorithmthat
startswithanarbitrarysolutiontoaproblem,thenattemptsto
findabettersolutionbyincrementallychangingasingleelement
ofthesolution.
Ifthechangeproducesabettersolution,anincrementalchangeis
madetothenewsolution,repeatinguntilnofurther
improvementscanbefound

Simple Hill Climbing


Algorithm
1. Evaluatetheinitialstate.
2. Loopuntilasolutionisfoundorthereareno
newoperatorslefttobeapplied:
Selectandapplyanewoperator
Evaluatethenewstate:
goalquit
betterthancurrentstatenewcurrentstate

EXAMPLE
Heuristic- Number of tiles in the
incorrect position.
This can also be considered a
lower bound on the number of
moves from a solution!
The best move is the one with
the lowest number returned by the
heuristic.

N QUEENS PROBLEM

Simple Hill Climbing Example


TSP-definestatespaceasthesetofallpossibletours.
Operatorsexchangethepositionofadjacentcitieswithinthe
currenttour.
Heuristicfunctionisthelengthofatour.

TSP Hill Climb State Space


Initial State

ABCD
ABCD
Swap 1,2
BACD
BACD

Swap 2,3
Swap 3,4
ACBD
ACBD

Swap 1,2

Swap 3,4

Swap 2,3
CABD
CABD

ABCD
ABCD

ABDC
ABDC

Swap 4,1
ACDB
ACDB

DCBA
DCBA

Swap 4,1
DBCA
DBCA

10

Steepest-Ascent Hill Climbing (Gradient Search)


Considersallthemovesfromthecurrentstate.
Selectsthebestoneasthenextstate.
Alsocalledgradientsearch.

11

Steepest-Ascent Hill Climbing (Gradient Search)


Algorithm
1. Evaluatetheinitialstate.

2. Loopuntilasolutionisfoundoracomplete
iterationproducesnochangetocurrentstate:
SUCC=astatesuchthatanypossiblesuccessorofthe
currentstatewillbebetterthanSUCC(theworststate).
Foreachoperatorthatappliestothecurrentstate,evaluate
thenewstate:
goalquit
betterthanSUCCsetSUCCtothisstate
SUCCisbetterthanthecurrentstatesetthecurrent
statetoSUCC.

12

Simulated Annealing
Avariationofhillclimbinginwhich,atthebeginningofthe
process,somedownhillmovesmaybemade.

Todoenoughexplorationofthewholespaceearlyon,sothatthe
finalsolutionisrelativelyinsensitivetothestartingstate.

Loweringthechancesofgettingcaughtatalocalmaximum,or
plateau,oraridge.

13

Simulated Annealing
PhysicalAnnealing

Physicalsubstancesaremeltedandthengraduallycooleduntil
somesolidstateisreached.

Thegoalistoproduceaminimal-energystate.
Annealingschedule:ifthetemperatureisloweredsufficiently
slowly,thenthegoalwillbeattained.

Nevertheless,thereissomeprobabilityforatransitiontoahigher
energystate:eE/kT.

14

Hill Climbing: Disadvantages


Localmaximum
Astatethatisbetterthanallofitsneighbours,butnot
betterthansomeotherstatesfaraway.

Simulatedannealingtacklesthelocalmaximaissuebyallowingsomestepstobe
takenwhichdecreasetheimmediateoptimalityofthecurrentstate.Algorithmssuch
assimulatedannealingcansometimesmakechangesthatmakethingsworse,at
leasttemporarily.Thisallowsfortheavoidanceofdeadendsinthesearchpath.

Example of local maxima

16

Hill Climbing: Disadvantages


Plateau
Aflatareaofthesearchspaceinwhichallneighbouring
stateshavethesamevalue.

17

Hill Climbing: Disadvantages


Ridge
Theorientationofthehighregion,comparedtotheset
ofavailablemoves,makesitimpossibletoclimbup.
However,twomovesexecutedseriallymayincrease
theheight.

18

Hill Climbing: Disadvantages


Ridge
Theorientationofthehighregion,comparedtotheset
ofavailablemoves,makesitimpossibletoclimbup.
However,twomovesexecutedseriallymayincrease
theheight.

19

Solving the Problems


Allowbacktracking-Backtracktosomeearliernodeandtrygoingina
differentdirection(complexityincreases).
Randomrestarts:Ifatfirstyoudontsucceed,try,tryagain.
Severalmovesineachofseveraldirections,thentest.
Jumptoadifferentpartofthesearchspace(ridges).

APPLICATIONS
Hillclimbingcanbeappliedtoanyproblemwherethecurrentstateallowsfor
anaccurateevaluationfunctionsuchas
thetravellingsalesmanproblem,
Newtonsmethodoffindingrootofafunction
andavarietyofotherreal-worldproblems.
HillClimbinghasalsobeenusedinroboticstomanagemultiple-robotteams.
OnesuchexampleistheParishalgorithm,whichallowsforscalableand
efficientcoordinationinmulti-robotsystems.Thegroupofresearchers
designedateamofrobots[that]mustcoordinatetheiractionssoasto
guaranteelocationofaskilledevader.

21

Hill Climbing: Conclusion


Canbeveryinefficientinalarge,roughproblemspace.
Globalheuristicmayhavetopayforcomputationalcomplexity.
Oftenusefulwhencombinedwithothermethods,gettingitstarted
rightintherightgeneralneighbourhood.

RESOUCES
https://en.wikibooks.org/wiki/Algorithms/Hill_Climbing
https://en.wikipedia.org/wiki/Hill_climbing

Thank You

Das könnte Ihnen auch gefallen