Click here to Skip to main content
15,884,739 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::GaScalingOperation 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_scaling_operation.html">GaScalingOperation</a>
  </div>
</div>
<div class="contents">
<h1>Population::GaScalingOperation Class Reference</h1><!-- doxytag: class="Population::GaScalingOperation" --><!-- doxytag: inherits="Common::GaOperation" -->This class is interface for scaling operations which transform chromosomes' fitness values.  
<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_scaling_operations_1_1_ga_exponential_scaling.html">Population::ScalingOperations::GaExponentialScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html">Population::ScalingOperations::GaLinearScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_normalization_scaling.html">Population::ScalingOperations::GaNormalizationScaling</a>, and <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_window_scaling.html">Population::ScalingOperations::GaWindowScaling</a>.
<p>

<p>
<a href="class_population_1_1_ga_scaling_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 float GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_ga_scaling_operation.html#308d39177c6c075f6a8d8a8d16ff52b5">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 =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>operator ()</code> performs scaling operation and returns scaled fitness value.  <a href="#308d39177c6c075f6a8d8a8d16ff52b5"></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_ga_scaling_operation.html#715be1b117b5856dae87b60df9b368ab">IsRankingBased</a> () const =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>IsRankingBased</code> method should return <code>true</code> if scaling of fitness value is based on ranking of chromosome in population.  <a href="#715be1b117b5856dae87b60df9b368ab"></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_ga_scaling_operation.html#592fce6744bf6586ea795001f33e6f86">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 =0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">NeedRescaling method checks current population for consistence of chromosomes' scaled fitness values.  <a href="#592fce6744bf6586ea795001f33e6f86"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class is interface for scaling operations which transform chromosomes' fitness values. 
<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="308d39177c6c075f6a8d8a8d16ff52b5"></a><!-- doxytag: member="Population::GaScalingOperation::operator()" ref="308d39177c6c075f6a8d8a8d16ff52b5" args="(const GaScaledChromosome &amp;chromosome, const GaPopulation &amp;population, const GaScalingParams &amp;parameters) const =0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual float GACALL Population::GaScalingOperation::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> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>operator ()</code> performs scaling operation and returns scaled fitness value. 
<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>chromosome</em>&nbsp;</td><td>reference to chromosome which fitness is scaled.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>population</em>&nbsp;</td><td>reference to population which hosts specified chromosome.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parameters</em>&nbsp;</td><td>reference to parameters of scaling operation.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns scaled fitness.</dd></dl>

<p>Implemented in <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_window_scaling.html#c7dde7157eb9a51a17af7afa1d48767b">Population::ScalingOperations::GaWindowScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_exponential_scaling.html#5d5aa57d0953bd3002f58103fa0f26d2">Population::ScalingOperations::GaExponentialScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html#48d9d1f3e895974f4b8376f842bec673">Population::ScalingOperations::GaLinearScaling</a>, and <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_normalization_scaling.html#54e389aa0be95e7faed6f6aaecdf1b7f">Population::ScalingOperations::GaNormalizationScaling</a>.</p>

</div>
</div><p>
<a class="anchor" name="715be1b117b5856dae87b60df9b368ab"></a><!-- doxytag: member="Population::GaScalingOperation::IsRankingBased" ref="715be1b117b5856dae87b60df9b368ab" args="() const =0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::GaScalingOperation::IsRankingBased           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>IsRankingBased</code> method should return <code>true</code> if scaling of fitness value is based on ranking of chromosome in population. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>true</code> if scaling operation scales chromosome's fitness based on its ranking in population. If ranking is not used in scaling method should return <code>false</code>.</dd></dl>

<p>Implemented in <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_window_scaling.html#56caef03acb6281954ebdf41a7961949">Population::ScalingOperations::GaWindowScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_exponential_scaling.html#485b615ab59789452826226b25b89f93">Population::ScalingOperations::GaExponentialScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html#7bb4a3940b2908b41af1f12d3a8566e8">Population::ScalingOperations::GaLinearScaling</a>, and <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_normalization_scaling.html#288347378a1130b24a8da5e542f503d4">Population::ScalingOperations::GaNormalizationScaling</a>.</p>

</div>
</div><p>
<a class="anchor" name="592fce6744bf6586ea795001f33e6f86"></a><!-- doxytag: member="Population::GaScalingOperation::NeedRescaling" ref="592fce6744bf6586ea795001f33e6f86" args="(const GaPopulation &amp;population, const GaScalingParams &amp;parameters) const =0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool GACALL Population::GaScalingOperation::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> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
NeedRescaling method checks current population for consistence of chromosomes' scaled fitness 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>population</em>&nbsp;</td><td>reference to population which is checked.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parameters</em>&nbsp;</td><td>reference to parameters of scaling operation.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns <code>false</code> if all scaled fitness values of chromosomes are consistent. If rescaling of some or all chromosomes in population should be done, method returns <code>true</code>.</dd></dl>

<p>Implemented in <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_window_scaling.html#01ee8770d21807fc45291603b1ec3357">Population::ScalingOperations::GaWindowScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_exponential_scaling.html#d0489cb753fc769d6a2d9652bdc84b8d">Population::ScalingOperations::GaExponentialScaling</a>, <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_linear_scaling.html#05583f9f487a4494e5896531171c5443">Population::ScalingOperations::GaLinearScaling</a>, and <a class="el" href="class_population_1_1_scaling_operations_1_1_ga_normalization_scaling.html#63111e1922f96ccaeea0375740bc6e69">Population::ScalingOperations::GaNormalizationScaling</a>.</p>

</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