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

📄 api.html

📁 麻省理工开发的免费遗传算法类库GAlib,很好用
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<dt><b>copy</b><dd>The copy member function is called by the base class' operator= and clone members.  You can use it to copy the contents of a genome into an existing genome.<dt><b>crossover</b><dd>Each genome class can define its preferred mating method.  Use this method to assign the preferred crossover for a genome instance.<dt><b>equal</b><dt><b>notequal</b><dd>'equal' and 'notequal' are genome-specific.  See the documentation for each genome class for specific details about what 'equal' means.  For example, genomes that have identical contents but different allele sets may or may not be considered equal.  By default, <b>notequal</b> just calls the <b>equal</b> function, but you can override this in derived classes if you need to optimize the comparison.<dt><b>evalData</b><dd>Set/Get the object used to store genome-specific evaluation data.  Each genome owns its own evaluation data object; cloning a genome clones the evaluation data as well.<dt><b>evaluate</b><dd>Invoke the genome's evaluation function.  If you call this member with gaTrue, the evaluation function is called no matter what (assuming one has been assigned to the genome).  By default, the argument to this function is gaFalse, so the genome's evaluation function is called only if the state of the genome has not changed since the last time the evaluator was invoked.<dt><b>evaluator</b><dd>Set/Get the function used to evaluate the genome.<dt><b>geneticAlgorithm</b><dd>The member function returns a pointer to the genetic algorithm that 'owns' the genome.  If this function returns nil then the genome has no genetic algorithm owner.<dt><b>initialize</b><dd>Calls the initialization function for the genome.<dt><b>initializer</b><dd>Set/Get the initialization method.  The initializer must have the correct <a href="#signatures">signature</a>.<dt><b>mutate</b><dd>Calls the mutation method for the genome.  The value is typically the mutation likliehood, but the exact interpretation of this value is up to the designer of the mutation method.<dt><b>mutator</b><dd>Set/Get the mutation method.  The mutator must have the correct <a href="#signatures">signature</a>.<dt><b>nevals</b><dd>Returns the number of objective function evaluations since the genome was initialized.<dt><b>operator==</b><dt><b>operator!=</b><dt><b>operator&lt;&lt;</b><dt><b>operator&gt;&gt;</b><dd>These methods call the associated virtual member functions.  They can be used on any generic genome.  If the derived class was properly defined, the appropriate derived functions will be called and the functions will operate on the derived classes rather than the base class.<dt><b>read</b><dd>Fill the genome with the data read from the specified stream.<dt><b>sexual</b><dt><b>asexual</b><dd>Returns a pointer to the preferred mating method for this genome.  If this function returns nil, no mating method has been defined for the genome.  The <a href="#ga_base">genetic algorithm</a> object has ultimate control over the mating method that is actually used in the evolution.<dt><b>score</b><dd>Returns the objective score of the genome using the objective function assigned to the genome.  If no objective function has been assigned and no score has been set, a score of 0 will be returned.  If the <b>score</b> function is called with an argument, the genome's objective score is set to that value (useful for population-based objective functions in which the population object does the evaluations).<dt><b>userData</b><dd>Each genome contains a generic pointer to user-specifiable data.  Use this member function to set/get that pointer.  Notice that cloning a genome will cause the cloned genome to refer to the <i>same</i> user data pointer as the original; the user data is not cloned as well.  So all genomes in a population refer to the same user data.<dt><b>write</b><dd>Send the contents of the genome to the specified stream.</dl></blockquote><br><br><br><br><a name="genome_list"><big><strong>GAListGenome&lt;T&gt;</strong></big></a><br><hr><blockquote>The list genome is a template class.  It is derived from the GAGenome class as well as the GAList&lt;&gt; class.  It can be used for order-based representations or variable length sequences as well as traditional applications of lists.<p>You <i>must</i> define an initialization operator for this class.  The default initializer is NoInitializer - if you do not assign an initialization operator then you'll get errors about no initializer defined when you try to initialize the genome. </p> <i>see also: <a href="#list">GAList</a></i><br><i>see also: <a href="#genome_base">GAGenome</a></i><br></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GAListGenome&lt;T&gt; : public GAList&lt;T&gt;, public GAGenome</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GAListGenome(GAGenome::Evaluator objective = <i>NULL</i>, void * userData = <i>NULL</i>)GAListGenome(const GAListGenome&lt;T&gt; &amp;)</pre></blockquote><big><strong>genetic operators for this class</strong></big><br><blockquote><pre>GAListGenome&lt;&gt;::DestructiveMutatorGAListGenome&lt;&gt;::SwapMutatorGAListGenome&lt;&gt;::OnePointCrossoverGAListGenome&lt;&gt;::PartialMatchCrossoverGAListGenome&lt;&gt;::OrderCrossoverGAListGenome&lt;&gt;::CycleCrossover</pre></blockquote><big><strong>default genetic operators</strong></big><br><blockquote><pre>initialization:  GAGenome::NoInitializer    comparison:  GAGenome::NoComparator      mutation:  GAListGenome&lt;&gt;::SwapMutator     crossover:  GAListGenome&lt;&gt;::OnePointCrossover</pre></blockquote><br><br><br> <br> <a name="genome_tree"><big><strong>GATreeGenome&lt;T&gt;</strong></big></a><br><hr><blockquote>The tree genome is a template class.  It is derived from the GAGenome class as well as the GATree&lt;&gt; class.  The tree genome can be used for direct manipulation of tree objects.  It can be used to represent binary trees as well as non-binary trees.<p>You <i>must</i> define an initialization operator for this class.  The default initializer is NoInitializer - if you do not assign an initialization operator then you'll get errors about no initializer defined when you try to initialize the genome.  </p>  <i>see also: <a href="#tree">GATree</a></i><br><i>see also: <a href="#genome_base">GAGenome</a></i><br></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GATreeGenome&lt;T&gt; : public GATree&lt;T&gt;, public GAGenome</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GATreeGenome(GAGenome::Evaluator objective = <i>NULL</i>, void * userData = <i>NULL</i>)GATreeGenome(const GATreeGenome&lt;T&gt; &amp;)</pre></blockquote><big><strong>genetic operators for this class</strong></big><br><blockquote><pre>GATreeGenome&lt;&gt;::DestructiveMutatorGATreeGenome&lt;&gt;::SwapSubtreeMutatorGATreeGenome&lt;&gt;::SwapNodeMutatorGATreeGenome&lt;&gt;::OnePointCrossover</pre></blockquote><big><strong>default genetic operators</strong></big><br><blockquote><pre>initialization:  GAGenome::NoInitializer    comparison:  GAGenome::NoComparator      mutation:  GATreeGenome&lt;&gt;::SwapSubtreeMutator     crossover:  GATreeGenome&lt;&gt;::OnePointCrossover</pre></blockquote><br><br><br> <br><a name="genome_string"><strong>GAStringGenome</strong></a><br><hr><blockquote>The string genome can be used for order-based applications, variable length string applications, or non-binary allele set alphabets.  The allele set defines the possible values that each element in the string may assume.<p>The string genome is a specialization of the <a href="#genome_1darrayallele">array genome with alleles</a>.  The specialization is of type <code>char</code>.  You must create an allele set or array of allele sets before you can instantiate this genome.</p> <p>If you create a string genome using a single allele set, each element in the genome will use that allele set to determine its value.  If you create a string genome using an allele set array, the string will have a length equal to the number of elements in the array and each element of the string will be governed by the allele set corresponding to its location in the string.</p><p>To use the string genome in your code, you must include the string genome header file in each of your files that uses the string genome.  You must also include the string genome source file (it contains template specialization code) in <i>one</i> (and only one) of your source files.  Including the string genome source file will force the compiler to use the string specializations.  If you do not include the string genome source file you will get the generic array routines instead (and some of the allele methods will not work as expected).</p><i>see also: <a href="#genome_1darrayallele">GA1DArrayAlleleGenome</a></i><br><i>see also: <a href="#alleleset">GAAlleleSet</a></i><br><i>see also: <a href="#allelesetarray">GAAlleleSetArray</a></i></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>typedef GAAlleleSet&lt;char&gt;                    GAStringAlleleSettypedef GAAlleleSetCore&lt;char&gt;                GAStringAlleleSetCoretypedef GAAlleleSetArray&lt;char&gt;               GAStringAlleleSetArraytypedef GA1DArrayAlleleGenome&lt;char&gt;          GAStringGenome</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GAStringGenome(unsigned int length,               const GAStringAlleleSet &amp;,               GAGenome::Evaluator objective = <i>NULL</i>,               void * userData = <i>NULL</i>)GAStringGenome(const GAStringAlleleSetArray &amp;,               GAGenome::Evaluator objective = <i>NULL</i>,               void * userData = <i>NULL</i>)GAStringGenome(const GAStringGenome&amp;)</pre></blockquote><big><strong>genetic operators for this class</strong></big><br><blockquote><pre>GAStringGenome::UniformInitializerGAStringGenome::OrderedInitializerGAStringGenome::FlipMutatorGAStringGenome::SwapMutatorGAStringGenome::UniformCrossoverGAStringGenome::EvenOddCrossoverGAStringGenome::OnePointCrossoverGAStringGenome::TwoPointCrossoverGAStringGenome::PartialMatchCrossoverGAStringGenome::OrderCrossoverGAStringGenome::CycleCrossover</pre></blockquote><big><strong>default genetic operators</strong></big><br><blockquote><pre>initialization:  GAStringGenome::UniformInitializer    comparison:  GAStringGenome::ElementComparator      mutation:  GAStringGenome::FlipMutator     crossover:  GAStringGenome::UniformCrossover</pre></blockquote><br><br><br> <br> <a name="genome_real"><big><strong>GARealGenome</strong></big></a><br><hr><blockquote>The real number genome was designed to be used for applications whose representation requires an array of (possibly bounded) real number parameters.  The elements of the array can assume bounded values, discretized bounded values, or enumerated values, depending on the type of allele se

⌨️ 快捷键说明

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