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

📄 iprecode.htm

📁 遗传算法GPE_release_v1.0.tar
💻 HTM
📖 第 1 页 / 共 4 页
字号:
        <font SIZE="2" face="Courier New">else</font><font SIZE="2"><font face="Courier New"> 
        {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
        point &lt; 0 || point &gt;= MutationPoints ) {</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;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">throw new 
        ArgumentOutOfRangeException( &quot;point&quot;, point, &quot;The mutation point 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;&nbsp;&nbsp;&nbsp;&nbsp; 
        ActionPerceptionTree.Mutate method was not in the range 0 &lt;= point &lt;</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;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">MutationPoints.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" face="Courier New">//call private 
        implementation</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">Mutate( </font></font>
        <font SIZE="2" face="Courier New">this</font><font SIZE="2"><font face="Courier New">, 
        point, ActionPerceptionNode.CreateNode( method ) );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp; </font>
        <font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
      </tr>
    </table>
    </center>
  </div>
  <p class="dtH4"><font face="Arial">The Recombine method recombines the current 
  IPrecodeTree with another at the specified points.</font></p>
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber7">
      <tr>
        <td width="100%">
        <font SIZE="2" face="Courier New">void Recombine( int thisPoint, int</font><font face="Courier New" SIZE="2"> 
        otherPoint, IPrecodeTree otherTree );</font></td>
      </tr>
    </table>
    </center>
  </div>
  <h4 class="dtH4"><font face="Arial"><span style="font-weight: 400">The 
  Recombine method for the AP tree is shown below.&nbsp; The trees are 
  recombined at the specified points after ensuring that the points are valid 
  and that the tree is an AP tree.&nbsp; The tree check would have to be changed 
  for different implementations to check for trees compatible with, for example, 
  and int method.</span></font></h4>
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber12">
      <tr>
        <td width="100%"><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0"></font>
        <font face="Courier New"><font SIZE="2" COLOR="#000000">public</font><font SIZE="2">
        </font><font SIZE="2" COLOR="#000000">void</font><font SIZE="2"> 
        Recombine( </font><font SIZE="2" COLOR="#000000">int</font><font SIZE="2"> 
        thisPoint, </font><font SIZE="2" COLOR="#000000">int</font></font><font SIZE="2"><font face="Courier New"> 
        otherPoint, IPrecodeTree otherTree ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">//check 
        that the other tree is not null</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font face="Courier New"><font SIZE="2" COLOR="#000000">if</font><font SIZE="2">( 
        otherTree == </font><font SIZE="2" COLOR="#000000">null</font></font><font SIZE="2"><font face="Courier New"> 
        ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font face="Courier New"><font SIZE="2" COLOR="#000000">
        throw</font><font SIZE="2"> </font><font SIZE="2" COLOR="#000000">new</font></font><font SIZE="2"><font face="Courier New"> 
        ArgumentNullException( &quot;otherTree&quot;, &quot;The IPrecodeTree passed</font></font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">&nbsp;ActionPerceptionTree.Recombine 
        method was null.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">//check 
        that tree is an AP tree</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">ActionPerceptionTree tree = otherTree
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">as</font><font SIZE="2"><font face="Courier New"> 
        ActionPerceptionTree;</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font face="Courier New"><font SIZE="2" COLOR="#000000">if</font><font SIZE="2">( 
        tree == </font><font SIZE="2" COLOR="#000000">null</font></font><font SIZE="2"><font face="Courier New"> 
        ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New"><font SIZE="2" COLOR="#000000">throw</font><font SIZE="2">
        </font><font SIZE="2" COLOR="#000000">new</font></font><font SIZE="2"><font face="Courier New"> 
        ArgumentException( &quot;The IPrecodeTree passed to 
        ActionPerceptionTree.Recombine</font></font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">&nbsp;method was not of 
        type ActionPerceptionTree.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">//check 
        that recombination points are in range</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
        thisPoint &lt; 0 || (thisPoint &gt;= RecombinationPoints &amp;&amp; 
        RecombinationPoints != 0) ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font face="Courier New"><font SIZE="2" COLOR="#000000">
        throw</font><font SIZE="2"> </font><font SIZE="2" COLOR="#000000">new</font></font><font SIZE="2"><font face="Courier New"> 
        ArgumentOutOfRangeException( &quot;thisPoint&quot;, thisPoint, &quot;The first 
        recombination</font></font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">&nbsp;point passed to 
        ActionPerceptionTree.Recombine method was not in the range 0 &lt;= point &lt;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">RecombinationPoints.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
        otherPoint &lt; 0 || (otherPoint &gt;= otherTree.RecombinationPoints &amp;&amp; </font>
        </font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">&nbsp;otherTree.RecombinationPoints 
        != 0) ) {</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font></font><font face="Courier New"><font SIZE="2" COLOR="#000000">
        throw</font><font SIZE="2"> </font><font SIZE="2" COLOR="#000000">new</font></font><font SIZE="2"><font face="Courier New"> 
        ArgumentOutOfRangeException( &quot;otherPoint&quot;, otherPoint, &quot;The second 
        recombination </font></font>
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">point passed to 
        ActionPerceptionTree.Recombine method was not in the range 0 &lt;= point &lt;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </font><font SIZE="2"><font face="Courier New">RecombinationPoints.&quot; );</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">}</font></p>
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font></font><font SIZE="2" COLOR="#000000" face="Courier New">//call 
        private implementation</p>
        </font><font SIZE="2">
        <p style="margin-top: 0; margin-bottom: 0">
        <font SIZE="2" COLOR="#000000" face="Courier New">&nbsp;&nbsp;&nbsp;
        </font><font face="Courier New">Recombine( </font></font>
        <font SIZE="2" COLOR="#000000" face="Courier New">this</font><font SIZE="2"><font face="Courier New">, 
        thisPoint, tree, otherPoint );</font></p>
        <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></font></td>
      </tr>
    </table>
    </center>
  </div>
  <h4 class="dtH4"><font face="Arial">See Also</font></h4>
  <p>
  <font face="Arial"><a href="../Individual.htm">IIndividual</a> |
  <a href="../../GPE.htm">GPEngine</a> | <a href="../../../GettingStarted.htm">
  Getting Started</a> | <a href="../../Internal/EngineOptions.htm">EngineOptions</a> 
  |
  <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemCodeDom.asp">
  CodeDom</a></font> | </p>
  <hr>
  <div id="footer">
    <font face="Arial">
    <a href="http://www.opensource.org/" target="_top">
    <img style="padding-bottom: 5px" src="http://opensource.org/trademarks/open_source_button.png" align="left" border="0"></a> 
    This software licensed under the
    <a href="http://opensource.org/licenses/afl-2.1.php" target="_top">Academic 
    Free License version 2.1</a>. (<a href="../../../afl-2.1.txt">Plain 
    text</a>)</font></div>
</div>

</body>

</html>

⌨️ 快捷键说明

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