📄 tester.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">Testing a Population</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" style="width: 793; height: 2536">
<h4 class="dtH4"> </h4>
<p class="dtH4"><font face="Arial">The Tester class is responsible for
compiling the code file for a <b>Population</b>, instantiating each <b>
IIndividual</b>, and testing them in the given <b>IEnvironment(s)</b>.
The codeFile is the path to the Population to test, the <b>GenerationHistory</b>
gets the names of all individuals to test, the environments specify which
Environment(s) the IIndividuals will be tested in, and the
baseClassNamespace specifies the IIndividual's <i>Base Class</i>.</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 face="Courier New" SIZE="2">public Tester( string codeFile,
GenerationHistory generationHistory,</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" size="2"> EnvironmentReference[]
environments, string</font><font SIZE="2"><font face="Courier New">
baseClassNamespace ) {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
CodeFile = codeFile;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
GenerationHistory = generationHistory;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
Environments.AddRange( environments );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
BaseClassNamespace = baseClassNamespace;</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 other constructor sets the codeFile
of the Population, the paths to assemblies referenced by the CodeFile, the
names of all individuals to test, the Environments in which to test the
IIndividuals, IIndividual's <i>Base Class, </i>and the test limit as
defined in the <b>EngineOptions</b>.</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 Tester( string codeFile,
string[] references, </font></p>
<font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
GenerationHistory generationHistory, EnvironmentReference[]
environments, </font></font><font SIZE="2" face="Courier New">string</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" size="2"> baseClassNamespace, int</font><font SIZE="2"><font face="Courier New">
testLimit ) {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
CodeFile = codeFile;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">if( references != null</font><font SIZE="2"><font face="Courier New">
) {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
References.AddRange( references );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
GenerationHistory = generationHistory;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
Environments.AddRange( environments );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
BaseClassNamespace = baseClassNamespace;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
TestLimit = testLimit;</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 CodeFile method gets and sets the
path to the CodeFile that represents the Population.</font></p>
<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">public string</font><font SIZE="2"><font face="Courier New">
CodeFile {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</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">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_CodeFile;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">set</font><font SIZE="2"><font face="Courier New">
{</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">if( value == null</font><font SIZE="2"><font face="Courier New">
) {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</font></font><font SIZE="2" face="Courier New">throw new
ArgumentNullException( "value", "The value passed to</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Courier New" SIZE="2">
</font><font SIZE="2"><font face="Courier New"> Tester.CodeFile_set
was null." );</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
m_CodeFile = </font></font><font SIZE="2" face="Courier New">value</font><font SIZE="2"><font face="Courier New">;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private string m_CodeFile;</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The References method gets a collection
of paths to assemblies referenced by the CodeFile. </font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber4">
<tr>
<td width="100%"><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">public</font><font SIZE="2"><font face="Courier New">
StringCollection References {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
</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">
</font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New">
m_References;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
}</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">}</font></p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" face="Courier New">private StringCollection
m_References = new StringCollection();</font></td>
</tr>
</table>
</center>
</div>
<p class="dtH4"><font face="Arial">The GenerationHistory method gets and
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -