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

📄 individualinfo.htm

📁 遗传算法GPE_release_v1.0.tar
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<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">Creating the IndividualInfos</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">
  <h4 class="dtH4"><font face="Arial"><span style="font-weight: 400">The 
  IndividualInfo holds information about an </span>IIndividual<span style="font-weight: 400">.&nbsp; 
  This information includes the individual's generation number, its individual 
  number (to uniquely identify it within a generation), the type of its <i>Base 
  Class</i>, the </span>Precode<span style="font-weight: 400"> tree that makes 
  it up, and its parents (or null if in the first generation).&nbsp; This is 
  what makes up a </span>Population<span style="font-weight: 400">.&nbsp; </span>
  </font></h4>
  <p class="dtH4"><font face="Arial">The generationNumber and individualNumber 
  must be greater than or equal to 0.&nbsp; The individualNumber&nbsp; is the 
  number of this individual in its generation.&nbsp; The baseClass and Precode 
  tree must not be null.&nbsp; The individual's name is made up of the <i>Base 
  Class </i>name, generation number, and individual number.&nbsp; For example, 
  individual 39 of generation 3 of the AntIndividual base class would be named 
  AntIndividual_Generation3_Number39.&nbsp; </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 face="Courier New">
          public</font></font><font SIZE="2" face="Courier New"> IndividualInfo( 
          int generationNumber, int individualNumber, Type baseClass,</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" size="2">&nbsp; IPrecodeTree precodeTree, 
          string</font><font SIZE="2"><font face="Courier New">[] parents ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//check that numbers 
          are non-negative</p>
          <p style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp; if</font><font SIZE="2"><font face="Courier New">( 
          generationNumber &lt; 0 ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new 
          ArgumentOutOfRangeException( &quot;generationNumber&quot;, generationNumber, 
          &quot;The</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">&nbsp;generation number 
          passed to IndividualInfo.constructor was less than zero.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if</font><font SIZE="2"><font face="Courier New">( 
          individualNumber &lt; 0 ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new 
          ArgumentOutOfRangeException( &quot;individualNumber&quot;, individualNumber, 
          &quot;The</font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font><font SIZE="2"><font face="Courier New">&nbsp;individual number 
          passed to IndividualInfo.constructor was less than zero.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//check for null 
          arguments</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if( baseClass == null</font><font SIZE="2"><font face="Courier New"> 
          ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new 
          ArgumentNullException( &quot;baseClass&quot;, &quot;The base class type 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;
          </font><font SIZE="2"><font face="Courier New">&nbsp;IndividualInfo.constructor 
          was null.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">if( precodeTree == 
          null</font><font SIZE="2"><font face="Courier New"> ) {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">throw new 
          ArgumentNullException( &quot;precodeTree&quot;, &quot;The precode tree 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;
          </font><font SIZE="2"><font face="Courier New">&nbsp;IndividualInfo.constructor 
          was null.&quot; );</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</font></p>
          <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">//assign given values</p>
          </font><font SIZE="2">
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Generation = generationNumber;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Number = individualNumber;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_BaseClass = baseClass;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_PrecodeTree = precodeTree;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Parents = (parents != </font></font>
          <font SIZE="2" face="Courier New">null &amp;&amp; parents.Length &gt; 0 ? </font>
          </p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new 
          ReadOnlyStringCollection( parents ) : </font></p>
          <p style="margin-top: 0; margin-bottom: 0">
          <font face="Courier New" SIZE="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new 
          ReadOnlyStringCollection( new string</font><font SIZE="2"><font face="Courier New">[0] 
          ));</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          m_Name = String.Format( &quot;{0}_Generation{1}_Number{2}&quot;, BaseClass.Name,</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          Generation.ToString(), Number.ToString() );</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 Name method gets the name of the 
    individual as described above.</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 string</font><font SIZE="2"><font face="Courier New"> 
          Name {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New"> 
          m_Name;</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp; 
          }</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 readonly string m_Name;</font></td>
        </tr>
      </table>
      </center>
  </div>
	<p class="dtH4"><font face="Arial">The Generation method gets the Generation 
    of the individual.</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 int</font><font SIZE="2"><font face="Courier New"> 
          Generation {</font></p>
          <p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">&nbsp;&nbsp;&nbsp;
          </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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </font></font><font SIZE="2" face="Courier New">return</font><font SIZE="2"><font face="Courier New"> 

⌨️ 快捷键说明

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