1 <?xml version=
"1.0" encoding=
"iso-8859-1"?>
3 PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
8 <title>Class: Population
</title>
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
10 <meta http-equiv=
"Content-Script-Type" content=
"text/javascript" />
11 <link rel=
"stylesheet" href=
".././rdoc-style.css" type=
"text/css" media=
"screen" />
12 <script type=
"text/javascript">
15 function popupCode( url ) {
16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=
150,width=
400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval( "document.all." + id );
27 elemStyle = elem.style;
29 if ( elemStyle.display != "block" ) {
30 elemStyle.display = "block"
32 elemStyle.display = "none"
38 // Make codeblocks hidden by default
39 document.writeln( "
<style type=\
"text/css\">div.method-source-code { display: none }
</style>" )
49 <div id="classHeader
">
50 <table class="header-table
">
51 <tr class="top-aligned-row
">
52 <td><strong>Class</strong></td>
53 <td class="class-name-in-header
">Population</td>
55 <tr class="top-aligned-row
">
56 <td><strong>In:</strong></td>
58 <a href="../files/src/selection_rb.html
">
62 <a href="../files/lib/libgenetics_rb.html
">
69 <tr class="top-aligned-row
">
70 <td><strong>Parent:</strong></td>
77 <!-- banner header -->
79 <div id="bodyContent
">
83 <div id="contextContent
">
85 <div id="description
">
87 A population of genomes
95 <div id="method-list
">
96 <h3 class="section-bar
">Methods</h3>
98 <div class="name-list
">
99 <a href="#M000019
">crossover</a>
100 <a href="#M000021
">make_next_generation</a>
101 <a href="#M000020
">mutation</a>
102 <a href="#M000018
">new</a>
103 <a href="#M000016
">tournament_select_one</a>
104 <a href="#M000017
">tournament_select_population</a>
119 <div id="attribute-list
">
120 <h3 class="section-bar
">Attributes</h3>
122 <div class="name-list
">
124 <tr class="top-aligned-row context-row
">
125 <td class="context-item-name
">individuals</td>
126 <td class="context-item-value
"> [RW] </td>
127 <td class="context-item-desc
"></td>
135 <!-- if method_list -->
137 <h3 class="section-bar
">Public Class methods</h3>
139 <div id="method-M000018
" class="method-detail
">
140 <a name="M000018
"></a>
142 <div class="method-heading
">
143 <a href="Population.src/M000018.html
" target="Code
" class="method-signature
"
144 onclick="popupCode('Population.src/M000018.html');return false;
">
145 <span class="method-name
">new</span><span class="method-args
">(population_size, genome_length)</span>
149 <div class="method-description
">
151 Create a population of a given size
156 <h3 class="section-bar
">Public Instance methods</h3>
158 <div id="method-M000019
" class="method-detail
">
159 <a name="M000019
"></a>
161 <div class="method-heading
">
162 <a href="Population.src/M000019.html
" target="Code
" class="method-signature
"
163 onclick="popupCode('Population.src/M000019.html');return false;
">
164 <span class="method-name
">crossover</span><span class="method-args
">(crossover_rate)</span>
168 <div class="method-description
">
170 Perform the <a href="Population.html#M000019
">crossover</a> step in a
171 population, giving a <a href="Population.html#M000018
">new</a> population
176 <div id="method-M000021
" class="method-detail
">
177 <a name="M000021
"></a>
179 <div class="method-heading
">
180 <a href="Population.src/M000021.html
" target="Code
" class="method-signature
"
181 onclick="popupCode('Population.src/M000021.html');return false;
">
182 <span class="method-name
">make_next_generation</span><span class="method-args
">(tournament_winner_success_rate = 0.8, game_length = 1000, crossover_rate = 0.7, mutation_rate = 0.05)</span>
186 <div class="method-description
">
190 <div id="method-M000020
" class="method-detail
">
191 <a name="M000020
"></a>
193 <div class="method-heading
">
194 <a href="Population.src/M000020.html
" target="Code
" class="method-signature
"
195 onclick="popupCode('Population.src/M000020.html');return false;
">
196 <span class="method-name
">mutation</span><span class="method-args
">(mutation_rate)</span>
200 <div class="method-description
">
202 Perform the <a href="Population.html#M000020
">mutation</a> step in a
203 population, giving a <a href="Population.html#M000018
">new</a> population
208 <div id="method-M000016
" class="method-detail
">
209 <a name="M000016
"></a>
211 <div class="method-heading
">
212 <a href="Population.src/M000016.html
" target="Code
" class="method-signature
"
213 onclick="popupCode('Population.src/M000016.html');return false;
">
214 <span class="method-name
">tournament_select_one</span><span class="method-args
">(winner_success_chance = 0.8, max_game_length= 1000, verbose = false)</span>
218 <div class="method-description
">
220 Use tournament selection to pick an individual for the next generation
225 <div id="method-M000017
" class="method-detail
">
226 <a name="M000017
"></a>
228 <div class="method-heading
">
229 <a href="Population.src/M000017.html
" target="Code
" class="method-signature
"
230 onclick="popupCode('Population.src/M000017.html');return false;
">
231 <span class="method-name
">tournament_select_population</span><span class="method-args
">(winner_success_chance = 0.8, max_game_length = 1000, verbose = false)</span>
235 <div class="method-description
">
237 Select a <a href="Population.html#M000018
">new</a> population the same size
238 as the current population
250 <div id="validator-badges
">
251 <p><small><a href="http://validator.w3.org/check/referer
">[Validate]</a></small></p>