📄 environment.htm
字号:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">
<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">
<link rel="File-List" href="Environment_files/filelist.xml">
<title>Genetic Programming FAQ</title>
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</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">How to Write the Environment Class</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">
<p class="MsoNormal"><font face="Arial">The IEnvironment class specifies the
environment for the <b>IIndividual</b>. In the case of the artificial ant, it is an
XML file that specifies a grid containing spaces that either has food or
doesn抰 have food. A graphical representation of the grid is shown below.
The red square is the ants current position, blue squares are where the ant
has traveled, circles are areas that contain food, and empty, white squares
contain no food and have not yet been visited. </font></p>
<div align="center">
<table border="0" width="90%" id="table1">
<tr>
<td>
<p style="margin-top: 0; margin-bottom: 0">
<span style="font-size: 12.0pt; font-family: Times New Roman"><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t75" style='width:183pt;
height:183pt'>
<v:imagedata src="Environment_files/image001.emz" o:title=""/>
</v:shape><![endif]--><![if !vml]><img border=0 width=244 height=244
src="Environment_files/image002.gif" v:shapes="_x0000_s1025"><![endif]></span></td>
</tr>
</table>
</div>
<div align="center">
<p class="MsoNormal" align="left"><span style="font-family:Arial">The
first method gets the file types that will be used to initialize the
environment. For the artificial ant, only XML files will be displayed.
The user will have the option of using the default </span><span style="font-family:Arial">
IEnvironment</span><span style="font-family:Arial">, a
different pre-written </span><span style="font-family:Arial">
IEnvironment</span><span style="font-family:Arial">, or writing a new IEnvironment. </span></p>
<div align="center">
<table border="0" width="90%" id="table7">
<tr>
<td>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<span style="font-size: 10.0pt; font-family: Courier New">
public</span><span style="font-size:10.0pt;
font-family:"Courier New""> string AcceptedFileTypes {</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size: 10.0pt; font-family: Courier New">
get</span><span style="font-size:10.0pt;
font-family:"Courier New""> {</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size: 10.0pt; font-family: Courier New">
return</span><span style="font-size:10.0pt;font-family:"Courier New"">
"XML Files (*.xml)|*.xml";</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size:10.0pt;
font-family:"Courier New"">}</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<span style="font-size:10.0pt;
font-family:"Courier New"">}</span><p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
</td>
</tr>
</table>
</div>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<span style="font-family:Arial">The next method specifies the default
</span><span style="font-family:Arial">IEnvironment</span><span style="font-family:Arial">. This will be the environment the
IIndividual will use unless
the user specifies a different one in the <b>EngineOptions</b>. </span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left"> </p>
<div align="center">
<table border="0" width="90%" id="table8">
<tr>
<td>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<span style="font-size: 10.0pt; font-family: Courier New">
public</span><span style="font-size:10.0pt;font-family:"Courier New"">
string DefaultInitializationFile {</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size: 10.0pt; font-family: Courier New">
get</span><span style="font-size:10.0pt;font-family:"Courier New"">
{</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size: 10.0pt; font-family: Courier New">
return</span><span style="font-size:10.0pt;font-family:"Courier New"">
".\\Examples\\Loop.xml";</span></p>
<p class="MsoNormal" style="text-autospace: none; margin-top: 0; margin-bottom: 0" align="left">
<font size="2"><span style="font-family: Courier New">
</span></font>
<span style="font-size:10.0pt;font-family:"Courier New"">
}</span></p>
<p class="MsoNormal" align="left" style="margin-top: 0; margin-bottom: 0">
<span style="font-family: Courier New"><font size="2">}</font></span></td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -