page474.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 91 行
HTML
91 行
<HTML><HEAD><TITLE>Simulated Annealing</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html6622" HREF="page475.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6620" HREF="page464.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6616" HREF="page473.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html6624" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0014540000000000000000">Simulated Annealing</A></H2><A NAME="secalgsanneal"> </A><P>Despite its name, <em>simulated annealing</em><A NAME=34146> </A>has nothing to do either with simulation or annealing.Simulated annealing is a problem solving techniquebased loosely on the way in which a metal is annealed<A NAME=34147> </A>in order to increase its strength.When a heated metal is cooled very slowly,it freezes into a regular (minimum-energy) crystalline structure.<P>A simulated annealing algorithm searches for the optimum solutionto a given problem in an analogous way.Specifically, it moves about randomly in the solution spacelooking for a solution that minimizes the value of some objective function.Because it is generated randomly,a given move may cause the objective functionto increase, to decrease or to remain unchanged.<P>A simulated annealing algorithm always accepts moves that <em>decrease</em>the value of the objective function.Moves that <em>increase</em> the value of the objective functionare accepted with probability<P> <IMG WIDTH=284 HEIGHT=19 ALIGN=BOTTOM ALT="displaymath68743" SRC="img1948.gif" ><P>where <IMG WIDTH=12 HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline68745" SRC="img1949.gif" > is the change in the value of the objective functionand <I>T</I> is a control parameter called the <em>temperature</em><A NAME=34152> </A>.That is, a random number generator that generates numbers distributeduniformly on the interval (0,1) is sampled,and if the sample is less than <I>p</I>, the move is accepted.<P>By analogy with the physical process,the temperature <I>T</I> is initially high.Therefore, the probability of accepting a move that increasesthe objective function is initially high.The temperature is gradually decreased as the search progresses.That is, the system is <em>cooled</em> slowly.In the end,the probability of accepting a move that increases theobjective function becomes vanishingly small.In general,the temperature is lowered in accordance withan <em>annealing schedule</em><A NAME=34155> </A>.<P>The most commonly used annealing schedule is called<em>exponential cooling</em><A NAME=34157> </A>.Exponential cooling begins at some initial temperature, <IMG WIDTH=15 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63001" SRC="img1066.gif" >,and decreases the temperature in steps according to <IMG WIDTH=86 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline68757" SRC="img1950.gif" >where <IMG WIDTH=68 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline68759" SRC="img1951.gif" >.Typically, a fixed number of moves must be accepted at each temperaturebefore proceeding to the next.The algorithm terminateseither when the temperature reaches some final value, <IMG WIDTH=16 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline68761" SRC="img1952.gif" >,or when some other stopping criterion has been met.<P>The choice of suitable values for <IMG WIDTH=10 HEIGHT=7 ALIGN=BOTTOM ALT="tex2html_wrap_inline62403" SRC="img986.gif" >, <IMG WIDTH=15 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63001" SRC="img1066.gif" >, and <IMG WIDTH=16 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline68761" SRC="img1952.gif" >is highly problem-dependent.However, empirical evidence suggests that a good value for <IMG WIDTH=10 HEIGHT=7 ALIGN=BOTTOM ALT="tex2html_wrap_inline62403" SRC="img986.gif" > is 0.95and that <IMG WIDTH=15 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline63001" SRC="img1066.gif" > should be chosen so thatthe initial acceptance probability is 0.8.The search is terminated typically after some fixed, total number ofsolutions have been considered.<P>Finally, there is the question of selecting the initial solutionfrom which to begin the search.A key requirement is that it be generated quickly.Therefore, the initial solution is generated typically at random.However, sometimes the initial solution can be generatedby some other means such as with a greedy algorithm.<P><BR> <HR><UL> <LI> <A NAME="tex2html6625" HREF="page475.html#SECTION0014541000000000000000">Example-Balancing Scales</A></UL><HR><A NAME="tex2html6622" HREF="page475.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6620" HREF="page464.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6616" HREF="page473.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html6624" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright © 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?