Click here to Skip to main content
13,093,406 members (83,320 online)
Click here to Skip to main content

Stats

330.9K views
31.2K downloads
543 bookmarked
Posted 19 May 2008

Genetic Algorithm Library

, 7 Apr 2012
A framework for genetic algorithms
TSP.exe
GeneticLibrary.dll
TestApp1.exe
TestApp2.exe
GaSchedule.exe
GaSchedule.cfg
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
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
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: Chromosome::GaScaledChromosome 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="class_chromosome_1_1_ga_scaled_chromosome.html">GaScaledChromosome</a>
  </div>
</div>
<div class="contents">
<h1>Chromosome::GaScaledChromosome Class Reference</h1><!-- doxytag: class="Chromosome::GaScaledChromosome" -->This class wraps chromosome class and represents it in population. To reduce memory usage and improve performance same chromosome can be placed in multiple populations, but some chromosome's values has different values for separate populations. All values which are specific to the population are extracted from chromosome class to this class. Same object of <code><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html" title="This class wraps chromosome class and represents it in population. To reduce memory...">GaScaledChromosome</a></code> cannot be located in multiple populations.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/Chromosome.h&gt;</code>
<p>

<p>
<a href="class_chromosome_1_1_ga_scaled_chromosome-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_chromosome_1_1_ga_scaled_chromosome.html#0600507778589c2efef2381a0fbca30f">GaScaledChromosome</a> (<a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a> chromosome, <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *population, int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor fully initializes binding object (chromosome, population and index).  <a href="#0600507778589c2efef2381a0fbca30f"></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_chromosome_1_1_ga_scaled_chromosome.html#5d09e588fe063e869105f91d3e04e384">GaScaledChromosome</a> (<a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *population)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor only specifies binding population.  <a href="#5d09e588fe063e869105f91d3e04e384"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><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_ga_scaled_chromosome.html#de02b5398980995b47200320aa73ae7f">GetChromosome</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#de02b5398980995b47200320aa73ae7f"></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_chromosome_1_1_ga_scaled_chromosome.html#83a16ec482c0337bf185ae956b46b7c1">SetChromosome</a> (<a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a> chromosome)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetChromosome</code> sets pointer to bound chromosome.  <a href="#83a16ec482c0337bf185ae956b46b7c1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">float GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#fdbf034ca587083ba77d7350e4accbe9">GetScaledFitness</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#fdbf034ca587083ba77d7350e4accbe9"></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_chromosome_1_1_ga_scaled_chromosome.html#55b1c00d7efbf70bdbd612836c3fc2f9">SetScaledFitness</a> (float fitness)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetScaledFitness</code> method sets scaled (transformed) value of bound chromosome.  <a href="#55b1c00d7efbf70bdbd612836c3fc2f9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API float GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#5eceb3f023a4e7b87c43df5e25e6ee05">GetFitnessForComparison</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#5eceb3f023a4e7b87c43df5e25e6ee05"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#aadda2d41018585296c1e280f766a0fc">Rescale</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>Rescale</code> method recalculates scaled (transformed) fitness value of chromosome.  <a href="#aadda2d41018585296c1e280f766a0fc"></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_chromosome_1_1_ga_scaled_chromosome.html#48ae36ff074b8ca651ba10c28509cc5a">CompareFitnesses</a> (const <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html">GaScaledChromosome</a> &amp;c) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method compares fitness values of two chromosomes (<code>this</code> and <code>c</code>). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison.  <a href="#48ae36ff074b8ca651ba10c28509cc5a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API int GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#b4f7d531ea4a47a6475cfa8b2bfbc6af">CompareFitnesses</a> (float c) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method compares fitness values of two chromosomes (<code>this</code> and <code>c</code>). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison.  <a href="#b4f7d531ea4a47a6475cfa8b2bfbc6af"></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_chromosome_1_1_ga_scaled_chromosome.html#d6cb385c6fae717f59ab9f90a3b80ac9">ClearGroupFlags</a> (<a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> groups)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>ClearGroupFlag</code> method clears chromosome's membership flag for specified sorted group of population.  <a href="#d6cb385c6fae717f59ab9f90a3b80ac9"></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_chromosome_1_1_ga_scaled_chromosome.html#dc963a89f5798369280a2ee600c43740">SetGroupFlags</a> (<a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> groups)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetGroupFlag</code> method sets chromosome's membership flag for specified sorted group of population.  <a href="#dc963a89f5798369280a2ee600c43740"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#80e47490d6b7f337bf2d23ff5a110815">GetGroupFlag</a> (<a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> groups, bool all=false)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Method returns state of desired membership flag(s).  <a href="#80e47490d6b7f337bf2d23ff5a110815"></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_chromosome_1_1_ga_scaled_chromosome.html#236be21b37ec544ab91fd92929cc701c">SetGroups</a> (<a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> groups)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetGroups</code> sets all flags of sorted group membership.  <a href="#236be21b37ec544ab91fd92929cc701c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#ee48ce17e9e804ef77e025fcb51fb8e1">GetGroups</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#ee48ce17e9e804ef77e025fcb51fb8e1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#83f4f001a6c1196b6dc84ae488f19fe1">SetIndex</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetIndex</code> method sets index of bound chromosome in population.  <a href="#83f4f001a6c1196b6dc84ae488f19fe1"></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_chromosome_1_1_ga_scaled_chromosome.html#ce570710666121f59b8c3bc00303f489">GetIndex</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#ce570710666121f59b8c3bc00303f489"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &amp;GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#f35ef442c1ae19d87570ffbca613ec28">GetPopulation</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#f35ef442c1ae19d87570ffbca613ec28"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#74451759c8ebc5aef5880ba1213280a8">operator GaChromosomePtr</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This operator is not thread-safe.  <a href="#74451759c8ebc5aef5880ba1213280a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#60641cd446c61fd7c7c7b55bc09c26a6">operator float</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This operator is not thread-safe.  <a href="#60641cd446c61fd7c7c7b55bc09c26a6"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">float&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#250909fbf036955cc899ea5f6eab12e4">_scaledFitness</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Scaled (transformed) fitness value of the chromosome.  <a href="#250909fbf036955cc899ea5f6eab12e4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#476c48ea3a195f3375e4f8fc8848afb6">_population</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to population in which the chromosome is located.  <a href="#476c48ea3a195f3375e4f8fc8848afb6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#47b06c12e96f69040a617e868175382c">_chromosome</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Smart pointer to chromosome which is bound to population with this object.  <a href="#47b06c12e96f69040a617e868175382c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#6d4da6c0e27f686f91f84e917ce5e82f">_groups</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Flags od memberships in sorted groups of population.  <a href="#6d4da6c0e27f686f91f84e917ce5e82f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#7e896fd87357b60fe297c8d1cdeffe65">_index</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Index of chromosome in population.  <a href="#7e896fd87357b60fe297c8d1cdeffe65"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class wraps chromosome class and represents it in population. To reduce memory usage and improve performance same chromosome can be placed in multiple populations, but some chromosome's values has different values for separate populations. All values which are specific to the population are extracted from chromosome class to this class. Same object of <code><a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html" title="This class wraps chromosome class and represents it in population. To reduce memory...">GaScaledChromosome</a></code> cannot be located in multiple populations. 
<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="0600507778589c2efef2381a0fbca30f"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GaScaledChromosome" ref="0600507778589c2efef2381a0fbca30f" args="(GaChromosomePtr chromosome, GaPopulation *population, int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Chromosome::GaScaledChromosome::GaScaledChromosome           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a>&nbsp;</td>
          <td class="paramname"> <em>chromosome</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *&nbsp;</td>
          <td class="paramname"> <em>population</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor fully initializes binding object (chromosome, population and index). 
<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>smart pointer to bound chromosome.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>population</em>&nbsp;</td><td>pointer to population to which chromosome is bound.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>index</em>&nbsp;</td><td>index of chromosome in population.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="5d09e588fe063e869105f91d3e04e384"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GaScaledChromosome" ref="5d09e588fe063e869105f91d3e04e384" args="(GaPopulation *population)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Chromosome::GaScaledChromosome::GaScaledChromosome           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> *&nbsp;</td>
          <td class="paramname"> <em>population</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor only specifies binding population. 
<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>pointer to population to which chromosome is bound.</td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="de02b5398980995b47200320aa73ae7f"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetChromosome" ref="de02b5398980995b47200320aa73ae7f" args="() 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> GACALL Chromosome::GaScaledChromosome::GetChromosome           </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 smart pointer to bound chromosome. Or <code>NULL</code> pointer if object doesn't bind chromosome.</dd></dl>

</div>
</div><p>
<a class="anchor" name="83a16ec482c0337bf185ae956b46b7c1"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::SetChromosome" ref="83a16ec482c0337bf185ae956b46b7c1" args="(GaChromosomePtr chromosome)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::SetChromosome           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a>&nbsp;</td>
          <td class="paramname"> <em>chromosome</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetChromosome</code> sets pointer to bound chromosome. 
<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>chromosome</em>&nbsp;</td><td>smart pointer to bound chromosome.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="fdbf034ca587083ba77d7350e4accbe9"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetScaledFitness" ref="fdbf034ca587083ba77d7350e4accbe9" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float GACALL Chromosome::GaScaledChromosome::GetScaledFitness           </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 scaled (transformed) fitness value of bound chromosome.</dd></dl>

</div>
</div><p>
<a class="anchor" name="55b1c00d7efbf70bdbd612836c3fc2f9"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::SetScaledFitness" ref="55b1c00d7efbf70bdbd612836c3fc2f9" args="(float fitness)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::SetScaledFitness           </td>
          <td>(</td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>fitness</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetScaledFitness</code> method sets scaled (transformed) value of bound chromosome. 
<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>fitness</em>&nbsp;</td><td>new fitness value.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="5eceb3f023a4e7b87c43df5e25e6ee05"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetFitnessForComparison" ref="5eceb3f023a4e7b87c43df5e25e6ee05" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float Chromosome::GaScaledChromosome::GetFitnessForComparison           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</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 fitness value (scaled or original value) which is used for sorting and comparison of chromosomes in population.</dd></dl>

</div>
</div><p>
<a class="anchor" name="aadda2d41018585296c1e280f766a0fc"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::Rescale" ref="aadda2d41018585296c1e280f766a0fc" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::Rescale           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>Rescale</code> method recalculates scaled (transformed) fitness value of chromosome. 
<p>

</div>
</div><p>
<a class="anchor" name="48ae36ff074b8ca651ba10c28509cc5a"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::CompareFitnesses" ref="48ae36ff074b8ca651ba10c28509cc5a" args="(const GaScaledChromosome &amp;c) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GACALL Chromosome::GaScaledChromosome::CompareFitnesses           </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>c</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method compares fitness values of two chromosomes (<code>this</code> and <code>c</code>). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison. 
<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>c</em>&nbsp;</td><td>second chromosome for comparison with <code>this</code>.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a) -1 if fitness value of <code>this</code> is lower then value of <code>c</code>. <br>
b) 0 if fitness values of both chromosomes are equal. <br>
c) 1 if fitness value of <code>this</code> is greater then value of <code>c</code>. </dd></dl>

