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

Genetic Algorithm Library

, 7 Apr 2012
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: Observing::GaObserversList 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_observing.html">Observing</a>::<a class="el" href="class_observing_1_1_ga_observers_list.html">GaObserversList</a>
  </div>
</div>
<div class="contents">
<h1>Observing::GaObserversList Class Reference</h1><!-- doxytag: class="Observing::GaObserversList" --><!-- doxytag: inherits="Observing::GaObserver" -->This class manages subscriptions of observers to algorithm's events.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;source/Observing.h&gt;</code>
<p>
Inherits <a class="el" href="class_observing_1_1_ga_observer.html">Observing::GaObserver</a>.
<p>

<p>
<a href="class_observing_1_1_ga_observers_list-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_observing_1_1_ga_observers_list.html#250718a0c069a99a8f67798f64f9e7bd">StatisticUpdate</a> (const <a class="el" href="class_common_1_1_ga_statistics.html">GaStatistics</a> &amp;statistics, const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;algorithm)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method notifies all subscribed observer that algorithm has reached end of the current generation.  <a href="#250718a0c069a99a8f67798f64f9e7bd"></a><br></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_observing_1_1_ga_observers_list.html#996a0f90d7140d667b90af4ae8778c3d">NewBestChromosome</a> (const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> &amp;newChromosome, const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;algorithm)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method notifies all subscribed observer that algorithm found new chromosome which is better then the best chromosome form previous population.  <a href="#996a0f90d7140d667b90af4ae8778c3d"></a><br></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_observing_1_1_ga_observers_list.html#6f696f7d126b7603930196605dc17ef3">EvolutionStateChanged</a> (<a class="el" href="namespace_algorithm.html#a58c687815e8ac4491235b5a9a40dcfb">GaAlgorithmState</a> newState, const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;algorithm)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method notifies all subscribed observer that state of algorithm's execution has changed.  <a href="#6f696f7d126b7603930196605dc17ef3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API <a class="el" href="class_observing_1_1_ga_observers_list.html">GaObserversList</a> &amp;GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_observing_1_1_ga_observers_list.html#4333194828ee948981c1e0355d24b862">operator+=</a> (<a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a> &amp;observer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>operator +=</code> subscribes new observer. If observer is already subscribed call has no affect.  <a href="#4333194828ee948981c1e0355d24b862"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">GAL_API <a class="el" href="class_observing_1_1_ga_observers_list.html">GaObserversList</a> &amp;GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_observing_1_1_ga_observers_list.html#a8778d2defdc1b3908b3a1695b88bb25">operator-=</a> (<a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a> &amp;observer)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><code>operator -=</code> unsubscribes the observer. If observer is not subscribed call has no affect.  <a href="#a8778d2defdc1b3908b3a1695b88bb25"></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_observing_1_1_ga_observers_list.html#a776197e95531e7350bf7802d02440f7">GetObserverCount</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is thread-safe.  <a href="#a776197e95531e7350bf7802d02440f7"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef list&lt; <a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_observing_1_1_ga_observers_list.html#5826b0bfc60f676ea052086888859fdc">GaObserversListType</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Alias for STL list class which contains pointers to <a class="el" href="class_observing_1_1_ga_observer.html" title="GaObserver interface is base class for all algorithms&#39; observers. This interface...">GaObserver</a> objects.  <a href="#5826b0bfc60f676ea052086888859fdc"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_observing_1_1_ga_observers_list.html#5826b0bfc60f676ea052086888859fdc">GaObserversListType</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_observing_1_1_ga_observers_list.html#68753a81dc92bc7954035bba6e9ec2c2">_observers</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">List of subscribed observers.  <a href="#68753a81dc92bc7954035bba6e9ec2c2"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class manages subscriptions of observers to algorithm's events. 
<p>
This class has built-in synchronizator, so it is allowed to use <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code> macros with instances of this class. All public methods are thread-safe. <hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="5826b0bfc60f676ea052086888859fdc"></a><!-- doxytag: member="Observing::GaObserversList::GaObserversListType" ref="5826b0bfc60f676ea052086888859fdc" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef list&lt;<a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a>*&gt; <a class="el" href="class_observing_1_1_ga_observers_list.html#5826b0bfc60f676ea052086888859fdc">Observing::GaObserversList::GaObserversListType</a><code> [protected]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Alias for STL list class which contains pointers to <a class="el" href="class_observing_1_1_ga_observer.html" title="GaObserver interface is base class for all algorithms&#39; observers. This interface...">GaObserver</a> objects. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="250718a0c069a99a8f67798f64f9e7bd"></a><!-- doxytag: member="Observing::GaObserversList::StatisticUpdate" ref="250718a0c069a99a8f67798f64f9e7bd" args="(const GaStatistics &amp;statistics, const GaAlgorithm &amp;algorithm)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Observing::GaObserversList::StatisticUpdate           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_common_1_1_ga_statistics.html">GaStatistics</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>statistics</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>algorithm</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method notifies all subscribed observer that algorithm has reached end of the current generation. 
<p>
This method is 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>statistics</em>&nbsp;</td><td>reference to object with statistical information.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>algorithm</em>&nbsp;</td><td>reference the algorithm which raised event.</td></tr>
  </table>
