<!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::SelectionOperations::GaSelectRouletteWheel 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 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 List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespace_population.html">Population</a>::<a class="el" href="namespace_population_1_1_selection_operations.html">SelectionOperations</a>::<a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html">GaSelectRouletteWheel</a>
</div>
</div>
<div class="contents">
<h1>Population::SelectionOperations::GaSelectRouletteWheel Class Reference</h1><!-- doxytag: class="Population::SelectionOperations::GaSelectRouletteWheel" --><!-- doxytag: inherits="Population::GaSelectionOperation" -->When <code><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html" title="When GaSelectRouletteWheel selection is used chromosomes with better fitness values...">GaSelectRouletteWheel</a></code> selection is used chromosomes with better fitness values have better chances to be selected. It virtually transforms fitness value of chromosome to probability of selection. <a class="el" href="namespace_population.html" title="Contatins interfaces, classes and datatypes used to implement population of chromosomes...">Population</a> on which selection performed must be sorted. This selection can work with minimization or maximization of fitness values, as well as negative fitness values. This selection use <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_duplicates_params.html" title="This class should be used (directly or by inheritance) by selection operations which...">GaSelectDuplicatesParams</a> class for parameters.
<a href="#_details">More...</a>
<p>
<code>#include <source/SelectionOperations.h></code>
<p>
Inherits <a class="el" href="class_population_1_1_ga_selection_operation.html">Population::GaSelectionOperation</a>.
<p>
Inherited by <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html">Population::SelectionOperations::GaSelectTournament</a>.
<p>
<p>
<a href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel-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 </td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#04f2dd105556f35310ac2693a16b2a48">operator()</a> (const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &population, const <a class="el" href="class_population_1_1_ga_selection_params.html">GaSelectionParams</a> &parameters, <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> &result) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">More details are given in specification of GaSelectionOperation::operator () method. <a href="#04f2dd105556f35310ac2693a16b2a48"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> *GACALL </td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#580d55ac3fa47bb3e9e83b3ef785c7dc">MakeParameters</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">More details are given in specification of GaOperation::MakeParameters method. <a href="#580d55ac3fa47bb3e9e83b3ef785c7dc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool GACALL </td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#0b70bccaa7fa692b3df58d616b11cb04">CheckParameters</a> (const <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> &parameters) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Valid parameters must have selection size grater then 0. <a href="#0b70bccaa7fa692b3df58d616b11cb04"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual GAL_API int GACALL </td><td class="memItemRight" valign="bottom"><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html#31c6a7473e88c3f0722b10a4a3dce57d">Select</a> (const <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> &result, const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> &population, const <a class="el" href="class_population_1_1_ga_selection_params.html">GaSelectionParams</a> &parameters) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><code>Select</code> method selects only one chromosome using roulette wheel selection algorithm. <a href="#31c6a7473e88c3f0722b10a4a3dce57d"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
When <code><a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_roulette_wheel.html" title="When GaSelectRouletteWheel selection is used chromosomes with better fitness values...">GaSelectRouletteWheel</a></code> selection is used chromosomes with better fitness values have better chances to be selected. It virtually transforms fitness value of chromosome to probability of selection. <a class="el" href="namespace_population.html" title="Contatins interfaces, classes and datatypes used to implement population of chromosomes...">Population</a> on which selection performed must be sorted. This selection can work with minimization or maximization of fitness values, as well as negative fitness values. This selection use <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_duplicates_params.html" title="This class should be used (directly or by inheritance) by selection operations which...">GaSelectDuplicatesParams</a> class for parameters.
<p>
This class has no built-in synchronizator, so <code>LOCK_OBJECT</code> and <code>LOCK_THIS_OBJECT</code> macros cannot be used with instances of this class. Because this genetic operation is stateless all public method are thread-safe. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="04f2dd105556f35310ac2693a16b2a48"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRouletteWheel::operator()" ref="04f2dd105556f35310ac2693a16b2a48" args="(const GaPopulation &population, const GaSelectionParams &parameters, GaSelectionResultSet &result) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Population::SelectionOperations::GaSelectRouletteWheel::operator() </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_population_1_1_ga_population.html">GaPopulation</a> & </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_selection_params.html">GaSelectionParams</a> & </td>
<td class="paramname"> <em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> & </td>
<td class="paramname"> <em>result</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
More details are given in specification of GaSelectionOperation::operator () method.
<p>
This method is thread-safe.
<p>Implements <a class="el" href="class_population_1_1_ga_selection_operation.html#31741a85955ec1b0eee9b7bf00c428ee">Population::GaSelectionOperation</a>.</p>
<p>Reimplemented in <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#9b4ccc38a64b0df228ff507f1b700e28">Population::SelectionOperations::GaSelectTournament</a>.</p>
</div>
</div><p>
<a class="anchor" name="580d55ac3fa47bb3e9e83b3ef785c7dc"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRouletteWheel::MakeParameters" ref="580d55ac3fa47bb3e9e83b3ef785c7dc" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a>* GACALL Population::SelectionOperations::GaSelectRouletteWheel::MakeParameters </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> const<code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
More details are given in specification of GaOperation::MakeParameters method.
<p>
This method is thread-safe. <dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns new instance of <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_duplicates_params.html" title="This class should be used (directly or by inheritance) by selection operations which...">GaSelectDuplicatesParams</a> class.</dd></dl>
<p>Implements <a class="el" href="class_common_1_1_ga_operation.html#7da19e41bc86254ea540a55a09384023">Common::GaOperation</a>.</p>
<p>Reimplemented in <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#b03d97f5584e3ec5902d958d4cf83001">Population::SelectionOperations::GaSelectTournament</a>.</p>
</div>
</div><p>
<a class="anchor" name="0b70bccaa7fa692b3df58d616b11cb04"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRouletteWheel::CheckParameters" ref="0b70bccaa7fa692b3df58d616b11cb04" args="(const GaParameters &parameters) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool GACALL Population::SelectionOperations::GaSelectRouletteWheel::CheckParameters </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_common_1_1_ga_parameters.html">GaParameters</a> & </td>
<td class="paramname"> <em>parameters</em> </td>
<td> ) </td>
<td width="100%"> const<code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Valid parameters must have selection size grater then 0.
<p>
More details are given in specification of GaOperation::CheckParameters method.<p>
This method is thread-safe.
<p>Implements <a class="el" href="class_common_1_1_ga_operation.html#43b1b5c6a68418b09ec1ac04663d02b6">Common::GaOperation</a>.</p>
<p>Reimplemented in <a class="el" href="class_population_1_1_selection_operations_1_1_ga_select_tournament.html#2e3f380957b3a5efe3b79021a684e245">Population::SelectionOperations::GaSelectTournament</a>.</p>
</div>
</div><p>
<a class="anchor" name="31c6a7473e88c3f0722b10a4a3dce57d"></a><!-- doxytag: member="Population::SelectionOperations::GaSelectRouletteWheel::Select" ref="31c6a7473e88c3f0722b10a4a3dce57d" args="(const GaSelectionResultSet &result, const GaPopulation &population, const GaSelectionParams &parameters) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Population::SelectionOperations::GaSelectRouletteWheel::Select </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_population_1_1_ga_selection_result_set.html">GaSelectionResultSet</a> & </td>
<td class="paramname"> <em>result</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> & </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_selection_params.html">GaSelectionParams</a> & </td>
<td class="paramname"> <em>parameters</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"> const<code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<code>Select</code> method selects only one chromosome using roulette wheel selection algorithm.
<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>result</em> </td><td>reference to selection result set which is used to store selected chromosome.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>population</em> </td><td>reference to population on which selection is performed.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>parameters</em> </td><td>reference to parameters of population.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Method returns index of selected chromosome.</dd></dl>
</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>source/<a class="el" href="_selection_operations_8h.html">SelectionOperations.h</a><li>source/<a class="el" href="_selection_operations_8cpp.html">SelectionOperations.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>