Click here to Skip to main content
15,886,026 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.7K   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::Representation::GaChromosomeValue&lt; TYPE &gt; Class Template 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_representation.html">Representation</a>::<a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">GaChromosomeValue</a>
  </div>
</div>
<div class="contents">
<h1>Chromosome::Representation::GaChromosomeValue&lt; TYPE &gt; Class Template Reference</h1><!-- doxytag: class="Chromosome::Representation::GaChromosomeValue" --><!-- doxytag: inherits="Chromosome::Representation::GaCodeValue" -->This class is used by <a class="el" href="class_chromosome_1_1_representation_1_1_ga_multi_value_chromosome.html" title="This class can be used for chromosomes which code has multiple values. Values can...">GaMultiValueChromosome</a> template class for extracting of single values from chromosome's code and other manipulation on chromosome's code.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/MultiValueChromosome.h&gt;</code>
<p>
Inherits <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html">Chromosome::Representation::GaCodeValue</a>.
<p>

<p>
<a href="class_chromosome_1_1_representation_1_1_ga_chromosome_value-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 void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#33dd2665b586f328ac9703105e768e12">Initialize</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Detailed description can be found in specification of <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#fe12973c77be984d3e80de60f75debcf" title="This method initializes value randomly.">GaCodeValue::Initialize</a>.  <a href="#33dd2665b586f328ac9703105e768e12"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#48dffb69d061203c755ef4a5be7c3312">FromBuffer</a> (const <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_values_buffer.html">GaCodeValuesBuffer</a> &amp;buffer, int pos)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Detailed description can be found in specification of <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#c26dd54120c7d02398205dce09009cb0" title="This method extract value at given position form buffer of chromosome&#39;s code...">GaCodeValue::FromBuffer</a>.  <a href="#48dffb69d061203c755ef4a5be7c3312"></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_representation_1_1_ga_chromosome_value.html#21ba2654e62a7077321d69437037dd5d">GaChromosomeValue</a> (TYPE value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor initializes value.  <a href="#21ba2654e62a7077321d69437037dd5d"></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_representation_1_1_ga_chromosome_value.html#4aae05eec1ec8a7d09d327630dd22be2">GaChromosomeValue</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor calls <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#33dd2665b586f328ac9703105e768e12" title="Detailed description can be found in specification of GaCodeValue::Initialize.">Initialize</a> method.  <a href="#4aae05eec1ec8a7d09d327630dd22be2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">TYPE GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#ea2bfa26ad91307d7d1baed763297941">GetValue</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is not thread-safe.  <a href="#ea2bfa26ad91307d7d1baed763297941"></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_representation_1_1_ga_chromosome_value.html#e6009c07fd152fbd97a48a5ab87ec79d">SetValue</a> (TYPE value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>SetValue</code> method sets stored value.  <a href="#e6009c07fd152fbd97a48a5ab87ec79d"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">TYPE&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#b294c44514feb9b2bfcc764d999bb7a4">_value</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Single value of chromosome's code.  <a href="#b294c44514feb9b2bfcc764d999bb7a4"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;typename TYPE&gt;<br>
 class Chromosome::Representation::GaChromosomeValue&lt; TYPE &gt;</h3>

This class is used by <a class="el" href="class_chromosome_1_1_representation_1_1_ga_multi_value_chromosome.html" title="This class can be used for chromosomes which code has multiple values. Values can...">GaMultiValueChromosome</a> template class for extracting of single values from chromosome's code and other manipulation on chromosome's code. 
<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. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TYPE</em>&nbsp;</td><td>type of value.</td></tr>
  </table>
</dl>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="21ba2654e62a7077321d69437037dd5d"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::GaChromosomeValue" ref="21ba2654e62a7077321d69437037dd5d" args="(TYPE value)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::<a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">GaChromosomeValue</a>           </td>
          <td>(</td>
          <td class="paramtype">TYPE&nbsp;</td>
          <td class="paramname"> <em>value</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor initializes 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>value</em>&nbsp;</td><td>user-defined value.</td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="4aae05eec1ec8a7d09d327630dd22be2"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::GaChromosomeValue" ref="4aae05eec1ec8a7d09d327630dd22be2" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::<a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">GaChromosomeValue</a>           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This constructor calls <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#33dd2665b586f328ac9703105e768e12" title="Detailed description can be found in specification of GaCodeValue::Initialize.">Initialize</a> method. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="33dd2665b586f328ac9703105e768e12"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::Initialize" ref="33dd2665b586f328ac9703105e768e12" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">virtual void GACALL <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::Initialize           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Detailed description can be found in specification of <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#fe12973c77be984d3e80de60f75debcf" title="This method initializes value randomly.">GaCodeValue::Initialize</a>. 
<p>

<p>Implements <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#fe12973c77be984d3e80de60f75debcf">Chromosome::Representation::GaCodeValue</a>.</p>

</div>
</div><p>
<a class="anchor" name="48dffb69d061203c755ef4a5be7c3312"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::FromBuffer" ref="48dffb69d061203c755ef4a5be7c3312" args="(const GaCodeValuesBuffer &amp;buffer, int pos)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">virtual void GACALL <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::FromBuffer           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_values_buffer.html">GaCodeValuesBuffer</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pos</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Detailed description can be found in specification of <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#c26dd54120c7d02398205dce09009cb0" title="This method extract value at given position form buffer of chromosome&#39;s code...">GaCodeValue::FromBuffer</a>. 
<p>

<p>Implements <a class="el" href="class_chromosome_1_1_representation_1_1_ga_code_value.html#c26dd54120c7d02398205dce09009cb0">Chromosome::Representation::GaCodeValue</a>.</p>

</div>
</div><p>
<a class="anchor" name="ea2bfa26ad91307d7d1baed763297941"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::GetValue" ref="ea2bfa26ad91307d7d1baed763297941" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">TYPE GACALL <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::GetValue           </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 stored value.</dd></dl>

</div>
</div><p>
<a class="anchor" name="e6009c07fd152fbd97a48a5ab87ec79d"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::SetValue" ref="e6009c07fd152fbd97a48a5ab87ec79d" args="(TYPE value)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void GACALL <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::SetValue           </td>
          <td>(</td>
          <td class="paramtype">TYPE&nbsp;</td>
          <td class="paramname"> <em>value</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>SetValue</code> method sets stored value. 
<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>value</em>&nbsp;</td><td>new value.</td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="b294c44514feb9b2bfcc764d999bb7a4"></a><!-- doxytag: member="Chromosome::Representation::GaChromosomeValue::_value" ref="b294c44514feb9b2bfcc764d999bb7a4" args="" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TYPE&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">TYPE <a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html">Chromosome::Representation::GaChromosomeValue</a>&lt; TYPE &gt;::<a class="el" href="class_chromosome_1_1_representation_1_1_ga_chromosome_value.html#b294c44514feb9b2bfcc764d999bb7a4">_value</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Single value of chromosome's code. 
<p>

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