📄 iprecode.htm
字号:
<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">
</font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">(
point < 0 || point >= MutationPoints ) {</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
</font></font><font SIZE="2" face="Courier New">throw new
ArgumentOutOfRangeException( "point", point, "The mutation point passed
to</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
ActionPerceptionTree.Mutate method was not in the range 0 <= point <</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
</font><font SIZE="2"><font face="Courier New">MutationPoints." );</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
</font><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
</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">
</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"> </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. The trees are
recombined at the specified points after ensuring that the points are valid
and that the tree is an AP tree. 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">
</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">
</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">
</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( "otherTree", "The IPrecodeTree passed</font></font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New"> ActionPerceptionTree.Recombine
method was null." );</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</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">
</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">
</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">
</font></font><font SIZE="2" COLOR="#000000" face="Courier New">
</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( "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">
</font><font SIZE="2"><font face="Courier New"> method was not of
type ActionPerceptionTree." );</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</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">
</font></font><font SIZE="2" COLOR="#000000" face="Courier New">if</font><font SIZE="2"><font face="Courier New">(
thisPoint < 0 || (thisPoint >= RecombinationPoints &&
RecombinationPoints != 0) ) {</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</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( "thisPoint", thisPoint, "The first
recombination</font></font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New"> point passed to
ActionPerceptionTree.Recombine method was not in the range 0 <= point <
</font></font><font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New">RecombinationPoints." );</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font></font><font SIZE="2" COLOR="#000000" face="Courier New">if</font><font SIZE="2"><font face="Courier New">(
otherPoint < 0 || (otherPoint >= otherTree.RecombinationPoints && </font>
</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New"> otherTree.RecombinationPoints
!= 0) ) {</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</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( "otherPoint", otherPoint, "The second
recombination </font></font>
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New">point passed to
ActionPerceptionTree.Recombine method was not in the range 0 <= point <
</font></font><font SIZE="2" COLOR="#000000" face="Courier New">
</font><font SIZE="2"><font face="Courier New">RecombinationPoints." );</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</font><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#000000" face="Courier New">
</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">
</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 + -