</div>
</div><p>
<a class="anchor" name="b4f7d531ea4a47a6475cfa8b2bfbc6af"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::CompareFitnesses" ref="b4f7d531ea4a47a6475cfa8b2bfbc6af" args="(float c) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Chromosome::GaScaledChromosome::CompareFitnesses           </td>
          <td>(</td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>c</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method compares fitness values of two chromosomes (<code>this</code> and <code>c</code>). Which fitness value (scaled or original) is going to be used depends on flag set in population to which chromosomes are bound. NOTE: Comparison doesn't have to be arithmetical comparison. 
<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>c</em>&nbsp;</td><td>second chromosome for comparison with <code>this</code>.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a) -1 if fitness value of <code>this</code> is lower then value of <code>c</code>. <br>
b) 0 if fitness values of both chromosomes are equal. <br>
c) 1 if fitness value of <code>this</code> is greater then value of <code>c</code>. </dd></dl>

</div>
</div><p>
<a class="anchor" name="d6cb385c6fae717f59ab9f90a3b80ac9"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::ClearGroupFlags" ref="d6cb385c6fae717f59ab9f90a3b80ac9" args="(GaSortedGroupType groups)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::ClearGroupFlags           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a>&nbsp;</td>
          <td class="paramname"> <em>groups</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>ClearGroupFlag</code> method clears chromosome's membership flag for specified sorted group of population. 
