FROM WIKIPEDIA,
THE FREE ENCYCLOPEDIA.
VERSION NUMBER 1125897531.
SIMULATED ANNEALING (SA) IS A PROBABILISTIC TECHNIQUE FOR APPROXIMATING THE GLOBAL OPTIMUM OF A GIVEN FUNCTION. SPECIFICALLY, IT IS A METAHEURISTIC TO APPROXIMATE GLOBAL OPTIMIZATION IN A LARGE SEARCH SPACE FOR AN OPTIMIZATION PROBLEM. IT IS OFTEN USED WHEN THE SEARCH SPACE IS DISCRETE (FOR EXAMPLE THE TRAVELING SALESMAN PROBLEM, THE BOOLEAN SATISFIABILITY PROBLEM, PROTEIN STRUCTURE PREDICTION, AND JOB-SHOP SCHEDULING). FOR PROBLEMS WHERE FINDING AN APPROXIMATE GLOBAL OPTIMUM IS MORE IMPORTANT THAN FINDING A PRECISE LOCAL OPTIMUM IN A FIXED AMOUNT OF TIME, SIMULATED ANNEALING MAY BE PREFERABLE TO EXACT ALGORITHMS SUCH AS GRADIENT DESCENT OR BRANCH AND BOUND.
THE NAME OF THE ALGORITHM COMES FROM ANNEALING IN METALLURGY, A TECHNIQUE INVOLVING HEATING AND CONTROLLED COOLING OF A MATERIAL TO ALTER ITS PHYSICAL PROPERTIES. BOTH ARE ATTRIBUTES OF THE MATERIAL THAT DEPEND ON THEIR THERMODYNAMIC FREE ENERGY. HEATING AND COOLING THE MATERIAL AFFECTS BOTH THE TEMPERATURE AND THE THERMODYNAMIC FREE ENERGY OR GIBBS ENERGY. SIMULATED ANNEALING CAN BE USED FOR VERY HARD COMPUTATIONAL OPTIMIZATION PROBLEMS WHERE EXACT ALGORITHMS FAIL; EVEN THOUGH IT USUALLY ACHIEVES AN APPROXIMATE SOLUTION TO THE GLOBAL MINIMUM, IT COULD BE ENOUGH FOR MANY PRACTICAL PROBLEMS.
THE PROBLEMS SOLVED BY SA ARE CURRENTLY FORMULATED BY AN OBJECTIVE FUNCTION OF MANY VARIABLES, SUBJECT TO SEVERAL CONSTRAINTS. IN PRACTICE, THE CONSTRAINT CAN BE PENALIZED AS PART OF THE OBJECTIVE FUNCTION.
SIMILAR TECHNIQUES HAVE BEEN INDEPENDENTLY INTRODUCED ON SEVERAL OCCASIONS, INCLUDING PINCUS (1970), KHACHATURYAN ET AL (1979, 1981), KIRKPATRICK, GELATT AND VECCHI (1983), AND CERNY (1985). IN 1983, THIS APPROACH WAS USED BY KIRKPATRICK, GELATT JR., VECCHI, FOR A SOLUTION OF THE TRAVELING SALESMAN PROBLEM. THEY ALSO PROPOSED ITS CURRENT NAME, SIMULATED ANNEALING.
THIS NOTION OF SLOW COOLING IMPLEMENTED IN THE SIMULATED ANNEALING ALGORITHM IS INTERPRETED AS A SLOW DECREASE IN THE PROBABILITY OF ACCEPTING WORSE SOLUTIONS AS THE SOLUTION SPACE IS EXPLORED. ACCEPTING WORSE SOLUTIONS ALLOWS FOR A MORE EXTENSIVE SEARCH FOR THE GLOBAL OPTIMAL SOLUTION. IN GENERAL, SIMULATED ANNEALING ALGORITHMS WORK AS FOLLOWS. THE TEMPERATURE PROGRESSIVELY DECREASES FROM AN INITIAL POSITIVE VALUE TO ZERO. AT EACH TIME STEP, THE ALGORITHM RANDOMLY SELECTS A SOLUTION CLOSE TO THE CURRENT ONE, MEASURES ITS QUALITY, AND MOVES TO IT ACCORDING TO THE TEMPERATURE-DEPENDENT PROBABILITIES OF SELECTING BETTER OR WORSE SOLUTIONS, WHICH DURING THE SEARCH RESPECTIVELY REMAIN AT 1 (OR POSITIVE) AND DECREASE TOWARD ZERO.
THE SIMULATION CAN BE PERFORMED EITHER BY A SOLUTION OF KINETIC EQUATIONS FOR DENSITY FUNCTIONS OR BY USING THE STOCHASTIC SAMPLING METHOD. THE METHOD IS AN ADAPTATION OF THE METROPOLIS–HASTINGS ALGORITHM, A MONTE CARLO METHOD TO GENERATE SAMPLE STATES OF A THERMODYNAMIC SYSTEM, PUBLISHED BY N. METROPOLIS ET AL. IN 1953.
THE STATE OF SOME PHYSICAL SYSTEMS, AND THE FUNCTION E(S) TO BE MINIMIZED, IS ANALOGOUS TO THE INTERNAL ENERGY OF THE SYSTEM IN THAT STATE. THE GOAL IS TO BRING THE SYSTEM, FROM AN ARBITRARY INITIAL STATE, TO A STATE WITH THE MINIMUM POSSIBLE ENERGY.
AT EACH STEP, THE SIMULATED ANNEALING HEURISTIC CONSIDERS SOME NEIGHBORING STATE S* OF THE CURRENT STATE S, AND PROBABILISTICALLY DECIDES BETWEEN MOVING THE SYSTEM TO STATE S* OR STAYING IN-STATE S. THESE PROBABILITIES ULTIMATELY LEAD THE SYSTEM TO MOVE TO STATES OF LOWER ENERGY. TYPICALLY THIS STEP IS REPEATED UNTIL THE SYSTEM REACHES A STATE THAT IS GOOD ENOUGH FOR THE APPLICATION, OR UNTIL A GIVEN COMPUTATION BUDGET HAS BEEN EXHAUSTED.
OPTIMIZATION OF A SOLUTION INVOLVES EVALUATING THE NEIGHBOURS OF A STATE OF THE PROBLEM, WHICH ARE NEW STATES PRODUCED THROUGH CONSERVATIVELY ALTERING A GIVEN STATE. FOR EXAMPLE, IN THE TRAVELING SALESMAN PROBLEM EACH STATE IS TYPICALLY DEFINED AS A PERMUTATION OF THE CITIES TO BE VISITED, AND THE NEIGHBORS OF ANY STATE ARE THE SET OF PERMUTATIONS PRODUCED BY SWAPPING ANY TWO OF THESE CITIES. THE WELL-DEFINED WAY IN WHICH THE STATES ARE ALTERED TO PRODUCE NEIGHBORING STATES IS CALLED A "MOVE", AND DIFFERENT MOVES GIVE DIFFERENT SETS OF NEIGHBORING STATES. THESE MOVES USUALLY RESULT IN MINIMAL ALTERATIONS OF THE LAST STATE, IN AN ATTEMPT TO PROGRESSIVELY IMPROVE THE SOLUTION THROUGH ITERATIVELY IMPROVING ITS PARTS (SUCH AS THE CITY CONNECTIONS IN THE TRAVELING SALESMAN PROBLEM).
SIMPLE HEURISTICS LIKE HILL CLIMBING, WHICH MOVE BY FINDING BETTER NEIGHBOUR AFTER BETTER NEIGHBOUR AND STOP WHEN THEY HAVE REACHED A SOLUTION WHICH HAS NO NEIGHBOURS THAT ARE BETTER SOLUTIONS, CANNOT GUARANTEE TO LEAD TO ANY OF THE EXISTING BETTER SOLUTIONS – THEIR OUTCOME MAY EASILY BE JUST A LOCAL OPTIMUM, WHILE THE ACTUAL BEST SOLUTION WOULD BE A GLOBAL OPTIMUM THAT COULD BE DIFFERENT. METAHEURISTICS USE THE NEIGHBOURS OF A SOLUTION AS A WAY TO EXPLORE THE SOLUTION SPACE, AND ALTHOUGH THEY PREFER BETTER NEIGHBOURS, THEY ALSO ACCEPT WORSE NEIGHBOURS IN ORDER TO AVOID GETTING STUCK IN LOCAL OPTIMA; THEY CAN FIND THE GLOBAL OPTIMUM IF RUN FOR A LONG ENOUGH AMOUNT OF TIME.
THE PROBABILITY OF MAKING THE TRANSITION FROM THE CURRENT STATE 'S' TO A CANDIDATE NEW STATE 'S.NEW' IS SPECIFIED BY AN 'ACCEPTANCE PROBABILITY FUNCTION' 'P(E, E.NEW, T)' THAT DEPENDS ON THE ENERGIES 'E = E(S)' AND 'E.NEW = E(S.NEW)' OF THE TWO STATES, AND ON A GLOBAL TIME-VARYING PARAMETER T CALLED THE 'TEMPERATURE'. STATES WITH A SMALLER ENERGY ARE BETTER THAN THOSE WITH A GREATER ENERGY. THE PROBABILITY FUNCTION 'P' MUST BE POSITIVE EVEN WHEN 'E.NEW' IS GREATER THAN 'E'. THIS FEATURE PREVENTS THE METHOD FROM BECOMING STUCK AT A LOCAL MINIMUM THAT IS WORSE THAN THE GLOBAL ONE.
WHEN 'T' TENDS TO ZERO, THE PROBABILITY 'P(E, E.NEW, T)' MUST TEND TO ZERO IF 'E.NEW' IS GREATER THAN 'E' AND TO A POSITIVE VALUE OTHERWISE. FOR SUFFICIENTLY SMALL VALUES OF 'T', THE SYSTEM WILL THEN INCREASINGLY FAVOR MOVES THAT GO ''DOWNHILL'' (I.E., TO LOWER ENERGY VALUES), AND AVOID THOSE THAT GO ''UPHILL''. WITH 'T' = 0 THE PROCEDURE REDUCES TO THE GREEDY ALGORITHM, WHICH MAKES ONLY THE DOWNHILL TRANSITIONS.
IN THE ORIGINAL DESCRIPTION OF SIMULATED ANNEALING, THE PROBABILITY 'P(E, E.NEW, T)' WAS EQUAL TO 1 WHEN 'E.NEW' IS LESS THAN 'E' -- I.E., THE PROCEDURE ALWAYS MOVED DOWNHILL WHEN IT FOUND A WAY TO DO SO, IRRESPECTIVE OF THE TEMPERATURE. MANY DESCRIPTIONS AND IMPLEMENTATIONS OF SIMULATED ANNEALING STILL TAKE THIS CONDITION AS PART OF THE METHOD'S DEFINITION. HOWEVER, THIS CONDITION IS NOT ESSENTIAL FOR THE METHOD TO WORK.
THE 'P' FUNCTION IS USUALLY CHOSEN SO THAT THE PROBABILITY OF ACCEPTING A MOVE DECREASES WHEN THE DIFFERENCE 'E.NEW MINUS E' INCREASES -- THAT IS, SMALL UPHILL MOVES ARE MORE LIKELY THAN LARGE ONES. HOWEVER, THIS REQUIREMENT IS NOT STRICTLY NECESSARY, PROVIDED THAT THE ABOVE REQUIREMENTS ARE MET.
GIVEN THESE PROPERTIES, THE TEMPERATURE 'T' PLAYS A CRUCIAL ROLE IN CONTROLLING THE EVOLUTION OF THE STATE 'S' OF THE SYSTEM WITH REGARD TO ITS SENSITIVITY TO THE VARIATIONS OF SYSTEM ENERGIES. TO BE PRECISE, FOR A LARGE 'T', THE EVOLUTION OF 'S' IS SENSITIVE TO COARSER ENERGY VARIATIONS, WHILE IT IS SENSITIVE TO FINER ENERGY VARIATIONS WHEN 'T' IS SMALL.
THE NAME AND INSPIRATION OF THE ALGORITHM DEMAND AN INTERESTING FEATURE RELATED TO THE TEMPERATURE VARIATION TO BE EMBEDDED IN THE OPERATIONAL CHARACTERISTICS OF THE ALGORITHM. THIS NECESSITATES A GRADUAL REDUCTION OF THE TEMPERATURE AS THE SIMULATION PROCEEDS. THE ALGORITHM STARTS INITIALLY WITH 'T' SET TO A HIGH VALUE (OR INFINITY), AND THEN IT IS DECREASED AT EACH STEP FOLLOWING SOME 'ANNEALING SCHEDULE' -- WHICH MAY BE SPECIFIED BY THE USER, BUT MUST END WITH 'T' = 0 TOWARDS THE END OF THE ALLOTTED TIME BUDGET. IN THIS WAY, THE SYSTEM IS EXPECTED TO WANDER INITIALLY TOWARDS A BROAD REGION OF THE SEARCH SPACE CONTAINING GOOD SOLUTIONS, IGNORING SMALL FEATURES OF THE ENERGY FUNCTION; THEN DRIFT TOWARDS LOW-ENERGY REGIONS THAT BECOME NARROWER AND NARROWER, AND FINALLY MOVE DOWNHILL ACCORDING TO THE STEEPEST DESCENT HEURISTIC.
FOR ANY GIVEN FINITE PROBLEM, THE PROBABILITY THAT THE SIMULATED ANNEALING ALGORITHM TERMINATES WITH A GLOBAL OPTIMAL SOLUTION APPROACHES 1 AS THE ANNEALING SCHEDULE IS EXTENDED. THIS THEORETICAL RESULT, HOWEVER, IS NOT PARTICULARLY HELPFUL, SINCE THE TIME REQUIRED TO ENSURE A SIGNIFICANT PROBABILITY OF SUCCESS WILL USUALLY EXCEED THE TIME REQUIRED FOR A COMPLETE SEARCH OF THE SOLUTION SPACE.
THE FOLLOWING PSEUDOCODE PRESENTS THE SIMULATED ANNEALING HEURISTIC AS DESCRIBED ABOVE. IT STARTS FROM A STATE 'S.0' AND CONTINUES UNTIL A MAXIMUM OF 'K.MAX' STEPS HAVE BEEN TAKEN. IN THE PROCESS, THE CALL 'NEIGHBOUR(S)' SHOULD GENERATE A RANDOMLY CHOSEN NEIGHBOUR OF A GIVEN STATE 'S'; THE CALL 'RANDOM(0, 1)' SHOULD PICK AND RETURN A VALUE IN THE RANGE (0, 1), UNIFORMLY AT RANDOM. THE ANNEALING SCHEDULE IS DEFINED BY THE CALL 'TEMPERATURE(R)', WHICH SHOULD YIELD THE TEMPERATURE TO USE, GIVEN THE FRACTION R OF THE TIME BUDGET THAT HAS BEEN EXPENDED SO FAR.
IN ORDER TO APPLY THE SIMULATED ANNEALING METHOD TO A SPECIFIC PROBLEM, ONE MUST SPECIFY THE FOLLOWING PARAMETERS: THE STATE SPACE, THE ENERGY (GOAL) FUNCTION 'E()', THE CANDIDATE GENERATOR PROCEDURE 'NEIGHBOUR()', THE ACCEPTANCE PROBABILITY FUNCTION 'P()', AND THE ANNEALING SCHEDULE 'TEMPERATURE()' AND INITIAL TEMPERATURE 'INIT-TEMP'. THESE CHOICES CAN HAVE A SIGNIFICANT IMPACT ON THE METHOD'S EFFECTIVENESS. UNFORTUNATELY, THERE ARE NO CHOICES OF THESE PARAMETERS THAT WILL BE GOOD FOR ALL PROBLEMS, AND THERE IS NO GENERAL WAY TO FIND THE BEST CHOICES FOR A GIVEN PROBLEM. THE FOLLOWING SECTIONS GIVE SOME GENERAL GUIDELINES.
SIMULATED ANNEALING MAY BE MODELED AS A RANDOM WALK ON A SEARCH GRAPH, WHOSE VERTICES ARE ALL POSSIBLE STATES, AND WHOSE EDGES ARE THE CANDIDATE MOVES. AN ESSENTIAL REQUIREMENT FOR THE 'NEIGHBOUR()' FUNCTION IS THAT IT MUST PROVIDE A SUFFICIENTLY SHORT PATH ON THIS GRAPH FROM THE INITIAL STATE TO ANY STATE WHICH MAY BE THE GLOBAL OPTIMUM -- THE DIAMETER OF THE SEARCH GRAPH MUST BE SMALL. IN THE TRAVELING SALESMAN EXAMPLE ABOVE, FOR INSTANCE, THE SEARCH SPACE FOR N = 20 CITIES HAS N! = 2,432,902,008,176,640,000 (2.4 QUINTILLION) STATES; YET THE NUMBER OF NEIGHBORS OF EACH VERTEX IS ( SUM FROM K=1 TO (N-1) OF K, EQUAL TO (N(N-1))/2, EQUAL TO 190 ) EDGES (COMING FROM N CHOOSE 2), AND THE DIAMETER OF THE GRAPH IS N - 1.
TO INVESTIGATE THE BEHAVIOR OF SIMULATED ANNEALING ON A PARTICULAR PROBLEM, IT CAN BE USEFUL TO CONSIDER THE TRANSITION PROBABILITIES THAT RESULT FROM THE VARIOUS DESIGN CHOICES MADE IN THE IMPLEMENTATION OF THE ALGORITHM. FOR EACH EDGE '(S, S-PRIME)' OF THE SEARCH GRAPH, THE TRANSITION PROBABILITY IS DEFINED AS THE PROBABILITY THAT THE SIMULATED ANNEALING ALGORITHM WILL MOVE TO STATE 'S-PRIME' WHEN ITS CURRENT STATE IS 'S'. THIS PROBABILITY DEPENDS ON THE CURRENT TEMPERATURE AS SPECIFIED BY 'TEMPERATURE()', ON THE ORDER IN WHICH THE CANDIDATE MOVES ARE GENERATED BY THE 'NEIGHBOUR()' FUNCTION, AND ON THE ACCEPTANCE PROBABILITY FUNCTION 'P()'. (NOTE THAT THE TRANSITION PROBABILITY IS NOT SIMPLY 'P(E, E-PRIME, T)', BECAUSE THE CANDIDATES ARE TESTED SERIALLY.)
THE SPECIFICATION OF 'NEIGHBOUR()', 'P()', AND 'TEMPERATURE()' IS PARTIALLY REDUNDANT. IN PRACTICE, IT'S COMMON TO USE THE SAME ACCEPTANCE FUNCTION 'P()' FOR MANY PROBLEMS, AND ADJUST THE OTHER TWO FUNCTIONS ACCORDING TO THE SPECIFIC PROBLEM.
IN THE FORMULATION OF THE METHOD BY KIRKPATRICK ET AL., THE ACCEPTANCE PROBABILITY FUNCTION 'P(E, E-PRIME, T)' WAS DEFINED AS 1 IF 'E-PRIME LESS THAN E', AND 'EXP(MINUS (E-PRIME MINUS E)/T)' OTHERWISE. THIS FORMULA WAS SUPERFICIALLY JUSTIFIED BY ANALOGY WITH THE TRANSITIONS OF A PHYSICAL SYSTEM; IT CORRESPONDS TO THE METROPOLIS-HASTINGS ALGORITHM, IN THE CASE WHERE T=1 AND THE PROPOSAL DISTRIBUTION OF METROPOLIS-HASTINGS IS SYMMETRIC. HOWEVER, THIS ACCEPTANCE PROBABILITY IS OFTEN USED FOR SIMULATED ANNEALING EVEN WHEN THE NEIGHBOUR() FUNCTION, WHICH IS ANALOGOUS TO THE PROPOSAL DISTRIBUTION IN METROPOLIS-HASTINGS, IS NOT SYMMETRIC, OR NOT PROBABILISTIC AT ALL. AS A RESULT, THE TRANSITION PROBABILITIES OF THE SIMULATED ANNEALING ALGORITHM DO NOT CORRESPOND TO THE TRANSITIONS OF THE ANALOGOUS PHYSICAL SYSTEM, AND THE LONG-TERM DISTRIBUTION OF STATES AT A CONSTANT TEMPERATURE 'T' NEED NOT BEAR ANY RESEMBLANCE TO THE THERMODYNAMIC EQUILIBRIUM DISTRIBUTION OVER STATES OF THAT PHYSICAL SYSTEM, AT ANY TEMPERATURE. NEVERTHELESS, MOST DESCRIPTIONS OF SIMULATED ANNEALING ASSUME THE ORIGINAL ACCEPTANCE FUNCTION, WHICH IS PROBABLY HARD-CODED IN MANY IMPLEMENTATIONS OF SA.
IN 1990, MOSCATO AND FONTANARI, AND INDEPENDENTLY DUECK AND SCHEUER, PROPOSED THAT A DETERMINISTIC UPDATE (I.E. ONE THAT IS NOT BASED ON THE PROBABILISTIC ACCEPTANCE RULE) COULD SPEED-UP THE OPTIMIZATION PROCESS WITHOUT IMPACTING ON THE FINAL QUALITY. MOSCATO AND FONTANARI CONCLUDE FROM OBSERVING THE ANALOGOUS OF THE ''SPECIFIC HEAT'' CURVE OF THE ''THRESHOLD UPDATING'' ANNEALING ORIGINATING FROM THEIR STUDY THAT ''THE STOCHASTICITY OF THE METROPOLIS UPDATING IN THE SIMULATED ANNEALING ALGORITHM DOES NOT PLAY A MAJOR ROLE IN THE SEARCH OF NEAR-OPTIMAL MINIMA''. INSTEAD, THEY PROPOSED THAT ''THE SMOOTHENING OF THE COST FUNCTION LANDSCAPE AT HIGH TEMPERATURE AND THE GRADUAL DEFINITION OF THE MINIMA DURING THE COOLING PROCESS ARE THE FUNDAMENTAL INGREDIENTS FOR THE SUCCESS OF SIMULATED ANNEALING.'' THE METHOD SUBSEQUENTLY POPULARIZED UNDER THE DENOMINATION OF ''THRESHOLD ACCEPTING'' DUE TO DUECK AND SCHEUER'S DENOMINATION. IN 2001, FRANZ, HOFFMANN AND SALAMON SHOWED THAT THE DETERMINISTIC UPDATE STRATEGY IS INDEED THE OPTIMAL ONE WITHIN THE LARGE CLASS OF ALGORITHMS THAT SIMULATE A RANDOM WALK ON THE COST/ENERGY LANDSCAPE.
WHEN CHOOSING THE CANDIDATE GENERATOR 'NEIGHBOUR()', ONE MUST CONSIDER THAT AFTER A FEW ITERATIONS OF THE SIMULATED ANNEALING ALGORITHM, THE CURRENT STATE IS EXPECTED TO HAVE MUCH LOWER ENERGY THAN A RANDOM STATE. THEREFORE, AS A GENERAL RULE, ONE SHOULD SKEW THE GENERATOR TOWARDS CANDIDATE MOVES WHERE THE ENERGY OF THE DESTINATION STATE 'S-PRIME' IS LIKELY TO BE SIMILAR TO THAT OF THE CURRENT STATE. THIS HEURISTIC (WHICH IS THE MAIN PRINCIPLE OF THE METROPOLIS-HASTINGS ALGORITHM) TENDS TO EXCLUDE ''VERY GOOD'' CANDIDATE MOVES AS WELL AS ''VERY BAD'' ONES; HOWEVER, THE FORMER ARE USUALLY MUCH LESS COMMON THAN THE LATTER, SO THE HEURISTIC IS GENERALLY QUITE EFFECTIVE.
IN THE TRAVELING SALESMAN PROBLEM ABOVE, FOR EXAMPLE, SWAPPING TWO CONSECUTIVE CITIES IN A LOW-ENERGY TOUR IS EXPECTED TO HAVE A MODEST EFFECT ON ITS ENERGY (LENGTH); WHEREAS SWAPPING TWO ARBITRARY CITIES IS FAR MORE LIKELY TO INCREASE ITS LENGTH THAN TO DECREASE IT. THUS, THE CONSECUTIVE-SWAP NEIGHBOUR GENERATOR IS EXPECTED TO PERFORM BETTER THAN THE ARBITRARY-SWAP ONE, EVEN THOUGH THE LATTER COULD PROVIDE A SOMEWHAT SHORTER PATH TO THE OPTIMUM (WITH N-1 SWAPS, INSTEAD OF N(N-1)/2.
A MORE PRECISE STATEMENT OF THE HEURISTIC IS THAT ONE SHOULD TRY FIRST CANDIDATE STATES 'S' FOR WHICH 'P(E, E-PRIME, T)' IS LARGE. FOR THE ''STANDARD'' ACCEPTANCE FUNCTION 'P' ABOVE, IT MEANS THAT 'E(S-PRIME) - E(S)' IS ON THE ORDER OF 'T' OR LESS. THUS, IN THE TRAVELING SALESMAN EXAMPLE ABOVE, ONE COULD USE A 'NEIGHBOUR()' FUNCTION THAT SWAPS TWO RANDOM CITIES, WHERE THE PROBABILITY OF CHOOSING A CITY-PAIR VANISHES AS THEIR DISTANCE INCREASES BEYOND 'T'.
WHEN CHOOSING THE CANDIDATE GENERATOR NEIGHBOUR() ONE MUST ALSO TRY TO REDUCE THE NUMBER OF ''DEEP'' LOCAL MINIMA -- STATES (OR SETS OF CONNECTED STATES) THAT HAVE MUCH LOWER ENERGY THAN ALL ITS NEIGHBOURING STATES. SUCH ''CLOSED CATCHMENT BASINS'' OF THE ENERGY FUNCTION MAY TRAP THE SIMULATED ANNEALING ALGORITHM WITH HIGH PROBABILITY (ROUGHLY PROPORTIONAL TO THE NUMBER OF STATES IN THE BASIN) AND FOR A VERY LONG TIME (ROUGHLY EXPONENTIAL ON THE ENERGY DIFFERENCE BETWEEN THE SURROUNDING STATES AND THE BOTTOM OF THE BASIN). AS A RULE, IT IS IMPOSSIBLE TO DESIGN A CANDIDATE GENERATOR THAT WILL SATISFY THIS GOAL AND ALSO PRIORITIZE CANDIDATES WITH SIMILAR ENERGY. ON THE OTHER HAND, ONE CAN OFTEN VASTLY IMPROVE THE EFFICIENCY OF SIMULATED ANNEALING BY RELATIVELY SIMPLE CHANGES TO THE GENERATOR. IN THE TRAVELING SALESMAN PROBLEM, FOR INSTANCE, IT IS NOT HARD TO EXHIBIT TWO TOURS 'A', 'B', WITH NEARLY EQUAL LENGTHS, SUCH THAT (1) 'A' IS OPTIMAL, (2) EVERY SEQUENCE OF CITY-PAIR SWAPS THAT CONVERTS 'A' TO 'B' GOES THROUGH TOURS THAT ARE MUCH LONGER THAN BOTH, AND (3) 'A' CAN BE TRANSFORMED INTO 'B' BY FLIPPING (REVERSING THE ORDER OF) A SET OF CONSECUTIVE CITIES. IN THIS EXAMPLE, 'A' AND 'B' LIE IN DIFFERENT ''DEEP BASINS'' IF THE GENERATOR PERFORMS ONLY RANDOM PAIR-SWAPS; BUT THEY WILL BE IN THE SAME BASIN IF THE GENERATOR PERFORMS RANDOM SEGMENT-FLIPS.
THE PHYSICAL ANALOGY THAT IS USED TO JUSTIFY SIMULATED ANNEALING ASSUMES THAT THE COOLING RATE IS LOW ENOUGH FOR THE PROBABILITY DISTRIBUTION OF THE CURRENT STATE TO BE NEAR THERMODYNAMIC EQUILIBRIUM AT ALL TIMES. UNFORTUNATELY, THE RELAXATION TIME -- THE TIME ONE MUST WAIT FOR THE EQUILIBRIUM TO BE RESTORED AFTER A CHANGE IN TEMPERATURE -- STRONGLY DEPENDS ON THE ''TOPOGRAPHY'' OF THE ENERGY FUNCTION AND ON THE CURRENT TEMPERATURE. IN THE SIMULATED ANNEALING ALGORITHM, THE RELAXATION TIME ALSO DEPENDS ON THE CANDIDATE GENERATOR, IN A VERY COMPLICATED WAY. NOTE THAT ALL THESE PARAMETERS ARE USUALLY PROVIDED AS BLACK BOX FUNCTIONS TO THE SIMULATED ANNEALING ALGORITHM. THEREFORE, THE IDEAL COOLING RATE CANNOT BE DETERMINED BEFOREHAND, AND SHOULD BE EMPIRICALLY ADJUSTED FOR EACH PROBLEM. ADAPTIVE SIMULATED ANNEALING ALGORITHMS ADDRESS THIS PROBLEM BY CONNECTING THE COOLING SCHEDULE TO THE SEARCH PROGRESS. OTHER ADAPTIVE APPROACH AS THERMODYNAMIC SIMULATED ANNEALING, AUTOMATICALLY ADJUSTS THE TEMPERATURE AT EACH STEP BASED ON THE ENERGY DIFFERENCE BETWEEN THE TWO STATES, ACCORDING TO THE LAWS OF THERMODYNAMICS.
SOMETIMES IT IS BETTER TO MOVE BACK TO A SOLUTION THAT WAS SIGNIFICANTLY BETTER RATHER THAN ALWAYS MOVING FROM THE CURRENT STATE. THIS PROCESS IS CALLED RESTARTING OF SIMULATED ANNEALING. TO DO THIS WE SET 'S' AND 'E' TO 'S.BEST' AND 'E.BEST' AND PERHAPS RESTART THE ANNEALING SCHEDULE. THE DECISION TO RESTART COULD BE BASED ON SEVERAL CRITERIA. NOTABLE AMONG THESE INCLUDE RESTARTING BASED ON A FIXED NUMBER OF STEPS, BASED ON WHETHER THE CURRENT ENERGY IS TOO HIGH COMPARED TO THE BEST ENERGY OBTAINED SO FAR, RESTARTING RANDOMLY, ETC.