Click here to Skip to main content
15,885,366 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.6K   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::ScalingOperations::GaLinearScaling 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_scaling_operations.html">ScalingOperations</a>::<a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html">GaLinearScaling</a>
  </div>
</div>
<div class="contents">
<h1>Population::ScalingOperations::GaLinearScaling Class Reference</h1><!-- doxytag: class="Population::ScalingOperations::GaLinearScaling" --><!-- doxytag: inherits="Population::GaScalingOperation" --><code><a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html" title="GaLinearScaling operation calculates scaled fitness value of chromosome by applying...">GaLinearScaling</a></code> operation calculates scaled fitness value of chromosome by applying linear function <code>a * f + b</code> fitness value, to where a and b are calculated from scale factor which is provided in operation parameters. This scaling operation is not based on ranking of chromosome and use GaScaleFactor class for parameters.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/ScalingOperations.h&gt;</code>
<p>
Inherits <a class="el" href="class_population_1_1_ga_scaling_operation.html">Population::GaScalingOperation</a>.
<p>

<p>
<a href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling-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 float GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html#48d9d1f3e895974f4b8376f842bec673">operator()</a> (const <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html">GaScaledChromosome</a> &amp;chromosome, 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_scaling_params.html">GaScalingParams</a> &amp;parameters) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of GaScalingOperation::operator () method.  <a href="#48d9d1f3e895974f4b8376f842bec673"></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_scaling_operations_1_1_ga_linear_scaling.html#7bb4a3940b2908b41af1f12d3a8566e8">IsRankingBased</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of <a class="el" href="class_population_1_1_ga_scaling_operation.html#715be1b117b5856dae87b60df9b368ab" title="IsRankingBased method should return true if scaling of fitness value is based on...">GaScalingOperation::IsRankingBased</a> method.  <a href="#7bb4a3940b2908b41af1f12d3a8566e8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual GAL_API bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html#05583f9f487a4494e5896531171c5443">NeedRescaling</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_scaling_params.html">GaScalingParams</a> &amp;parameters) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">More details are given in specification of <a class="el" href="class_population_1_1_ga_scaling_operation.html#592fce6744bf6586ea795001f33e6f86" title="NeedRescaling method checks current population for consistence of chromosomes&#39;...">GaScalingOperation::NeedRescaling</a> method.  <a href="#05583f9f487a4494e5896531171c5443"></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_scaling_operations_1_1_ga_linear_scaling.html#e86fca8dcd6855971fc70729b50f9230">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="#e86fca8dcd6855971fc70729b50f9230"></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_scaling_operations_1_1_ga_linear_scaling.html#386b20eecc8b26bb4340687fda48d0d5">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="#386b20eecc8b26bb4340687fda48d0d5"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<code><a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html" title="GaLinearScaling operation calculates scaled fitness value of chromosome by applying...">GaLinearScaling</a></code> operation calculates scaled fitness value of chromosome by applying linear function <code>a * f + b</code> fitness value, to where a and b are calculated from scale factor which is provided in operation parameters. This scaling operation is not based on ranking of chromosome and use GaScaleFactor 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="48d9d1f3e895974f4b8376f842bec673"></a><!-- doxytag: member="Population::ScalingOperations::GaLinearScaling::operator()" ref="48d9d1f3e895974f4b8376f842bec673" args="(const GaScaledChromosome &amp;chromosome, const GaPopulation &amp;population, const GaScalingParams &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float Population::ScalingOperations::GaLinearScaling::operator()           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html">GaScaledChromosome</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>chromosome</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></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_scaling_params.html">GaScalingParams</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> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
More details are given in specification of GaScalingOperation::operator () method. 
<p>
This method is thread-safe. 
<p>Implements <a class="el" href="class_population_1_1_ga_scaling_operation.html#308d39177c6c075f6a8d8a8d16ff52b5">Population::GaScalingOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="7bb4a3940b2908b41af1f12d3a8566e8"></a><!-- doxytag: member="Population::ScalingOperations::GaLinearScaling::IsRankingBased" ref="7bb4a3940b2908b41af1f12d3a8566e8" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::ScalingOperations::GaLinearScaling::IsRankingBased           </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 <a class="el" href="class_population_1_1_ga_scaling_operation.html#715be1b117b5856dae87b60df9b368ab" title="IsRankingBased method should return true if scaling of fitness value is based on...">GaScalingOperation::IsRankingBased</a> method. 
<p>
This method is thread-safe. <dl class="return" compact><dt><b>Returns:</b></dt><dd>This method returns <code>false</code>.</dd></dl>

<p>Implements <a class="el" href="class_population_1_1_ga_scaling_operation.html#715be1b117b5856dae87b60df9b368ab">Population::GaScalingOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="05583f9f487a4494e5896531171c5443"></a><!-- doxytag: member="Population::ScalingOperations::GaLinearScaling::NeedRescaling" ref="05583f9f487a4494e5896531171c5443" args="(const GaPopulation &amp;population, const GaScalingParams &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Population::ScalingOperations::GaLinearScaling::NeedRescaling           </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_scaling_params.html">GaScalingParams</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> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
More details are given in specification of <a class="el" href="class_population_1_1_ga_scaling_operation.html#592fce6744bf6586ea795001f33e6f86" title="NeedRescaling method checks current population for consistence of chromosomes&#39;...">GaScalingOperation::NeedRescaling</a> method. 
<p>
This method is thread-safe. <dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>true</code> if scale factor in operation parameters has changed.</dd></dl>

<p>Implements <a class="el" href="class_population_1_1_ga_scaling_operation.html#592fce6744bf6586ea795001f33e6f86">Population::GaScalingOperation</a>.</p>

</div>
</div><p>
<a class="anchor" name="e86fca8dcd6855971fc70729b50f9230"></a><!-- doxytag: member="Population::ScalingOperations::GaLinearScaling::MakeParameters" ref="e86fca8dcd6855971fc70729b50f9230" 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::ScalingOperations::GaLinearScaling::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_scaling_operations_1_1_ga_scale_factor_params.html" title="This class should be used (directly or by inheritance) by scaling operations which...">GaScaleFactorParams</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="386b20eecc8b26bb4340687fda48d0d5"></a><!-- doxytag: member="Population::ScalingOperations::GaLinearScaling::CheckParameters" ref="386b20eecc8b26bb4340687fda48d0d5" args="(const GaParameters &amp;parameters) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::ScalingOperations::GaLinearScaling::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>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="_scaling_operations_8h.html">ScalingOperations.h</a><li>source/<a class="el" href="_scaling_operations_8cpp.html">ScalingOperations.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