</dl>

<p>Implements <a class="el" href="class_observing_1_1_ga_observer.html#a5c50a114aa0fdeedb58ba0cf70abdcc">Observing::GaObserver</a>.</p>

</div>
</div><p>
<a class="anchor" name="996a0f90d7140d667b90af4ae8778c3d"></a><!-- doxytag: member="Observing::GaObserversList::NewBestChromosome" ref="996a0f90d7140d667b90af4ae8778c3d" args="(const GaChromosome &amp;newChromosome, const GaAlgorithm &amp;algorithm)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Observing::GaObserversList::NewBestChromosome           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_chromosome_1_1_ga_chromosome.html">GaChromosome</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>newChromosome</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>algorithm</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method notifies all subscribed observer that algorithm found new chromosome which is better then the best chromosome form previous population. 
<p>
This method is 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>newChromosome</em>&nbsp;</td><td>reference to the chromosome.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>algorithm</em>&nbsp;</td><td>reference the algorithm which raised event.</td></tr>
  </table>
</dl>

<p>Implements <a class="el" href="class_observing_1_1_ga_observer.html#e875da8a8dfdce8fee930383dc13b045">Observing::GaObserver</a>.</p>

</div>
</div><p>
<a class="anchor" name="6f696f7d126b7603930196605dc17ef3"></a><!-- doxytag: member="Observing::GaObserversList::EvolutionStateChanged" ref="6f696f7d126b7603930196605dc17ef3" args="(GaAlgorithmState newState, const GaAlgorithm &amp;algorithm)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Observing::GaObserversList::EvolutionStateChanged           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_algorithm.html#a58c687815e8ac4491235b5a9a40dcfb">GaAlgorithmState</a>&nbsp;</td>
          <td class="paramname"> <em>newState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="class_algorithm_1_1_ga_algorithm.html">GaAlgorithm</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>algorithm</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This method notifies all subscribed observer that state of algorithm's execution has changed. 
<p>
This method is 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>newState</em>&nbsp;</td><td>new state of algorithm's execution</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>algorithm</em>&nbsp;</td><td>reference the algorithm which raised event.</td></tr>
  </table>
</dl>

<p>Implements <a class="el" href="class_observing_1_1_ga_observer.html#0928c438abe107cc450c32e81bb09fb7">Observing::GaObserver</a>.</p>

</div>
</div><p>
<a class="anchor" name="4333194828ee948981c1e0355d24b862"></a><!-- doxytag: member="Observing::GaObserversList::operator+=" ref="4333194828ee948981c1e0355d24b862" args="(GaObserver &amp;observer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_observing_1_1_ga_observers_list.html">GaObserversList</a> &amp; Observing::GaObserversList::operator+=           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>observer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>operator +=</code> subscribes new observer. If observer is already subscribed call has no affect. 
<p>
This operator is 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>observer</em>&nbsp;</td><td>observer which will be subscribed.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns reference to <code>this</code> object.</dd></dl>

</div>
</div><p>
<a class="anchor" name="a8778d2defdc1b3908b3a1695b88bb25"></a><!-- doxytag: member="Observing::GaObserversList::operator-=" ref="a8778d2defdc1b3908b3a1695b88bb25" args="(GaObserver &amp;observer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_observing_1_1_ga_observers_list.html">GaObserversList</a> &amp; Observing::GaObserversList::operator-=           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_observing_1_1_ga_observer.html">GaObserver</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>observer</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>operator -=</code> unsubscribes the observer. If observer is not subscribed call has no affect. 
<p>
This operator is 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>observer</em>&nbsp;</td><td>observer which will be unsubscribed.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns reference to <code>this</code> object.</dd></dl>

</div>
</div><p>
<a class="anchor" name="a776197e95531e7350bf7802d02440f7"></a><!-- doxytag: member="Observing::GaObserversList::GetObserverCount" ref="a776197e95531e7350bf7802d02440f7" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Observing::GaObserversList::GetObserverCount           </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 thread-safe. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns number of subscribed observers.</dd></dl>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="68753a81dc92bc7954035bba6e9ec2c2"></a><!-- doxytag: member="Observing::GaObserversList::_observers" ref="68753a81dc92bc7954035bba6e9ec2c2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_observing_1_1_ga_observers_list.html#5826b0bfc60f676ea052086888859fdc">GaObserversListType</a> <a class="el" href="class_observing_1_1_ga_observers_list.html#68753a81dc92bc7954035bba6e9ec2c2">Observing::GaObserversList::_observers</a><code> [protected]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
List of subscribed observers. 
<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>source/<a class="el" href="_observing_8h.html">Observing.h</a><li>source/<a class="el" href="_observing_8cpp.html">Observing.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
Web01 | 2.8.140916.1 | Last Updated 7 Apr 2012
Article Copyright 2008 by Mladen Janković
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid