/usr/share/doc/libevocosm-dev/html/a00160.html is in libevocosm-dev 4.0.2-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Evocosm</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<h1 align="center" color="#606080">
Evocosm - A C++ Framework for Evolutionary Computing
</h1>
<h2 align="center"><a href="index.html">Main Index</a></h2>
<p align="center">
Created by <a href="mailto:scott.ladd@@coyotegulch.com?subject=libevocosm">Scott Robert Ladd</a> at
<a href="http://www.coyotegulch.com">Coyote Gulch Productions</a>.
</p>
<hr>
<!-- Generated by Doxygen 1.8.12 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="a00059.html">libevocosm</a></li><li class="navelem"><a class="el" href="a00160.html">roulette_wheel</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-attribs">Protected Attributes</a> |
<a href="a00157.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">libevocosm::roulette_wheel Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A simulated roulette wheel for weighted selection.
<a href="a00160.html#details">More...</a></p>
<p><code>#include <<a class="el" href="a00038_source.html">roulette.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for libevocosm::roulette_wheel:</div>
<div class="dyncontent">
<div class="center">
<img src="a00160.png" usemap="#libevocosm::roulette_5Fwheel_map" alt=""/>
<map id="libevocosm::roulette_5Fwheel_map" name="libevocosm::roulette_wheel_map">
<area href="a00072.html" title="Elements shared by all classes in Evocosm. " alt="libevocosm::globals" shape="rect" coords="0,0,163,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af50eec061ea7110c660fc81cbcd726a3"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#af50eec061ea7110c660fc81cbcd726a3">roulette_wheel</a> (const vector< double > &a_weights, double a_min_weight=std::numeric_limits< double >::epsilon(), double a_max_weight=std::numeric_limits< double >::max())</td></tr>
<tr class="memdesc:af50eec061ea7110c660fc81cbcd726a3"><td class="mdescLeft"> </td><td class="mdescRight">Creation constructor (from vector) <a href="#af50eec061ea7110c660fc81cbcd726a3">More...</a><br /></td></tr>
<tr class="separator:af50eec061ea7110c660fc81cbcd726a3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9c83d47d86bca0ac373ec767bb891b07"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a9c83d47d86bca0ac373ec767bb891b07">roulette_wheel</a> (const double *a_weights, size_t a_length, double a_min_weight=std::numeric_limits< double >::epsilon(), double a_max_weight=std::numeric_limits< double >::max())</td></tr>
<tr class="memdesc:a9c83d47d86bca0ac373ec767bb891b07"><td class="mdescLeft"> </td><td class="mdescRight">Creation constructor (from c-type array) <a href="#a9c83d47d86bca0ac373ec767bb891b07">More...</a><br /></td></tr>
<tr class="separator:a9c83d47d86bca0ac373ec767bb891b07"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a77f39d6f3f8a371401e4539ae12c0894"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a77f39d6f3f8a371401e4539ae12c0894">roulette_wheel</a> (const <a class="el" href="a00160.html">roulette_wheel</a> &a_source)</td></tr>
<tr class="memdesc:a77f39d6f3f8a371401e4539ae12c0894"><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <a href="#a77f39d6f3f8a371401e4539ae12c0894">More...</a><br /></td></tr>
<tr class="separator:a77f39d6f3f8a371401e4539ae12c0894"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0d255d7fd46c3d304172ac21b7c74035"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00160.html">roulette_wheel</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a0d255d7fd46c3d304172ac21b7c74035">operator=</a> (const <a class="el" href="a00160.html">roulette_wheel</a> &a_source)</td></tr>
<tr class="memdesc:a0d255d7fd46c3d304172ac21b7c74035"><td class="mdescLeft"> </td><td class="mdescRight">Assignment operator. <a href="#a0d255d7fd46c3d304172ac21b7c74035">More...</a><br /></td></tr>
<tr class="separator:a0d255d7fd46c3d304172ac21b7c74035"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8cd1cd30638e892178c692cb749c4cd2"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a8cd1cd30638e892178c692cb749c4cd2">~roulette_wheel</a> ()</td></tr>
<tr class="memdesc:a8cd1cd30638e892178c692cb749c4cd2"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a8cd1cd30638e892178c692cb749c4cd2">More...</a><br /></td></tr>
<tr class="separator:a8cd1cd30638e892178c692cb749c4cd2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5aea51f1e72bbaab31a73c0622905b12"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a5aea51f1e72bbaab31a73c0622905b12">get_size</a> () const</td></tr>
<tr class="memdesc:a5aea51f1e72bbaab31a73c0622905b12"><td class="mdescLeft"> </td><td class="mdescRight">Get size (number of weights) <a href="#a5aea51f1e72bbaab31a73c0622905b12">More...</a><br /></td></tr>
<tr class="separator:a5aea51f1e72bbaab31a73c0622905b12"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adda47eec4f1aa47f1ce81fe29f58c989"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#adda47eec4f1aa47f1ce81fe29f58c989">set_weight</a> (size_t a_index, double a_weight)</td></tr>
<tr class="memdesc:adda47eec4f1aa47f1ce81fe29f58c989"><td class="mdescLeft"> </td><td class="mdescRight">Change the weight assigned to an entry. <a href="#adda47eec4f1aa47f1ce81fe29f58c989">More...</a><br /></td></tr>
<tr class="separator:adda47eec4f1aa47f1ce81fe29f58c989"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a57bd286590e997e94e6b3db6b6930f73"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a57bd286590e997e94e6b3db6b6930f73">get_weight</a> (size_t a_index) const</td></tr>
<tr class="memdesc:a57bd286590e997e94e6b3db6b6930f73"><td class="mdescLeft"> </td><td class="mdescRight">Get the weight for an index. <a href="#a57bd286590e997e94e6b3db6b6930f73">More...</a><br /></td></tr>
<tr class="separator:a57bd286590e997e94e6b3db6b6930f73"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab4ff6901bd43d09223804a10359ff7d3"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#ab4ff6901bd43d09223804a10359ff7d3">get_index</a> () const</td></tr>
<tr class="memdesc:ab4ff6901bd43d09223804a10359ff7d3"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve a random index. <a href="#ab4ff6901bd43d09223804a10359ff7d3">More...</a><br /></td></tr>
<tr class="separator:ab4ff6901bd43d09223804a10359ff7d3"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a468463d0c1d23e8110467bb5b43d1d13"><td class="memItemLeft" align="right" valign="top"><a id="a468463d0c1d23e8110467bb5b43d1d13"></a>
size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a468463d0c1d23e8110467bb5b43d1d13">m_size</a></td></tr>
<tr class="memdesc:a468463d0c1d23e8110467bb5b43d1d13"><td class="mdescLeft"> </td><td class="mdescRight">Number of weights in this wheel. <br /></td></tr>
<tr class="separator:a468463d0c1d23e8110467bb5b43d1d13"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7cb59a1fda86e11eaaaad7302aa21c03"><td class="memItemLeft" align="right" valign="top"><a id="a7cb59a1fda86e11eaaaad7302aa21c03"></a>
double * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a7cb59a1fda86e11eaaaad7302aa21c03">m_weights</a></td></tr>
<tr class="memdesc:a7cb59a1fda86e11eaaaad7302aa21c03"><td class="mdescLeft"> </td><td class="mdescRight">Array of m_weights. <br /></td></tr>
<tr class="separator:a7cb59a1fda86e11eaaaad7302aa21c03"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6fb7cec1646eaf2d487a467917eac6ba"><td class="memItemLeft" align="right" valign="top"><a id="a6fb7cec1646eaf2d487a467917eac6ba"></a>
double </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a6fb7cec1646eaf2d487a467917eac6ba">m_total_weight</a></td></tr>
<tr class="memdesc:a6fb7cec1646eaf2d487a467917eac6ba"><td class="mdescLeft"> </td><td class="mdescRight">Total weight of all indexes. <br /></td></tr>
<tr class="separator:a6fb7cec1646eaf2d487a467917eac6ba"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a561c771355a2c5a57ff6dc4bcc4e5a80"><td class="memItemLeft" align="right" valign="top"><a id="a561c771355a2c5a57ff6dc4bcc4e5a80"></a>
double </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a561c771355a2c5a57ff6dc4bcc4e5a80">m_min_weight</a></td></tr>
<tr class="memdesc:a561c771355a2c5a57ff6dc4bcc4e5a80"><td class="mdescLeft"> </td><td class="mdescRight">Minimum possible weight value. <br /></td></tr>
<tr class="separator:a561c771355a2c5a57ff6dc4bcc4e5a80"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a516fce90b8c00cc2825439a47509519d"><td class="memItemLeft" align="right" valign="top"><a id="a516fce90b8c00cc2825439a47509519d"></a>
double </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#a516fce90b8c00cc2825439a47509519d">m_max_weight</a></td></tr>
<tr class="memdesc:a516fce90b8c00cc2825439a47509519d"><td class="mdescLeft"> </td><td class="mdescRight">Maximum possible weight value. <br /></td></tr>
<tr class="separator:a516fce90b8c00cc2825439a47509519d"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_static_methods_a00072"><td colspan="2" onclick="javascript:toggleInherit('pro_static_methods_a00072')"><img src="closed.png" alt="-"/> Static Protected Member Functions inherited from <a class="el" href="a00072.html">libevocosm::globals</a></td></tr>
<tr class="memitem:a5e8897de95e0cccd71f0493586b48424 inherit pro_static_methods_a00072"><td class="memItemLeft" align="right" valign="top"><a id="a5e8897de95e0cccd71f0493586b48424"></a>
static size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#a5e8897de95e0cccd71f0493586b48424">rand_index</a> (size_t n)</td></tr>
<tr class="memdesc:a5e8897de95e0cccd71f0493586b48424 inherit pro_static_methods_a00072"><td class="mdescLeft"> </td><td class="mdescRight">Static function to allow use of g_random function pointer in random_shuffle. <br /></td></tr>
<tr class="separator:a5e8897de95e0cccd71f0493586b48424 inherit pro_static_methods_a00072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae0fb3d77391329662f21d0f84e222602 inherit pro_static_methods_a00072"><td class="memItemLeft" align="right" valign="top"><a id="ae0fb3d77391329662f21d0f84e222602"></a>
static void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#ae0fb3d77391329662f21d0f84e222602">set_seed</a> (uint32_t a_seed)</td></tr>
<tr class="memdesc:ae0fb3d77391329662f21d0f84e222602 inherit pro_static_methods_a00072"><td class="mdescLeft"> </td><td class="mdescRight">Set the seed for the random number generator. <br /></td></tr>
<tr class="separator:ae0fb3d77391329662f21d0f84e222602 inherit pro_static_methods_a00072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a76f6dc798b18bd272e1ff3c1f8d9c4fd inherit pro_static_methods_a00072"><td class="memItemLeft" align="right" valign="top"><a id="a76f6dc798b18bd272e1ff3c1f8d9c4fd"></a>
static uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#a76f6dc798b18bd272e1ff3c1f8d9c4fd">get_seed</a> ()</td></tr>
<tr class="memdesc:a76f6dc798b18bd272e1ff3c1f8d9c4fd inherit pro_static_methods_a00072"><td class="mdescLeft"> </td><td class="mdescRight">Set the seed for the random number generator. <br /></td></tr>
<tr class="separator:a76f6dc798b18bd272e1ff3c1f8d9c4fd inherit pro_static_methods_a00072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acb9a2cde1cdf3f6c0dde4c4e11b74533 inherit pro_static_methods_a00072"><td class="memItemLeft" align="right" valign="top"><a id="acb9a2cde1cdf3f6c0dde4c4e11b74533"></a>
static std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#acb9a2cde1cdf3f6c0dde4c4e11b74533">version</a> ()</td></tr>
<tr class="memdesc:acb9a2cde1cdf3f6c0dde4c4e11b74533 inherit pro_static_methods_a00072"><td class="mdescLeft"> </td><td class="mdescRight">Get version number. <br /></td></tr>
<tr class="separator:acb9a2cde1cdf3f6c0dde4c4e11b74533 inherit pro_static_methods_a00072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_static_attribs_a00072"><td colspan="2" onclick="javascript:toggleInherit('pro_static_attribs_a00072')"><img src="closed.png" alt="-"/> Static Protected Attributes inherited from <a class="el" href="a00072.html">libevocosm::globals</a></td></tr>
<tr class="memitem:a2dd06cbfa61fdca09d03ec26837f7a7d inherit pro_static_attribs_a00072"><td class="memItemLeft" align="right" valign="top"><a id="a2dd06cbfa61fdca09d03ec26837f7a7d"></a>
static <a class="el" href="a00068.html">prng</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#a2dd06cbfa61fdca09d03ec26837f7a7d">g_random</a></td></tr>
<tr class="memdesc:a2dd06cbfa61fdca09d03ec26837f7a7d inherit pro_static_attribs_a00072"><td class="mdescLeft"> </td><td class="mdescRight">A shared random number generator. <br /></td></tr>
<tr class="separator:a2dd06cbfa61fdca09d03ec26837f7a7d inherit pro_static_attribs_a00072"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abeab049f579c3c70337bb4a3b67eecff inherit pro_static_attribs_a00072"><td class="memItemLeft" align="right" valign="top"><a id="abeab049f579c3c70337bb4a3b67eecff"></a>
static std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="a00072.html#abeab049f579c3c70337bb4a3b67eecff">g_version</a></td></tr>
<tr class="memdesc:abeab049f579c3c70337bb4a3b67eecff inherit pro_static_attribs_a00072"><td class="mdescLeft"> </td><td class="mdescRight">Version number. <br /></td></tr>
<tr class="separator:abeab049f579c3c70337bb4a3b67eecff inherit pro_static_attribs_a00072"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>You've probably seen a standard gambler's roulette wheel, a spinning circle divided into thirty-seven or thirty-eight equal-sized, pie-shaped sections. The croupier sets the wheel spinning and at the same time tosses an marble into the bowl in the direction opposite to that in which the wheel is moving; when the motion of the wheel ceases, the ball comes to rest in one of the numbered sections.</p>
<p>As an algorithm, a roulette wheel is an array of weights, and the marble is a random integer less than the sum of all weights in the population. To pick on of the "section" (in this case, an index), the algorithm simulates the bouncing metal ball by iterating through the array of weights; if the marble value is less than the current weight (i.e., the ball has stopped), the algorithm returns the index of that weight. Otherwise, the algorithm subtracts the current weight from the marble value, and repeats the process with the next element in the weight array. Thus the largest weights values tend to be the most likely resting places for the marble, since they use a larger area of the abstract wheel. </p>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="af50eec061ea7110c660fc81cbcd726a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af50eec061ea7110c660fc81cbcd726a3">§ </a></span>roulette_wheel() <span class="overload">[1/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libevocosm::roulette_wheel::roulette_wheel </td>
<td>(</td>
<td class="paramtype">const vector< double > & </td>
<td class="paramname"><em>a_weights</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>a_min_weight</em> = <code>std::numeric_limits< double >::epsilon()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>a_max_weight</em> = <code>std::numeric_limits< double >::max()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="a00160.html" title="A simulated roulette wheel for weighted selection. ">roulette_wheel</a> based on a set of weights. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_weights</td><td>- A vector of weights defining the wheel </td></tr>
<tr><td class="paramname">a_min_weight</td><td>- Minimum possible weight value (defaults to epsilon for type) </td></tr>
<tr><td class="paramname">a_max_weight</td><td>- Maximum possible weight value (defaults to max for type) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a9c83d47d86bca0ac373ec767bb891b07"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c83d47d86bca0ac373ec767bb891b07">§ </a></span>roulette_wheel() <span class="overload">[2/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libevocosm::roulette_wheel::roulette_wheel </td>
<td>(</td>
<td class="paramtype">const double * </td>
<td class="paramname"><em>a_weights</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>a_length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>a_min_weight</em> = <code>std::numeric_limits< double >::epsilon()</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>a_max_weight</em> = <code>std::numeric_limits< double >::max()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="a00160.html" title="A simulated roulette wheel for weighted selection. ">roulette_wheel</a> based on a set of weights. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_weights</td><td>- An array of weights defining the wheel </td></tr>
<tr><td class="paramname">a_length</td><td>- Number of elements in <em>a_weights</em> </td></tr>
<tr><td class="paramname">a_min_weight</td><td>- Minimum possible weight value (defaults to 1.0) </td></tr>
<tr><td class="paramname">a_max_weight</td><td>- Maximum possible weight value (defaults to 100.0) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a77f39d6f3f8a371401e4539ae12c0894"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a77f39d6f3f8a371401e4539ae12c0894">§ </a></span>roulette_wheel() <span class="overload">[3/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libevocosm::roulette_wheel::roulette_wheel </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00160.html">roulette_wheel</a> & </td>
<td class="paramname"><em>a_source</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="a00160.html" title="A simulated roulette wheel for weighted selection. ">roulette_wheel</a> from an existing one. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_source</td><td>- The source object </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a8cd1cd30638e892178c692cb749c4cd2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8cd1cd30638e892178c692cb749c4cd2">§ </a></span>~roulette_wheel()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">libevocosm::roulette_wheel::~roulette_wheel </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destroys a <a class="el" href="a00160.html" title="A simulated roulette wheel for weighted selection. ">roulette_wheel</a>, freeing resources. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab4ff6901bd43d09223804a10359ff7d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab4ff6901bd43d09223804a10359ff7d3">§ </a></span>get_index()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t libevocosm::roulette_wheel::get_index </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a randomly-selected index value by simulating the bouncing of a ball on a roulette wheel, where each index is a "slot" with a width determined by its assigned weight. </p><dl class="section return"><dt>Returns</dt><dd>A random index value </dd></dl>
<p>Referenced by <a class="el" href="a00144.html#ade71e2bc971f5d6551066450aca22a2c">libevocosm::machine_tools::mutation_selector::get_index()</a>, <a class="el" href="a00160.html#a5aea51f1e72bbaab31a73c0622905b12">get_size()</a>, and <a class="el" href="a00116.html#a2aa06f40b1fd522e1ae07d4c647d6b13">libevocosm::fuzzy_machine< InSize, OutSize >::transition()</a>.</p>
</div>
</div>
<a id="a5aea51f1e72bbaab31a73c0622905b12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5aea51f1e72bbaab31a73c0622905b12">§ </a></span>get_size()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t libevocosm::roulette_wheel::get_size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the number of weights indexed by the roulette wheel. </p><dl class="section return"><dt>Returns</dt><dd>The number of weights </dd></dl>
<p>References <a class="el" href="a00160.html#ab4ff6901bd43d09223804a10359ff7d3">get_index()</a>, <a class="el" href="a00160.html#a57bd286590e997e94e6b3db6b6930f73">get_weight()</a>, <a class="el" href="a00160.html#a468463d0c1d23e8110467bb5b43d1d13">m_size</a>, and <a class="el" href="a00160.html#adda47eec4f1aa47f1ce81fe29f58c989">set_weight()</a>.</p>
</div>
</div>
<a id="a57bd286590e997e94e6b3db6b6930f73"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a57bd286590e997e94e6b3db6b6930f73">§ </a></span>get_weight()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double libevocosm::roulette_wheel::get_weight </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>a_index</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the weight assigned to a specific index. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_index</td><td>Index for which weight should be returned </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Weight for this index, or -1 if a_index is invalid </dd></dl>
<p>Referenced by <a class="el" href="a00160.html#a5aea51f1e72bbaab31a73c0622905b12">get_size()</a>.</p>
</div>
</div>
<a id="a0d255d7fd46c3d304172ac21b7c74035"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d255d7fd46c3d304172ac21b7c74035">§ </a></span>operator=()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00160.html">roulette_wheel</a>& libevocosm::roulette_wheel::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00160.html">roulette_wheel</a> & </td>
<td class="paramname"><em>a_source</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Assigns a <a class="el" href="a00160.html" title="A simulated roulette wheel for weighted selection. ">roulette_wheel</a> the state of another. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_source</td><td>- The source object </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="adda47eec4f1aa47f1ce81fe29f58c989"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adda47eec4f1aa47f1ce81fe29f58c989">§ </a></span>set_weight()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double libevocosm::roulette_wheel::set_weight </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>a_index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>a_weight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Changes the weight assigned to a specific wheel index. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">a_index</td><td>- Index to change </td></tr>
<tr><td class="paramname">a_weight</td><td>- New weight Value </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Previous weight for this index, or -1 if a_index is invalid </dd></dl>
<p>Referenced by <a class="el" href="a00160.html#a5aea51f1e72bbaab31a73c0622905b12">get_size()</a>, <a class="el" href="a00116.html#aa75d2ae8cce7ff830c0acdd4c723bf7a">libevocosm::fuzzy_machine< InSize, OutSize >::mutate()</a>, and <a class="el" href="a00144.html#a67e8efa50996fafb267637ccec933351">libevocosm::machine_tools::mutation_selector::set_weight()</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a00038_source.html">roulette.h</a></li>
</ul>
</div><!-- contents -->
<hr>
<p align="center"><small>
© 1996-2005 Scott Robert Ladd. All rights reserved.<br>
HTML documentation generated by Dimitri van Heesch's excellent <a href="http://www.doxygen.org">Doxygen</a> tool.
</small>
</p>
</body>
</html>
|