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

📄 individual.htm

📁 遗传算法GPE_release_v1.0.tar
💻 HTM
📖 第 1 页 / 共 2 页
字号:
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family: Arial; font-weight: normal">Next, any state 
	clearing that needs to be done after testing is complete is done.&nbsp; In the 
	case of the Artificial Ant, nothing needs to be done to the Ant when testing 
	is complete.&nbsp;</span></h4>
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family: Arial; font-weight: normal">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></h4>
	<div align="center">
		<table border="0" width="90%" id="table4">
			<tr>
				<td>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">public void TestTeardown() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">//no state clearing needed</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">}</font></span></h4>
				</td>
			</tr>
		</table>
	</div>
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family: Courier New; font-weight: normal">&nbsp;</span></h4>
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family: Arial; font-weight: normal">Next a method is 
	defined to determine when the IIndividual is finished testing.&nbsp; This can 
	occur when fitness is maximized, such as when the Ant collects all of the 
	available food.&nbsp; It can also occur when the program completes a certain 
	number of iterations as defined by the IEnvironment.&nbsp; This is necessary as 
	maximum fitness is not always achieved.&nbsp; </span></h4>
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family: Arial; font-weight: normal">&nbsp;</span><span style="font-family: Courier New; font-weight: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	</span></h4>
	<div align="center">
		<table border="0" width="90%" id="table5">
			<tr>
				<td>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">public bool FinishedTesting() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">return m_Environment.AllFoodCollected || 
				m_StepCount &gt; m_Environment.StepLimit;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family: Courier New; font-weight: normal">
				<font size="2">}</font></span></h4>
				</td>
			</tr>
		</table>
	</div>
	<h4><span style="font-family:Arial;font-weight:normal">Finally, any 
	problem-specific methods are defined.&nbsp; These methods define what the 
	IIndividual can do.&nbsp; These are the methods that will get mutated and/or 
	recombined by the </span><span style="font-family:Arial;">GPEngine</span><span style="font-family:Arial;font-weight:normal"> in order to find fitter solutions.&nbsp; In the artificial 
	Ant example, the </span><span style="font-family:Arial;font-weight:normal">
    IIndividual </span><span style="font-family:Arial;font-weight:normal">contains definitions for turning left and right, 
	moving forward, and determining if food is in front of the Ant.&nbsp;</span></h4>
	<h4 style="margin:0in;margin-bottom:.0001pt">
	<span style="font-family:&quot;Courier New&quot;;
font-weight:normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></h4>
	<div align="center">
		<table border="0" width="90%" id="table6">
			<tr>
				<td>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">public void TurnLeft() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">++m_StepCount;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">m_Facing = (Direction) ((((int) m_Facing) + 
				5)%4);</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">}</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">&nbsp;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">public void TurnRight() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">++m_StepCount;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">m_Facing = (Direction) ((((int) m_Facing) + 
				1)%4);</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">}</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">&nbsp;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">public void MoveForward() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">++m_StepCount;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<font face="Courier New" size="2">&nbsp;&nbsp;&nbsp; </font>
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">m_Environment.Move( m_Facing );</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">}</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">&nbsp;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">public bool IsFoodAhead() {</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">return m_Environment.Peek( m_Facing ) == 1;</font></span></h4>
				<h4 style="margin:0in;margin-bottom:.0001pt">
				<span style="font-family:&quot;Courier New&quot;;
font-weight:normal"><font size="2">}</font></span></h4>
				</td>
			</tr>
		</table>
	</div>
	<h4 class="dtH4"><font face="Arial">See Also</font></h4>
  <p><font face="Arial">
  <a href="../../../GPproject/GeneticProgrammingEngine/ProblemSpace/IEnvironment.htm">
  IEnvironment</a> |
  <a href="../../../GPproject/GeneticProgrammingEngine/ProblemSpace/IIndividual.htm">
  IIndividual</a> |
  <a href="../../../GPproject/GeneticProgrammingEngine/GPEngine.htm">GPEngine</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 + -