Click here to Skip to main content
15,881,687 members
Articles / Desktop Programming / MFC

Genetic Algorithm Library

Rate me:
Please Sign up or sign in to vote.
4.93/5 (175 votes)
7 Apr 2012GPL358 min read 435.7K   34.7K   555  
A framework for genetic algorithms
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Genetic Algorithm Library: Population::SelectionOperations::GaSelectTournament Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespace_population.html">Population</a>::<a class="el" href="namespace_population_1_1_selection_operations.html">SelectionOperations</a>::<a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html">GaSelectTournament</a>
  </div>
</div>
<div class="contents">
<h1>Population::SelectionOperations::GaSelectTournament Class Reference</h1><!-- doxytag: class="Population::SelectionOperations::GaSelectTournament" --><!-- doxytag: inherits="Population::SelectionOperations::GaSelectRouletteWheel" --><code>GaSelectTorunament</code> selection is similar to <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html" title="When GaSelectRouletteWheel selection is used chromosomes with better fitness values...">GaSelectRouletteWheel</a> selection. For one place in result set it performs multiple roulette wheel selection before it chooses only one chromosome with best fitness value among selected. This increases probability of selection of chromosome with better fitness value. This selection use GaSelectTorunamentParams class for parameters.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/SelectionOperations.h&gt;</code>
<p>
Inherits <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html">Population::SelectionOperations::GaSelectRouletteWheel</a>.
<p>

<p>
<a href="class_population_1_1_selection_operations_1_1_ga_select_tournament-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual GAL_API void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#9b4ccc38a64b0df228ff507f1b700e28">operator()</a> (const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &amp;population, const <a class="el" href="class_population_1_1_ga_selection_params.html">GaSelectionParams</a> &amp;parameters, <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> &amp;result) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaSelectionOperation::operator () method.  <a href="#9b4ccc38a64b0df228ff507f1b700e28"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> *GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#b03d97f5584e3ec5902d958d4cf83001">MakeParameters</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaOperation::MakeParameters method.  <a href="#b03d97f5584e3ec5902d958d4cf83001"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#2e3f380957b3a5efe3b79021a684e245">CheckParameters</a> (const <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> &amp;parameters) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Valid parameters must have selection size and number of selections grater then 0.  <a href="#2e3f380957b3a5efe3b79021a684e245"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<code>GaSelectTorunament</code> selection is similar to <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html" title="When GaSelectRouletteWheel selection is used chromosomes with better fitness values...">GaSelectRouletteWheel</a> selection. For one place in result set it performs multiple roulette wheel selection before it chooses only one chromosome with best fitness value among selected. This increases probability of selection of chromosome with better fitness value. This selection use GaSelectTorunamentParams class for parameters. 
<p>
This class has no built-in synchronizator, so <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code> macros cannot be used with instances of this class. Because this genetic operation is stateless all public method are thread-safe. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="9b4ccc38a64b0df228ff507f1b700e28"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectTournament::operator()" ref="9b4ccc38a64b0df228ff507f1b700e28" args="(const GaPopulation &amp;population, const GaSelectionParams &amp;parameters, GaSelectionResultSet &amp;result) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Population::SelectionOperations::GaSelectTournament::operator()           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>population</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_population_1_1_ga_selection_params.html">GaSelectionParams</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>parameters</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>result</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
More details are given in specification of GaSelectionOperation::operator () method. 
<p>
This method is thread-safe. 
<p>Reimplemented from <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#04f2dd105556f35310ac2693a16b2a48">Population::SelectionOperations::GaSelectRouletteWheel</a>.</p>

</div>
</div><p>
<a class="anchor" name="b03d97f5584e3ec5902d958d4cf83001"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectTournament::MakeParameters" ref="b03d97f5584e3ec5902d958d4cf83001" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a>* GACALL Population::SelectionOperations::GaSelectTournament::MakeParameters           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
More details are given in specification of GaOperation::MakeParameters method. 
<p>
This method is thread-safe. <dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns new instance of <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament_params.html" title="This class is used by GaSelectTournament selection operations.">GaSelectTournamentParams</a> class.</dd></dl>

<p>Reimplemented from <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#580d55ac3fa47bb3e9e83b3ef785c7dc">Population::SelectionOperations::GaSelectRouletteWheel</a>.</p>

</div>
</div><p>
<a class="anchor" name="2e3f380957b3a5efe3b79021a684e245"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectTournament::CheckParameters" ref="2e3f380957b3a5efe3b79021a684e245" args="(const GaParameters &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::SelectionOperations::GaSelectTournament::CheckParameters           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>parameters</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Valid parameters must have selection size and number of selections grater then 0. 
<p>
More details are given in specification of GaOperation::CheckParameters method.<p>
This method is thread-safe. 
<p>Reimplemented from <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#0b70bccaa7fa692b3df58d616b11cb04">Population::SelectionOperations::GaSelectRouletteWheel</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>source/<a class="el" href="_selection_operations_8h.html">SelectionOperations.h</a><li>source/<a class="el" href="_selection_operations_8cpp.html">SelectionOperations.cpp</a></ul>
</div>
<br/><a href="http://www.coolsoft-sd.com/ProductVersion.aspx?vid=9">Genetic Algorithm Library</a><br/><a href="http://www.coolsoft-sd.com/">Coolsoft Software Development</a>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
Serbia Serbia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions