⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 063-066.html

📁 遗传算法经典书籍-英文原版 是研究遗传算法的很好的资料
💻 HTML
字号:
<HTML>
<HEAD>
<META name=vsisbn content="0849398010">
<META name=vstitle content="Industrial Applications of Genetic Algorithms">
<META name=vsauthor content="Charles Karr; L. Michael Freeman">
<META name=vsimprint content="CRC Press">
<META name=vspublisher content="CRC Press LLC">
<META name=vspubdate content="12/01/98">
<META name=vscategory content="Web and Software Development: Artificial Intelligence: Other">




<TITLE>Industrial Applications of Genetic Algorithms:Software Test Data Generation from a Genetic Algorithm</TITLE>

<!-- HEADER -->

<STYLE type="text/css"> 
 <!--
 A:hover  {
 	color : Red;
 }
 -->
</STYLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

<!--ISBN=0849398010//-->
<!--TITLE=Industrial Applications of Genetic Algorithms//-->
<!--AUTHOR=Charles Karr//-->
<!--AUTHOR=L. Michael Freeman//-->
<!--PUBLISHER=CRC Press LLC//-->
<!--IMPRINT=CRC Press//-->
<!--CHAPTER=4//-->
<!--PAGES=063-066//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="059-062.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="066-068.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>POPULATION SIZE</B></FONT></P>
<P>The goal of the current effort is to find all code blocks within the MUT by producing stable sub-populations of test cases traversing as many paths as possible through the module under test. The paths are analogous to the phenotype of an organism in a natural system. Each sub-population forms a niche. The test cases occupying a niche all exhibit the same phenotype, forming a species. In future work, speciation could be promoted using a marriage restriction operator.
</P>
<P>It was mentioned earlier that the number of distinct paths through a module can quickly become unmanageable, especially if loops are present within the MUT. Though this issue did not arise while testing trityp-easy (it does not contain any loops), a method of handling paths with loops is needed. The easiest method might be to ignore multiple iterations through the loop, counting the nodes within the loop only once. However, one significant issue remains after this discussion of forming stable sub-populations. How large should these sub-populations be so that they exhibit sufficient genetic diversity and are insensitive to periodically losing a few members?</P>
<P>A multiplier of some measurable software attribute quickly comes to mind. The number of distinct paths through a software module (as noted earlier) can be infinite. Other choices are the number of code blocks (nodes in the control graph) and complexity. Here, McCabe&#146;s [5] cyclometric complexity metric was chosen for use as a multiplier. Complexity is a good choice if the proposed utility&#146;s parser were able to reduce and instrument complex logic expressions. In the current effort, population size was varied from four to fourteen times trityp-easy&#146;s cyclometric complexity in an effort to find a suitable multiplier value. Population size is the product of complexity and the population multiplier.</P>
<P><FONT SIZE="+1"><B>RESULTS</B></FONT></P>
<P>The IPP and the LBTPB fitness algorithms were compared side by side in multiple runs of the Simple Genetic Algorithm (SGA) developed by David Goldberg [6]. Population size was varied as a fixed multiple of the test module&#146;s cyclometric complexity. The test module was the&#147;trityp-easy&#148;program referenced in Watkins [3]. Trityp-easy has a cyclometric complexity of 21 and contains eighteen code blocks. Each run of the GA was initialized with a unique random seed and lasted for 50 generations. Each data point referenced here represents an ensemble average of 200 runs.
</P>
<P>Table 4.3 shows the generation number when the two fitness algorithms converged to the eighteen possible code blocks in the trityp-easy program. Both algorithms had difficulty finding all eighteen for low population multipliers. The LBTPB fitness algorithm converged by generation 33 with a multiplier of 8. Increasing the multiplier value advanced the point of convergence. The IPP fitness algorithm was much slower to converge than the LBTPB algorithm, generally converging twenty generations later. Differences between the two fitness algorithms were less pronounced at larger multiplier values. This is because large populations do not adequately challenge the GA. Large initial populations usually contain enough diversity to allow the GA to rapidly traverse all eighteen nodes. However, larger population sizes do consume additional computational resources.</P>
<TABLE WIDTH="100%" BORDER><CAPTION ALIGN=LEFT><B>Table 4.3</B> Generation of convergence vs. population multiplier.
<TR>
<TH WIDTH="30%" ALIGN="LEFT">Multiplier
<TH WIDTH="35%" ALIGN="LEFT">LBTPB
<TH WIDTH="35%" ALIGN="LEFT">IPP
<TR>
<TD>4
<TD>50+
<TD>50+
<TR>
<TD>6
<TD>50+
<TD>50+
<TR>
<TD>8
<TD>33
<TD>50+
<TR>
<TD>10
<TD>32
<TD>50+
<TR>
<TD>12
<TD>22
<TD>41
<TR>
<TD>14
<TD>28
<TD>31
</TABLE>
<P>Figure 4.4 depicts the convergence of the LBTPB and IPP fitness algorithms when using a population multiplier of 10. The LBTPB algorithm (solid line in Figure 4.4) gave a bonus of 5 fitness points to data sets which traversed a node with at least one untraversed child node.
</P>
<P>By providing a bonus, the GA encourages the formation of test data sets for untraversed code blocks. These highly fit individuals cross with other highly fit individuals in the hope of generating test data which are capable of traversing new sections of the module under test. This is what helps the GA converge earlier as shown in Table 4.3 above.</P>
<P>Lower bonus values were less effective, while larger bonus values tended to hinder convergence. The GA is forced to continually rediscover and lose blocks of code when individuals with extremely large fitness values monopolize reproduction at the expense of others.</P>
<P>Figure 4.4 shows convergence of the IPP and LBTPB fitness algorithms. Convergence of the IPP fitness algorithm takes much longer than the LBTPB algorithm. Convergence is shown in greater detail in Figure 4.5, which presents results for the two algorithms with population multipliers of 10 and 12.</P>
<P><A NAME="Fig7"></A><A HREF="javascript:displayWindow('images/04-07.jpg',500,347)"><IMG SRC="images/04-07t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/04-07.jpg',500,347)"><FONT COLOR="#000077"><B>Figure 4.4</B></FONT></A>&nbsp;&nbsp;Convergence of LBTPB and IPP fitness algorithms to optimal (18).</P>
<P>Figure 4.5 shows that detection of the remaining code blocks by the two fitness functions stalls momentarily near the optimal value of 18. The LBTPB algorithm clearly performs better than the IPP. Since each trace is actually an average of 200 runs, the plateaus seen near the top indicate that some of the runs have the GA searching for the last few remaining undiscovered sections of the program. This is to be expected from the IPP algorithm because it does not distinguish between unique or common blocks of code when calculating fitness. That these plateaus occurs for the LBTPB algorithm is then somewhat perplexing until we remember that the LBTPB fitness algorithm bases fitness on unique <I>terminal</I> blocks of code. As mentioned earlier, the LBTPB fitness algorithm is really just a special case of a fitness algorithm which rewards traversal of unique nodes found along the entire path through the control graph. This more generic form of the LBTPB fitness algorithm is currently under development.</P>
<P><A NAME="Fig8"></A><A HREF="javascript:displayWindow('images/04-08.jpg',500,351)"><IMG SRC="images/04-08t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/04-08.jpg',500,351)"><FONT COLOR="#000077"><B>Figure 4.5</B></FONT></A>&nbsp;&nbsp;Block coverage near the optimum.<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="059-062.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="066-068.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>

<hr width="90%" size="1" noshade>
<div align="center">
<font face="Verdana,sans-serif" size="1">Copyright &copy; <a href="/reference/crc00001.html">CRC Press LLC</a></font>
</div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

</BODY>
</HTML>

<!-- END FOOTER -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -