Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Genetic Algorithm Library

, 7 Apr 2012 GPL3
A framework for genetic algorithms
galdemoapps.zip
TSP.exe
GeneticLibrary.dll
TestApp1.exe
TestApp2.exe
GaSchedule.exe
GaSchedule.cfg
GalDemoSource.zip
TestApp1
TestApp1.vcxproj.filters
TestApp2
TestApp2.vcxproj.filters
TSP
res
.svn
entries
prop-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
props
text-base
Toolbar.bmp.svn-base
TSP.ico.svn-base
TSP.rc2.svn-base
tmp
prop-base
props
text-base
Toolbar.bmp
TSP.ico
TSP.vcxproj.filters
GaSchedule
Algorithm
GaSchedule.cfg
GaSchedule.vcxproj.filters
res
GaSchedule.ico
galdocumentation.zip
doxygen.png
Graphic
ab_cp.png
alg_st.png
a_cr.png
c_cp.png
i_cp.png
mp_cr.png
mv_cr.png
r_cp.png
s_cp.png
s_cr.png
galsource.zip
GeneticLibrary
build
release
gcc_bsd
gcc_linux
gcc_macos
gcc_solaris
icc_linux
icc_macos
icc_win
mingw
msvc
scc_solaris
makefiles
gcc_bsd_debug
gcc_bsd_release
gcc_linux_debug
gcc_linux_release
gcc_macos_debug
gcc_macos_release
gcc_solaris_debug
gcc_solaris_release
icc_linux_debug
icc_linux_release
icc_macos_debug
icc_macos_release
scc_solaris_debug
scc_solaris_release
source
vs
<!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::CouplingOperations::GaCrossCoupling 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_coupling_operations.html">CouplingOperations</a>::<a class="el" href="class_population_1_1_coupling_operations_1_1_ga_cross_coupling.html">GaCrossCoupling</a>
  </div>
</div>
<div class="contents">
<h1>Population::CouplingOperations::GaCrossCoupling Class Reference</h1><!-- doxytag: class="Population::CouplingOperations::GaCrossCoupling" --><!-- doxytag: inherits="Population::GaCouplingOperation" --><code><a class="el" href="class_population_1_1_coupling_operations_1_1_ga_cross_coupling.html" title="GaCrossCoupling coupling takes first parents sequentially from selection result set...">GaCrossCoupling</a></code> coupling takes first parents sequentially from selection result set, and second parents are the ones who are right below the first. If all parents are used, but more children should be produced, this coupling operation wraps-around parent counter and starts from beginning until enough children is produced. When two parents are chosen this operation produces specified number of children using crossover operation and then it chooses child with best fitness value among produced children and first parent is bound to it. This coupling use GaMultipleCrossoverCouplingParams class for parameters.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/CouplingOperations.h&gt;</code>
<p>
Inherits <a class="el" href="class_population_1_1_ga_coupling_operation.html">Population::GaCouplingOperation</a>.
<p>

<p>
<a href="class_population_1_1_coupling_operations_1_1_ga_cross_coupling-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_coupling_operations_1_1_ga_cross_coupling.html#ff8fc5c62fc176868af1e3362ba98342">operator()</a> (const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &amp;population, <a class="el" href="class_population_1_1_ga_coupling_result_set.html">GaCouplingResultSet</a> &amp;output, const <a class="el" href="class_population_1_1_ga_coupling_params.html">GaCouplingParams</a> &amp;parameters, int workerId, int numberOfWorkers) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaCouplingOperation::operator () method.  <a href="#ff8fc5c62fc176868af1e3362ba98342"></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_coupling_operations_1_1_ga_cross_coupling.html#dad56e27099b5f2dc4fd131622b69a0b">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="#dad56e27099b5f2dc4fd131622b69a0b"></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_coupling_operations_1_1_ga_cross_coupling.html#6641a1260edd17b12f98a16bc54fbf51">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 number of offspring for production and number of produced children per parent pair grater then 0.  <a href="#6641a1260edd17b12f98a16bc54fbf51"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<code><a class="el" href="class_population_1_1_coupling_operations_1_1_ga_cross_coupling.html" title="GaCrossCoupling coupling takes first parents sequentially from selection result set...">GaCrossCoupling</a></code> coupling takes first parents sequentially from selection result set, and second parents are the ones who are right below the first. If all parents are used, but more children should be produced, this coupling operation wraps-around parent counter and starts from beginning until enough children is produced. When two parents are chosen this operation produces specified number of children using crossover operation and then it chooses child with best fitness value among produced children and first parent is bound to it. This coupling use GaMultipleCrossoverCouplingParams class for parameters. 
<p>
<div align="center">
<img src="graphic/c_cp.png" alt="c_cp.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="ff8fc5c62fc176868af1e3362ba98342"></a><!-- doxytag: member="Population::CouplingOperations::GaCrossCoupling::operator()" ref="ff8fc5c62fc176868af1e3362ba98342" args="(const GaPopulation &amp;population, GaCouplingResultSet &amp;output, const GaCouplingParams &amp;parameters, int workerId, int numberOfWorkers) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Population::CouplingOperations::GaCrossCoupling::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"><a class="el" href="class_population_1_1_ga_coupling_result_set.html">GaCouplingResultSet</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>output</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_population_1_1_ga_coupling_params.html">GaCouplingParams</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>parameters</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>workerId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>numberOfWorkers</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 GaCouplingOperation::operator () method. 
<p>
This method is thread-safe. 
<p>Implements <a class="el" href="class_population_1_1_ga_coupling_operation.html#4277d5ddf98ec358a9c2666954041eda">Population::GaCouplingOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="dad56e27099b5f2dc4fd131622b69a0b"></a><!-- doxytag: member="Population::CouplingOperations::GaCrossCoupling::MakeParameters" ref="dad56e27099b5f2dc4fd131622b69a0b" 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::CouplingOperations::GaCrossCoupling::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_coupling_operations_1_1_ga_mulitple_crossover_coupling_params.html" title="This class should be used (directly or by inheritance) by coupling operations which...">GaMulitpleCrossoverCouplingParams</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="6641a1260edd17b12f98a16bc54fbf51"></a><!-- doxytag: member="Population::CouplingOperations::GaCrossCoupling::CheckParameters" ref="6641a1260edd17b12f98a16bc54fbf51" args="(const GaParameters &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::CouplingOperations::GaCrossCoupling::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 number of offspring for production and number of produced children per parent pair grater then 0. 
<p>
More details are given in specification of GaOperation::CheckParameters method.<p>
This method is thread-safe. 
<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="_coupling_operations_8h.html">CouplingOperations.h</a><li>source/<a class="el" href="_coupling_operations_8cpp.html">CouplingOperations.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)

Share

About the Author

Mladen Janković
Software Developer
Serbia Serbia
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 7 Apr 2012
Article Copyright 2008 by Mladen Janković
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid