Click here to Skip to main content
15,891,375 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 439K   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::GaSelectRandomBestParams 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_random_best_params.html">GaSelectRandomBestParams</a>
  </div>
</div>
<div class="contents">
<h1>Population::SelectionOperations::GaSelectRandomBestParams Class Reference</h1><!-- doxytag: class="Population::SelectionOperations::GaSelectRandomBestParams" --><!-- doxytag: inherits="Population::SelectionOperations::GaSelectDuplicatesParams" -->This class is used by <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best.html" title="GaSelectRandomBest selection is randomly selects number of chromosomes and then it...">GaSelectRandomBest</a> selection operations.  
<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_duplicates_params.html">Population::SelectionOperations::GaSelectDuplicatesParams</a>.
<p>

<p>
<a href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params-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">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#765f9e964952835f9ea6063800b94de6">GaSelectRandomBestParams</a> (int selectionSize, bool duplicates, int groupSize)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor initializes parameters with user defined values.  <a href="#765f9e964952835f9ea6063800b94de6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#9dd2c51bc06a14701108af1cda36e18e">GaSelectRandomBestParams</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor initializes parameters with default values. Duplicates are not allowed, selection size is 2, and group size is 4.  <a href="#9dd2c51bc06a14701108af1cda36e18e"></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_random_best_params.html#c3cb5a410fcec5ba8ff2abdc750e8192">Clone</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaParameters::Clone method.  <a href="#c3cb5a410fcec5ba8ff2abdc750e8192"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#25962f1d24422300368093c79f3cd284">GetGroupSize</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#25962f1d24422300368093c79f3cd284"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#bebcd52e6a0e1b76ba6c35198e72c68f">SetGroupSize</a> (int size)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetGroupSize</code> sets number of chromosomes which should be selected using random selection.  <a href="#bebcd52e6a0e1b76ba6c35198e72c68f"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#816cae6fec78494b13b40c0db78f7f7e">_groupSize</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Number of chromosomes which should be selected using random selection.  <a href="#816cae6fec78494b13b40c0db78f7f7e"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class is used by <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best.html" title="GaSelectRandomBest selection is randomly selects number of chromosomes and then it...">GaSelectRandomBest</a> selection operations. 
<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>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="765f9e964952835f9ea6063800b94de6"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::GaSelectRandomBestParams" ref="765f9e964952835f9ea6063800b94de6" args="(int selectionSize, bool duplicates, int groupSize)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Population::SelectionOperations::GaSelectRandomBestParams::GaSelectRandomBestParams           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>selectionSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>duplicates</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>groupSize</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor initializes parameters with user defined values. 
<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>selectionSize</em>&nbsp;</td><td>number of chromosomes which should be selected.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>duplicates</em>&nbsp;</td><td>if this parameter is set to <code>true</code>, duplicates of same chromosome in result set are allowed. If it is set to <code>false</code> duplicates are not allowed.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>groupSize</em>&nbsp;</td><td>number of chromosomes which should be selected randomly.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="9dd2c51bc06a14701108af1cda36e18e"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::GaSelectRandomBestParams" ref="9dd2c51bc06a14701108af1cda36e18e" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Population::SelectionOperations::GaSelectRandomBestParams::GaSelectRandomBestParams           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor initializes parameters with default values. Duplicates are not allowed, selection size is 2, and group size is 4. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="c3cb5a410fcec5ba8ff2abdc750e8192"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::Clone" ref="c3cb5a410fcec5ba8ff2abdc750e8192" 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::GaSelectRandomBestParams::Clone           </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 GaParameters::Clone method. 
<p>
This method is not thread-safe. 
<p>Reimplemented from <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_duplicates_params.html#1ce3a8b40e2d0419b0c9af04014790ee">Population::SelectionOperations::GaSelectDuplicatesParams</a>.</p>

</div>
</div><p>
<a class="anchor" name="25962f1d24422300368093c79f3cd284"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::GetGroupSize" ref="25962f1d24422300368093c79f3cd284" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GACALL Population::SelectionOperations::GaSelectRandomBestParams::GetGroupSize           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method is not thread-safe. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns number of chromosomes which should be selected using random selection.</dd></dl>

</div>
</div><p>
<a class="anchor" name="bebcd52e6a0e1b76ba6c35198e72c68f"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::SetGroupSize" ref="bebcd52e6a0e1b76ba6c35198e72c68f" args="(int size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Population::SelectionOperations::GaSelectRandomBestParams::SetGroupSize           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>size</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetGroupSize</code> sets number of chromosomes which should be selected using random selection. 
<p>
This method is not 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>size</em>&nbsp;</td><td>number of chromosomes which should be selected using random selection.</td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="816cae6fec78494b13b40c0db78f7f7e"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRandomBestParams::_groupSize" ref="816cae6fec78494b13b40c0db78f7f7e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_random_best_params.html#816cae6fec78494b13b40c0db78f7f7e">Population::SelectionOperations::GaSelectRandomBestParams::_groupSize</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Number of chromosomes which should be selected using random selection. 
<p>

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