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

📄 api.html

📁 麻省理工开发的免费遗传算法类库GAlib,很好用
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<p>Elitism is optional.  By default, elitism is on, meaning that the best individual from each generation is carried over to the next generation.  To turn off elitism, pass gaFalse to the <b>elitist</b> member function.</p><p>The score frequency for this genetic algorithm defaults to 1 (it records the best-of-generation every generation).  The default scaling is Linear, the default selection is RouletteWheel.</p><i>see also: <a href="#ga_base">GAGeneticAlgorithm</a></i></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GASimpleGA : public GAGeneticAlgorithm</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GASimpleGA(const GAGenome&amp;)GASimpleGA(const GAPopulation&amp;)GASimpleGA(const GASimpleGA&amp;)</pre></blockquote><big><strong>member function index</strong></big><br><blockquote><pre>static GAParameterList&amp; <b>registerDefaultParameters</b>(GAParameterList&amp;);           GASimpleGA &amp; <b>operator++</b>()              GABoolean <b>elitist</b>() const              GABoolean <b>elitist</b>(GABoolean flag)</pre></blockquote><big><strong>member function descriptions</strong></big><br><blockquote><dl>    <dt><b>elitist</b>  <dd>Set/Get the elitism flag.  If you specify gaTrue, the genetic algorithm will copy the best individual from the previous population into the current population if no individual in the current population is any better.         <dt><b>operator++</b>  <dd>The increment operator evolves the genetic algorithm's population by one generation by calling the <b>step</b> member function.         <dt><b>registerDefaultParameters</b>  <dd>This function adds to the specified list parameters that are of interest to this genetic algorithm.  The default parameters for the simple genetic algorithm are the parameters for the base genetic algorithm class plus the following:       <ul>	 <li>elitism       </ul>       </dl></blockquote><br><br><br><br><a name="ga_overlapping"><big><strong>GASteadyStateGA</strong></big> (overlapping populations)</a><br><hr><blockquote>This genetic algorithm is similar to the algorithms described by DeJong.  It uses overlapping populations with a user-specifiable amount of overlap.  The algorithm creates a population of individuals by cloning the genome or population that you pass when you create it.  Each generation the algorithm creates a temporary population of individuals, adds these to the previous population, then removes the worst individuals in order to return the population to its original size.<p>You can select the amount of overlap between generations by specifying the <b>pReplacement</b> parameter.  This is the percentage of the population that should be replaced each generation.  Newly generated offspring are added to the population, then the worst individuals are destroyed (so the new offspring may or may not make it into the population, depending on whether they are better than the worst in the population).</p><p>If you specify a replacement percentage, then that percentage of the population will be replaced each generation.  Alternatively, you can specify a number of individuals (less than the number in the population) to replace each generation.  You cannot specify both - in a parameter list containing both parameters, the latter is used.</p><p>The score frequency for this genetic algorithm defaults to 100 (it records the best-of-generation every 100th generation).  The default scaling is Linear, the default selection is RouletteWheel.</p><i>see also: <a href="#ga_base">GAGeneticAlgorithm</a></i></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GASteadyStateGA : public GAGeneticAlgorithm</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GASteadyStateGA(const GAGenome&amp;)GASteadyStateGA(const GAPopulation&amp;)GASteadyStateGA(const GASteadyStateGA&amp;)</pre></blockquote><big><strong>member function index</strong></big><br><blockquote><pre>static GAParameterList&amp; <b>registerDefaultParameters</b>(GAParameterList&amp;);      GASteadyStateGA &amp; <b>operator++</b>()                  float <b>pReplacement</b>() const                  float <b>pReplacement</b>(float percentage)                    int <b>nReplacement</b>() const                    int <b>nReplacement</b>(unsigned int)</pre></blockquote><big><strong>member function descriptions</strong></big><br><blockquote><dl>  <dt><b>nReplacement</b>  <dd>Specify a number of individuals to replace each generation.  When you specify a number of individuals to replace, the pReplacement value is set to 0.         <dt><b>operator++</b>  <dd>The increment operator evolves the genetic algorithm's population by one generation by calling the <b>step</b> member function.         <dt><b>pReplacement</b>  <dd>Specify a percentage of the population to replace each generation.  When you specify a replacement percentage, the nReplacement value is set to 0.  <dt><b>registerDefaultParameters</b>  <dd>This function adds to the specified list parameters that are of interest to this genetic algorithm.  The default parameters for the steady-state genetic algorithm are the parameters for the base genetic algorithm class plus the following:       <ul>	 <li>pReplacement	 <li>nReplacement       </ul></dl></blockquote><br><br><br><br><a name="ga_incremental"><big><strong>GAIncrementalGA</strong></big> (overlapping populations with 1 or 2 children per generation)</a><br><hr><blockquote>This genetic algorithm is similar to those based on the GENITOR model.  It uses overlapping populations, but very little overlap (only one or two individuals get replaced each generation).  The default replacement scheme is WORST.  A replacement function is required only if you use CUSTOM or CROWDING as the replacement scheme.  You can do DeJong-style crowding by specifying a distance function with the CROWDING option.  (for best DeJong-style results, derive your own genetic algorithm)<p>You can specify the number of children that are generated in each 'generation' by using the <b>nOffspring</b> member function.  Since this genetic algorithm is based on a two-parent crossover model, the number of offspring must be either 1 or 2.  The default is 2.</p><p>Use the <b>replacement</b> method to specify which type of replacement the genetic algorithm should use.  The replacement strategy determines how the new children will be inserted into the population.  If you want the new child to replace one of its parents, use the Parent strategy.  If you want the child to replace a random population member, use the Random strategy.  If you want the child to replace the worst population member, use the Worst strategy.</p><p>If you specify CUSTOM or CROWDING you must also specify a replacement function with the proper <a href="#signatures">signature</a>.  This function is used to pick which genome will be replaced.  The first argument passed to the replacement function is the individual that is supposed to go into the population.  The second argument is the population into which the individual is supposed to go.  The replacement function should return a reference to the genome that the individual should replace.  If no replacement should take place, the replacement function should return a reference to the individual.</p><p>The score frequency for this genetic algorithm defaults to 100 (it records the best-of-generation every 100th generation).  The default scaling is Linear, the default selection is RouletteWheel.</p><i>see also: <a href="#ga_base">GAGeneticAlgorithm</a></i></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GAIncrementalGA : public GAGeneticAlgorithm</pre></blockquote><big><strong>typedefs and constants</strong></big><br><blockquote><pre>GAGenome&amp; (*<b>GAIncrementalGA::ReplacementFunction</b>)(GAGenome &amp;, GAPopulation &amp;)enum ReplacementScheme {    <b>RANDOM</b> = GAPopulation::RANDOM,    <b>BEST</b> = GAPopulation::BEST,    <b>WORST</b> = GAPopulation::WORST,    <b>CUSTOM</b> = -30,    <b>CROWDING</b> = -30,    <b>PARENT</b> = -10    };</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GAIncrementalGA(const GAGenome&amp;)GAIncrementalGA(const GAPopulation&amp;)GAIncrementalGA(const GAIncrementalGA&amp;)</pre></blockquote><big><strong>member function index</strong></big><br><blockquote><pre>static GAParameterList&amp; <b>registerDefaultParameters</b>(GAParameterList&amp;);      GASteadyStateGA &amp; <b>operator++</b>()      ReplacementScheme <b>replacement</b>()      ReplacementScheme <b>replacement</b>(ReplacementScheme, ReplacementFunction f = <i>NULL</i>)                    int <b>nOffspring</b>() const                    int <b>nOffspring</b>(unsigned int n)</pre></blockquote><big><strong>member function descriptions</strong></big><br><blockquote><dl>  <dt><b>nOffspring</b>  <dd>The incremental genetic algorithm can produce either one or two individuals each generation.  Use this member function to specify how many individuals you would like.         <dt><b>operator++</b>  <dd>The increment operator evolves the genetic algorithm's population by one generation by calling the <b>step</b> member function.         <dt><b>registerDefaultParameters</b>  <dd>This function adds to the specified list parameters that are of interest to this genetic algorithm.  The default parameters for the incremental genetic algorithm are the parameters for the base genetic algorithm class plus the following:       <ul>	 <li>nOffspring       </ul>  <dt><b>replacement</b>  <dd>Specify a replacement method.  The scheme can be one of       <ul>       <li>GAIncrementalGA::RANDOM       <li>GAIncrementalGA::BEST       <li>GAIncrementalGA::WORST       <li>GAIncrementalGA::CUSTOM       <li>GAIncrementalGA::CROWDING       <li>GAIncrementalGA::PARENT     </ul>     If you specify custom or crowding replacement then you must also specify a function.  The replacement function takes two arguments:  the individual to insert and the population into which it will be inserted.  The replacement function should return a reference to the genome that should be replaced.  If no replacement should take place, the replacement function should return a reference to the individual passed to it.</dl></blockquote><br><br><br><br><a name="ga_deme"><big><strong>GADemeGA</strong></big> (parallel populations with migration)</a><br><hr><blockquote>This genetic algorithm has multiple, independent populations.  It creates the populations by cloning the genome or population that you pass when you create it.<p>Each population evolves using a steady-state genetic algorithm, but each generation some individuals migrate from one population to another.  The migration algorithm is deterministic stepping-stone; each population migrates a fixed number of its best individuals to its neighbor.  The master population is updated each generation with best individual from each population.</p><p>If you want to experiment with other migration methods, derive a new class from this one and define a new migration operator.  You can change the evolution behavior by defining a new <b>step</b> method in a derived class.</p><i>see also: <a href="#ga_base">GAGeneticAlgorithm</a></i></blockquote><big><strong>class hierarchy</strong></big><br><blockquote><pre>class GADemeGA : public GAGeneticAlgorithm</pre></blockquote><big><strong>typedefs and constants</strong></big><br><blockquote><pre>enum { <b>ALL</b>= -1 };</pre></blockquote><big><strong>constructors</strong></big><br><blockquote><pre>GADemeGA(const GAGenome&amp;)GADemeGA(const GAPopulation&amp;)GADemeGA(const GADemeGA&amp;)</pre></blockquote><big><strong>member function index</strong></big><br><blockquote><pre>static GAParameterList&amp; <b>registerDefaultParameters</b>(GAParameterList&amp;);               void <b>migrate</b>()         GADemeGA &amp; <b>operator++</b>()

⌨️ 快捷键说明

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