page475.html

来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 40 行

HTML
40
字号
<HTML><HEAD><TITLE>Example-Balancing Scales</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="tex2html6632" HREF="page476.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6630" HREF="page474.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6626" HREF="page474.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6634" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0014541000000000000000">Example-Balancing Scales</A></H3><P>Consider again the <em>scales balancing problem</em>described in Section&nbsp;<A HREF="page440.html#secalgsscales"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.That is, we are given a set of <I>n</I> weights,  <IMG WIDTH=114 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline67693" SRC="img1714.gif"  >,which are to be placed on a pair of scales in the way thatminimizes the difference between the total weight in each pan.Feasible solution to the problem all have the form <IMG WIDTH=143 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline67635" SRC="img1702.gif"  >,where<P> <IMG WIDTH=386 HEIGHT=48 ALIGN=BOTTOM ALT="displaymath67713" SRC="img1720.gif"  ><P><P>To solve this problem using simulated annealing,we need a strategy for generating random moves.The move generator should make small, random changes to the current solutionand it must ensure that all possible solutions can be reached.A simple approach is to use the formula<P> <IMG WIDTH=303 HEIGHT=15 ALIGN=BOTTOM ALT="displaymath68778" SRC="img1953.gif"  ><P>where  <IMG WIDTH=17 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68657" SRC="img1930.gif"  > is the initial solution,  <IMG WIDTH=32 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline68793" SRC="img1954.gif"  > is a new solution, <IMG WIDTH=141 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline68795" SRC="img1955.gif"  > is a sequence of zeroes and onesgenerated randomly,and  <IMG WIDTH=11 HEIGHT=18 ALIGN=MIDDLE ALT="tex2html_wrap_inline62133" SRC="img915.gif"  > denotes elementwise addition modulo two.<P><HR><A NAME="tex2html6632" HREF="page476.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6630" HREF="page474.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6626" HREF="page474.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6634" 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 &#169; 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 + -
显示快捷键?