📄 samplecode.htm
字号:
<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">Looking at Sample code</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">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="100%"><font face="Arial">The following is a sample of the C#
code generated by the <b>GPEngine</b> running the Artificial Ant problem.
While the GUI displays the code for only the best <b>IIndividual</b>, the
code for all IIndividuals can be found in the output directory specified
in the <b>EngineOptions</b>. This code is the result of mutations
and recombinations of IIndividuals by the GPEninge. The following is
the code generation for Ant number 58 of generation 42. Due to the
randomness of the initial population, the code for the same individual
will be different for the next run of the GPEngine.</font></td>
</tr>
</table>
<div align="center">
<table border="0" width="90%" id="table1">
<tr>
<td> </td>
</tr>
<tr>
<td bgcolor="#EFEBDE">
<pre><font face="Courier New">AntIndividual_Generation42_Number58 : AntIndividual_Generation41_Number96, AntIndividual_Generation41_Number90</font></pre>
<pre><font face="Courier New">MoveForward();
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
MoveForward();
}
}
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
MoveForward();
}
}
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( IsFoodAhead() ) {
TurnLeft();
}
else {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
TurnLeft();
}
else {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
MoveForward();
}
}
}
}
}
}
else {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
//IsFoodAhead has no child statements to output
}
}
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( IsFoodAhead() ) {
TurnLeft();
}
else {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
TurnLeft();
MoveForward();
}
}
else {
MoveForward();
if( IsFoodAhead() ) {
TurnLeft();
//IsFoodAhead has no child statements to output
}
else {
TurnLeft();
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( !IsFoodAhead() ) {
if( !IsFoodAhead() ) {
//IsFoodAhead has no child statements to output
}
}
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
MoveForward();
}
else {
if( IsFoodAhead() ) {
MoveForward();
TurnLeft();
}
else {
if( !IsFoodAhead() ) {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
}
}
}
else {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
TurnLeft();
MoveForward();
}
}
else {
MoveForward();
if( IsFoodAhead() ) {
MoveForward();
if( IsFoodAhead() ) {
TurnLeft();
//IsFoodAhead has no child statements to output
}
else {
MoveForward();
}
MoveForward();
//IsFoodAhead has no child statements to output
}
else {
TurnLeft();
if( !IsFoodAhead() ) {
TurnLeft();
if( !IsFoodAhead() ) {
TurnLeft();
}
}
}
}
}
}
}
}
}
}
else {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
if( !IsFoodAhead() ) {
MoveForward();
if( IsFoodAhead() ) {
TurnLeft();
//IsFoodAhead has no child statements to output
}
else {
MoveForward();
}
}
}
}
}
}
else {
if( IsFoodAhead() ) {
if( IsFoodAhead() ) {
TurnLeft();
if( IsFoodAhead() ) {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
MoveForward();
//IsFoodAhead has no child statements to output
}
}
}
}
}
else {
if( !IsFoodAhead() ) {
MoveForward();
if( IsFoodAhead() ) {
TurnLeft();
//IsFoodAhead has no child statements to output
}
else {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
if( !IsFoodAhead() ) {
MoveForward();
if( IsFoodAhead() ) {
TurnLeft();
//IsFoodAhead has no child statements to output
}
else {
TurnLeft();
MoveForward();
}
}
}
}
}
}
}
else {
TurnLeft();
MoveForward();
}</font></pre>
<p></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</div>
<h4 class="dtH4"><font face="Arial">See Also</font></h4>
<p><font face="Arial">
<a href="GeneticProgrammingEngine/Internal/EngineOptions.htm">EngineOptions</a>
| <a href="GeneticProgrammingEngine/ProblemSpace/Individual.htm">IIndividual</a>
| <a href="GeneticProgrammingEngine/GPE.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 + -