Click here to Skip to main content
15,886,578 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 437.9K   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: Chromosome::CrossoverOperations::GaSubCrossover 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_chromosome.html">Chromosome</a>::<a class="el" href="namespace_chromosome_1_1_crossover_operations.html">CrossoverOperations</a>::<a class="el" href="class_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html">GaSubCrossover</a>
  </div>
</div>
<div class="contents">
<h1>Chromosome::CrossoverOperations::GaSubCrossover Class Reference</h1><!-- doxytag: class="Chromosome::CrossoverOperations::GaSubCrossover" --><!-- doxytag: inherits="Chromosome::GaCrossoverOperation" --><code><a class="el" href="class_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html" title="GaSubCrossover crossover operation creates offspring which code has values which...">GaSubCrossover</a></code> crossover operation creates offspring which code has values which are calculated form corresponding values of codes of both parents by subtracting them.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/CrossoverOperations.h&gt;</code>
<p>
Inherits <a class="el" href="class_chromosome_1_1_ga_crossover_operation.html">Chromosome::GaCrossoverOperation</a>.
<p>

<p>
<a href="class_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover-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 <br>
<a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a> GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html#8812c8ef0be2ad1d8f2a023182781331">operator()</a> (const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> *parent1, const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> *parent2) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaCrossoverOperation::operator () method.  <a href="#8812c8ef0be2ad1d8f2a023182781331"></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_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html#cbd0efa50f8ff0d85024d990574587eb">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="#cbd0efa50f8ff0d85024d990574587eb"></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_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html#185e5ca641b35297a81b2815936ec89d">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">More details are given in specification of GaOperation::CheckParameters method.  <a href="#185e5ca641b35297a81b2815936ec89d"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<code><a class="el" href="class_chromosome_1_1_crossover_operations_1_1_ga_sub_crossover.html" title="GaSubCrossover crossover operation creates offspring which code has values which...">GaSubCrossover</a></code> crossover operation creates offspring which code has values which are calculated form corresponding values of codes of both parents by subtracting them. 
<p>
<div align="center">
<img src="graphic/s_cr.png" alt="s_cr.png">
</div>
<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="8812c8ef0be2ad1d8f2a023182781331"></a><!-- doxytag: member="Chromosome::CrossoverOperations::GaSubCrossover::operator()" ref="8812c8ef0be2ad1d8f2a023182781331" args="(const GaChromosome *parent1, const GaChromosome *parent2) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a> Chromosome::CrossoverOperations::GaSubCrossover::operator()           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> *&nbsp;</td>
          <td class="paramname"> <em>parent1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> *&nbsp;</td>
          <td class="paramname"> <em>parent2</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 GaCrossoverOperation::operator () method. 
<p>
This method is thread-safe. 
<p>Implements <a class="el" href="class_chromosome_1_1_ga_crossover_operation.html#88420773a9822f4f7fb28ff3f2a1fa56">Chromosome::GaCrossoverOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="cbd0efa50f8ff0d85024d990574587eb"></a><!-- doxytag: member="Chromosome::CrossoverOperations::GaSubCrossover::MakeParameters" ref="cbd0efa50f8ff0d85024d990574587eb" 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 Chromosome::CrossoverOperations::GaSubCrossover::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_chromosome_1_1_ga_chromosome_params.html" title="This class is base class for all chromosomes&#39; parameters. Built-in genetic operations...">GaChromosomeParams</a> class.</dd></dl>

<p>Implements <a class="el" href="class_common_1_1_ga_operation.html#7da19e41bc86254ea540a55a09384023">Common::GaOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="185e5ca641b35297a81b2815936ec89d"></a><!-- doxytag: member="Chromosome::CrossoverOperations::GaSubCrossover::CheckParameters" ref="185e5ca641b35297a81b2815936ec89d" args="(const GaParameters &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Chromosome::CrossoverOperations::GaSubCrossover::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>
More details are given in specification of GaOperation::CheckParameters method. 
<p>
This method is thread-safe. <dl class="return" compact><dt><b>Returns:</b></dt><dd>This method always returns <code>true</code>.</dd></dl>

<p>Implements <a class="el" href="class_common_1_1_ga_operation.html#43b1b5c6a68418b09ec1ac04663d02b6">Common::GaOperation</a>.</p>

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