Click here to Skip to main content
15,896,444 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 439.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::GaSelectionOperation 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="class_population_1_1_ga_selection_operation.html">GaSelectionOperation</a>
  </div>
</div>
<div class="contents">
<h1>Population::GaSelectionOperation Class Reference</h1><!-- doxytag: class="Population::GaSelectionOperation" --><!-- doxytag: inherits="Common::GaOperation" -->This class is interface for selection operation which selects chromosomes from population which are going to be used as parents in production of new chromosomes.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/PopulationOperations.h&gt;</code>
<p>
Inherits <a class="el" href="class_common_1_1_ga_operation.html">Common::GaOperation</a>.
<p>
Inherited by <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_best.html">Population::SelectionOperations::GaSelectBest</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random.html">Population::SelectionOperations::GaSelectRandom</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html">Population::SelectionOperations::GaSelectRouletteWheel</a>, and <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_worst.html">Population::SelectionOperations::GaSelectWorst</a>.
<p>

<p>
<a href="class_population_1_1_ga_selection_operation-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 void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_ga_selection_operation.html#31741a85955ec1b0eee9b7bf00c428ee">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 =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>operator ()</code> performs replacement operation.  <a href="#31741a85955ec1b0eee9b7bf00c428ee"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> <br>
*GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_ga_selection_operation.html#f5bee13f9d266e5f5fb7a3dbaa5f8132">MakeResultSet</a> (<a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *population, const <a class="el" href="class_population_1_1_ga_selection_params.html">GaSelectionParams</a> &amp;parameters) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>MakeResultSet</code> method makes result set used by selection operation for storing chromosomes indices. Caller is responsible for memory allocated by this method for result set object.  <a href="#f5bee13f9d266e5f5fb7a3dbaa5f8132"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class is interface for selection operation which selects chromosomes from population which are going to be used as parents in production of new chromosomes. 
<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. No public or private methods are thread-safe. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="31741a85955ec1b0eee9b7bf00c428ee"></a><!-- doxytag: member="Population::GaSelectionOperation::operator()" ref="31741a85955ec1b0eee9b7bf00c428ee" args="(const GaPopulation &amp;population, const GaSelectionParams &amp;parameters, GaSelectionResultSet &amp;result) const =0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void GACALL Population::GaSelectionOperation::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> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>operator ()</code> performs replacement operation. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>population</em>&nbsp;</td><td>reference to population from which chromosomes are selected.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parameters</em>&nbsp;</td><td>reference to parameters of selection operation.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>pointer to result set which is used to store selected chromosomes.</td></tr>
  </table>
</dl>

<p>Implemented in <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_best.html#070e9668ef3fa7f872c183250bbce35b">Population::SelectionOperations::GaSelectBest</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random.html#5afe47b74e868de5c2beb93230578a71">Population::SelectionOperations::GaSelectRandom</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best.html#8da773ed83427cbb047d9ea660fd384d">Population::SelectionOperations::GaSelectRandomBest</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#04f2dd105556f35310ac2693a16b2a48">Population::SelectionOperations::GaSelectRouletteWheel</a>, <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#9b4ccc38a64b0df228ff507f1b700e28">Population::SelectionOperations::GaSelectTournament</a>, and <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_worst.html#79d5b018cde4ea68c07b46fea0801b82">Population::SelectionOperations::GaSelectWorst</a>.</p>

</div>
</div><p>
<a class="anchor" name="f5bee13f9d266e5f5fb7a3dbaa5f8132"></a><!-- doxytag: member="Population::GaSelectionOperation::MakeResultSet" ref="f5bee13f9d266e5f5fb7a3dbaa5f8132" args="(GaPopulation *population, const GaSelectionParams &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a>* GACALL Population::GaSelectionOperation::MakeResultSet           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *&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><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>MakeResultSet</code> method makes result set used by selection operation for storing chromosomes indices. Caller is responsible for memory allocated by this method for result set object. 
<p>
This method is thread-safe. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>population</em>&nbsp;</td><td>pointer to population to which result set is bound.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parameters</em>&nbsp;</td><td>reference to parameters of selection operation.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns pointer to newly created result set.</dd></dl>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>source/<a class="el" href="_population_operations_8h.html">PopulationOperations.h</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