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

📄 generationhistory.htm

📁 遗传算法GPE_release_v1.0.tar
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Genetic Programming FAQ</title>
</head>

<body>

<div id="nsbanner">
  <table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
      <td>
      <div id="bannerrow1">
        <table class="bannerparthead" cellSpacing="0">
          <tr id="hdr">
            <td class="runninghead" style="font-size: 70%">
            <font face="Arial"><a class="show" id="design_toggle" title="Show or hide design notes" href="../../index.html"><img src="../../Images/Icons/G.png" width="14" height="14" border="0" align="middle"/></a> Genetic Programming Engine FAQ</font></td>
          </tr>
        </table>
      </div>
      <div id="TitleRow">
        <h1 class="dtH1" style="font-size: 85%; left: 5px; position: relative">
        <font face="Arial">How the Generation History Works</font></h1>
      </div>
      </td>
      <td vAlign="top" align="right">
      <font face="Arial">
      <img src="../../Images/Icons/GP_blue.png" width="191" height="39"></font></td>
    </tr>
  </table>
</div>
<div id="nstext">
  &nbsp;<p align="left"><font face="Arial">The GenerationHistory class Holds all 
  of the Histories from a generation, and related statistics.&nbsp; The 
  GenerationHistory is identified by generation number and contains a collection 
  of individual names.&nbsp; The GenerationHistory also holds statistics such as 
  the best and worst individuals and the best, worst, and average fitness.&nbsp;
  </font></p>
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber1">
      <tr>
        <td width="100%"><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0"></font>
        <font SIZE="2" face="Courier New">public 
        GenerationHistory( int 
        generation, string</font><font SIZE="2"><font face="Courier New">[] 
        individuals ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">//check 
        generation</p>
        <p style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp; if</font><font SIZE="2"><font face="Courier New">( 
        generation &lt; 0 ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">
        throw new 
        ArgumentOutOfRangeException( &quot;generation&quot;, generation, &quot;The generation</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font SIZE="2">
        <font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        number passed to GenerationHistory.constructor was less than zero.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">//check 
        array</p>
        <p style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2" face="Courier New">if( 
        individuals == null</font><font SIZE="2"><font face="Courier New"> 
        ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">
        throw new 
        ArgumentNullException( &quot;individuals&quot;, &quot;The array of Individual names</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        passed</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font SIZE="2">
        <font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        to GenerationHistory.constructor was null.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">if( 
        individuals.Length == 0 ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2" face="Courier New">throw new 
        ArgumentException( &quot;The array of Individual names passed to</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font SIZE="2">
        <font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        GenerationHistory.constructor was empty.&quot;, &quot;individuals&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</font></p>
        <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">//set 
        values</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        m_Generation = generation;</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">
        foreach(
        string name
        in</font><font SIZE="2"><font face="Courier New"> individuals ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        InnerDictionary.Add( </font></font>
        <font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
        HistoryInfo( name, generation ) );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        m_Names = </font></font>
        <font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
        ReadOnlyStringCollection( individuals );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        m_MaximizeFitness = </font></font>
        <font SIZE="2" face="Courier New">true</font><font SIZE="2"><font face="Courier New">;</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
      </tr>
    </table>
    </center>
    <p align="left"><font face="Arial">This constructor allows the setting of 
    the maximizeFitness variable.&nbsp; See also <b>EngineOptions</b>.&nbsp;
    </font></p>
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber2">
        <tr>
          <td width="100%"><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"></font>
          <font SIZE="2" face="Courier New">public 
          GenerationHistory( int 
          generation, string[] 
          individuals, bool</font><font SIZE="2"><font face="Courier New"> 
          maximizeFitness ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          //check generation</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
          generation &lt; 0 ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          throw new 
          ArgumentOutOfRangeException( &quot;generation&quot;, generation, &quot;The generation</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp; </font>
          <font SIZE="2"><font face="Courier New">&nbsp; number passed to 
          GenerationHistory.constructor was less than zero.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          //check array</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          if( individuals == null</font><font SIZE="2"><font face="Courier New"> 
          ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          throw new 
          ArgumentNullException( &quot;individuals&quot;, &quot;The array of Individual names</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          passed </font><font SIZE="2"><font face="Courier New">to 
          GenerationHistory.constructor was null.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
          individuals.Length == 0 ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          throw new 
          ArgumentException( &quot;The array of Individual names passed to</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">
          GenerationHistory.constructor was empty.&quot;, &quot;individuals&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//set 
          values</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Generation = generation;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">
          foreach(
          string name in</font><font SIZE="2"><font face="Courier New"> 
          individuals ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          InnerDictionary.Add( </font></font>
          <font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
          HistoryInfo( name, generation ) );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Names = </font></font>
          <font SIZE="2" face="Courier New">new</font><font SIZE="2"><font face="Courier New"> 
          ReadOnlyStringCollection( individuals );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_MaximizeFitness = maximizeFitness;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
        </tr>
      </table>
      </center>
    </div>
  </div>
	<h4 class="dtH4"><font face="Arial"><span style="font-weight: 400">The 
    InnerDictionary method gets the HistoryInfo dictionary for the current 
    generation.&nbsp; See also <i>HistoryInfo</i> below.&nbsp; </span></font></h4>
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber3">
      <tr>
        <td width="100%"><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0"></font>
        <font SIZE="2" face="Courier New">protected</font><font SIZE="2"><font face="Courier New"> 
        HistoryInfoDictionary InnerDictionary {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">get</font><font SIZE="2"><font face="Courier New"> 
        {</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New"> 
        m_InnerDictionary;</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
        }</font></p>

⌨️ 快捷键说明

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