<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>groups</em>&nbsp;</td><td>flags of sorted groups that will be set.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="dc963a89f5798369280a2ee600c43740"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::SetGroupFlags" ref="dc963a89f5798369280a2ee600c43740" args="(GaSortedGroupType groups)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::SetGroupFlags           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a>&nbsp;</td>
          <td class="paramname"> <em>groups</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetGroupFlag</code> method sets chromosome's membership flag for specified sorted group of population. 
<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>groups</em>&nbsp;</td><td>flags of sorted groups that will be set.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="80e47490d6b7f337bf2d23ff5a110815"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetGroupFlag" ref="80e47490d6b7f337bf2d23ff5a110815" args="(GaSortedGroupType groups, bool all=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool GACALL Chromosome::GaScaledChromosome::GetGroupFlag           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a>&nbsp;</td>
          <td class="paramname"> <em>groups</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>all</em> = <code>false</code></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>
Method returns state of desired membership flag(s). 
<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>groups</em>&nbsp;</td><td>desired flags of sorted groups which state is queried. Flags are cmbined with operator |.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>all</em>&nbsp;</td><td>parameter tells method how the states of flag are combined into result. It this parameter is set to <code>true</code>, method returns <code>true</code> only if all flags is set, otherwise if this parameter is set to <code>false</code>, method returns <code>true</code> if any of flags is set.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>It returns <code>true</code> if any of desired flags is set and all parameter is set to <code>false</code>. If all parameter is set to <code>true</code>, method returns <code>true</code> only if all desired flags are set.</dd></dl>

</div>
</div><p>
<a class="anchor" name="236be21b37ec544ab91fd92929cc701c"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::SetGroups" ref="236be21b37ec544ab91fd92929cc701c" args="(GaSortedGroupType groups)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GACALL Chromosome::GaScaledChromosome::SetGroups           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a>&nbsp;</td>
          <td class="paramname"> <em>groups</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetGroups</code> sets all flags of sorted group membership. 
<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>groups</em>&nbsp;</td><td>new values of flags of sorted groups membership.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="ee48ce17e9e804ef77e025fcb51fb8e1"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetGroups" ref="ee48ce17e9e804ef77e025fcb51fb8e1" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> GACALL Chromosome::GaScaledChromosome::GetGroups           </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 all values of flags of sorted group membership.</dd></dl>

</div>
</div><p>
<a class="anchor" name="83f4f001a6c1196b6dc84ae488f19fe1"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::SetIndex" ref="83f4f001a6c1196b6dc84ae488f19fe1" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Chromosome::GaScaledChromosome::SetIndex           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetIndex</code> method sets index of bound chromosome in population. 
<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>index</em>&nbsp;</td><td>new index of bound chromosome.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="ce570710666121f59b8c3bc00303f489"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetIndex" ref="ce570710666121f59b8c3bc00303f489" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GACALL Chromosome::GaScaledChromosome::GetIndex           </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 index of bound chromosome in population.</dd></dl>

</div>
</div><p>
<a class="anchor" name="f35ef442c1ae19d87570ffbca613ec28"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::GetPopulation" ref="f35ef442c1ae19d87570ffbca613ec28" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a>&amp; GACALL Chromosome::GaScaledChromosome::GetPopulation           </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 reference to a population to which chromosome is bound.</dd></dl>

</div>
</div><p>
<a class="anchor" name="74451759c8ebc5aef5880ba1213280a8"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::operator GaChromosomePtr" ref="74451759c8ebc5aef5880ba1213280a8" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GACALL Chromosome::GaScaledChromosome::operator <a class="el" href="class_common_1_1_ga_smart_ptr.html">GaChromosomePtr</a>           </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 operator is not thread-safe. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Operator returns smart pointer to bound chromosome. Or <code>NULL</code> pointer if object isn't bound to chromosome.</dd></dl>

</div>
</div><p>
<a class="anchor" name="60641cd446c61fd7c7c7b55bc09c26a6"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::operator float" ref="60641cd446c61fd7c7c7b55bc09c26a6" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GACALL Chromosome::GaScaledChromosome::operator float           </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 operator is not thread-safe. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Operator returns index of bound chromosome in population.</dd></dl>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="250909fbf036955cc899ea5f6eab12e4"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::_scaledFitness" ref="250909fbf036955cc899ea5f6eab12e4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#250909fbf036955cc899ea5f6eab12e4">Chromosome::GaScaledChromosome::_scaledFitness</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Scaled (transformed) fitness value of the chromosome. 
<p>

</div>
</div><p>
<a class="anchor" name="476c48ea3a195f3375e4f8fc8848afb6"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::_population" ref="476c48ea3a195f3375e4f8fc8848afb6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a>* <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#476c48ea3a195f3375e4f8fc8848afb6">Chromosome::GaScaledChromosome::_population</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Pointer to population in which the chromosome is located. 
<p>

</div>
</div><p>
<a class="anchor" name="47b06c12e96f69040a617e868175382c"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::_chromosome" ref="47b06c12e96f69040a617e868175382c" args="" -->
<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> <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#47b06c12e96f69040a617e868175382c">Chromosome::GaScaledChromosome::_chromosome</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Smart pointer to chromosome which is bound to population with this object. 
<p>

</div>
</div><p>
<a class="anchor" name="6d4da6c0e27f686f91f84e917ce5e82f"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::_groups" ref="6d4da6c0e27f686f91f84e917ce5e82f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespace_population.html#218f7e319fff9f9172a5ab1f8c7202cf">GaSortedGroupType</a> <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#6d4da6c0e27f686f91f84e917ce5e82f">Chromosome::GaScaledChromosome::_groups</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Flags od memberships in sorted groups of population. 
<p>

</div>
</div><p>
<a class="anchor" name="7e896fd87357b60fe297c8d1cdeffe65"></a><!-- doxytag: member="Chromosome::GaScaledChromosome::_index" ref="7e896fd87357b60fe297c8d1cdeffe65" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_chromosome_1_1_ga_scaled_chromosome.html#7e896fd87357b60fe297c8d1cdeffe65">Chromosome::GaScaledChromosome::_index</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Index of chromosome in population. 
<p>

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

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 7 Apr 2012
Article Copyright 2008 by Mladen Janković
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid