intelligence
Version:
Machine learning library written in javascript
4,034 lines (1,203 loc) • 52.2 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2>
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="alphabet"><span class="type-signature"></span>alphabet<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random letter in the alphabet, including uppercase characters and whitespace</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geneFactories.js.html">genetic/geneFactories.js</a>, <a href="geneFactories.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random letter in the alphabet</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="arrayEqual"><span class="type-signature"></span>arrayEqual<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Compares two arrays by each element</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>a</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>The first array to compare</p></td>
</tr>
<tr>
<td class="name"><code>b</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>The second array to compare</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line47">line 47</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if the provided arrays are equal, otherwise false</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="binaryNumber"><span class="type-signature"></span>binaryNumber<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random binary number</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geneFactories.js.html">genetic/geneFactories.js</a>, <a href="geneFactories.js.html#line17">line 17</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random binary number</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="binaryString"><span class="type-signature"></span>binaryString<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random binary string</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geneFactories.js.html">genetic/geneFactories.js</a>, <a href="geneFactories.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random binary string</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createCalculation"><span class="type-signature"></span>createCalculation<span class="signature">(registerSet, index)</span><span class="type-signature"> → {<a href="RegisterReference.html">RegisterReference</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a new calculation register reference</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>registerSet</code></td>
<td class="type">
<span class="param-type"><a href="RegisterSet.html">RegisterSet</a></span>
</td>
<td class="description last"><p>A register set instance</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional user specified index</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="registerReference.js.html">genetic/linear/registerReference.js</a>, <a href="registerReference.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A new calculation register reference</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="RegisterReference.html">RegisterReference</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createConstant"><span class="type-signature"></span>createConstant<span class="signature">(registerSet, index)</span><span class="type-signature"> → {<a href="RegisterReference.html">RegisterReference</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a new constant register reference</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>registerSet</code></td>
<td class="type">
<span class="param-type"><a href="RegisterSet.html">RegisterSet</a></span>
</td>
<td class="description last"><p>A register set instance</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional user specified index</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="registerReference.js.html">genetic/linear/registerReference.js</a>, <a href="registerReference.js.html#line92">line 92</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A new constant register reference</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="RegisterReference.html">RegisterReference</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createInput"><span class="type-signature"></span>createInput<span class="signature">(registerSet, index)</span><span class="type-signature"> → {<a href="RegisterReference.html">RegisterReference</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a new input register reference</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>registerSet</code></td>
<td class="type">
<span class="param-type"><a href="RegisterSet.html">RegisterSet</a></span>
</td>
<td class="description last"><p>A register set instance</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional user specified index</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="registerReference.js.html">genetic/linear/registerReference.js</a>, <a href="registerReference.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A new input register reference</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="RegisterReference.html">RegisterReference</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createOutput"><span class="type-signature"></span>createOutput<span class="signature">(registerSet, index)</span><span class="type-signature"> → {<a href="RegisterReference.html">RegisterReference</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a new output register reference</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>registerSet</code></td>
<td class="type">
<span class="param-type"><a href="RegisterSet.html">RegisterSet</a></span>
</td>
<td class="description last"><p>A register set instance</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional user specified index</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="registerReference.js.html">genetic/linear/registerReference.js</a>, <a href="registerReference.js.html#line112">line 112</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A new output register reference</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="RegisterReference.html">RegisterReference</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="formatString"><span class="type-signature"></span>formatString<span class="signature">(stringVar, argsArray)</span><span class="type-signature"> → {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Replaces each tag in the provided string with its corresponding parameter element</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>stringVar</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>String to convert</p></td>
</tr>
<tr>
<td class="name"><code>argsArray</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>An array of arguments</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Converted string</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="fpEqual"><span class="type-signature"></span>fpEqual<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs floating point comparison between two numbers with an epsilon of 0.00001</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>a</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The first number to compare</p></td>
</tr>
<tr>
<td class="name"><code>b</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The second number to compare</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line37">line 37</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if the provided numbers are equal, otherwise false</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="inherits"><span class="type-signature"></span>inherits<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Calls nodes util.inherits function</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line72">line 72</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="linearNode"><span class="type-signature"></span>linearNode<span class="signature">(A)</span><span class="type-signature"> → {<a href="LinearGPNode.html">LinearGPNode</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random linear node for linear genetic programming</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>A</code></td>
<td class="type">
<span class="param-type"><a href="LinearIndividual.html">LinearIndividual</a></span>
</td>
<td class="description last"><p>linear individual to create a node for</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geneFactories.js.html">genetic/geneFactories.js</a>, <a href="geneFactories.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random linear node</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="LinearGPNode.html">LinearGPNode</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onePointFixed"><span class="type-signature"></span>onePointFixed<span class="signature">(individuals)</span><span class="type-signature"> → {Array.<<a href="Individual.html">Individual</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs one point fixed crossover</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array containing two individuals</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing two offspring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onePointVariable"><span class="type-signature"></span>onePointVariable<span class="signature">(individuals)</span><span class="type-signature"> → {Array.<<a href="Individual.html">Individual</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs one point variable crossover</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array containing two individuals</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line106">line 106</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing two offspring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="randBetween"><span class="type-signature"></span>randBetween<span class="signature">(min, max)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random whole number between a specified range</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Minimum value (inclusive)</p></td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Maximum value (exclusive)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line9">line 9</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random whole number between a specified range</p>
</div>
</dd>
<dt>
<h4 class="name" id="random"><span class="type-signature"></span>random<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random number between 0 and 1</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random number between 0 and 1</p>
</div>
</dd>
<dt>
<h4 class="name" id="random"><span class="type-signature"></span>random<span class="signature">(individuals, options)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns two randomly selected individuals</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>Population options</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="selectionStrategies.js.html">genetic/selectionStrategies.js</a>, <a href="selectionStrategies.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="randomNumber"><span class="type-signature"></span>randomNumber<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a random number between 0 and 1</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geneFactories.js.html">genetic/geneFactories.js</a>, <a href="geneFactories.js.html#line9">line 9</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random number between 0 and 1</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rank"><span class="type-signature"></span>rank<span class="signature">(individuals, options)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns two individuals using the rank selection algorithm</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>Population options</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="selectionStrategies.js.html">genetic/selectionStrategies.js</a>, <a href="selectionStrategies.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rouletteWheel"><span class="type-signature"></span>rouletteWheel<span class="signature">(individuals, options)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns two individuals using the roulette wheel selection algorithm</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>Population options</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="selectionStrategies.js.html">genetic/selectionStrategies.js</a>, <a href="selectionStrategies.js.html#line62">line 62</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="selectRandom"><span class="type-signature"></span>selectRandom<span class="signature">(from)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a randomly selected element from an array</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>from</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>An array to select an element from</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">infrastructure/utils.js</a>, <a href="utils.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A randomly selected element from the provided array</p>
</div>
</dd>
<dt>
<h4 class="name" id="swapGenes"><span class="type-signature"></span>swapGenes<span class="signature">(indvidualA, indvidualB, index)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Swaps genes between two individuals at the specified index</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>indvidualA</code></td>
<td class="type">
<span class="param-type"><a href="Individual.html">Individual</a></span>
</td>
<td class="description last"><p>The first individual</p></td>
</tr>
<tr>
<td class="name"><code>indvidualB</code></td>
<td class="type">
<span class="param-type"><a href="Individual.html">Individual</a></span>
</td>
<td class="description last"><p>The second individual</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Body array index to swap genes at</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line42">line 42</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="tournament"><span class="type-signature"></span>tournament<span class="signature">(individuals, options)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Returns two individuals using the tournament selection algorithm</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>Population options</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="selectionStrategies.js.html">genetic/selectionStrategies.js</a>, <a href="selectionStrategies.js.html#line34">line 34</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="twoPointFixed"><span class="type-signature"></span>twoPointFixed<span class="signature">(individuals)</span><span class="type-signature"> → {Array.<<a href="Individual.html">Individual</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs two point fixed crossover</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array containing two individuals</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line70">line 70</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing two offspring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="twoPointVariable"><span class="type-signature"></span>twoPointVariable<span class="signature">(individuals)</span><span class="type-signature"> → {Array.<<a href="Individual.html">Individual</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs two point variable crossover</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array containing two individuals</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line123">line 123</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing two offspring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="uniform"><span class="type-signature"></span>uniform<span class="signature">(individuals)</span><span class="type-signature"> → {Array.<<a href="Individual.html">Individual</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Performs uniform crossover</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array containing two individuals</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line88">line 88</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing two offspring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="validateFixedLength"><span class="type-signature"></span>validateFixedLength<span class="signature">(individuals)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Throws an exception if any individuals are not fixed length</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals to validate</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
An exception is thrown if any individuals are not fixed length
</div>
</dd>
<dt>
<h4 class="name" id="validateMinimumLength"><span class="type-signature"></span>validateMinimumLength<span class="signature">(individuals)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Throws an exception if any individuals have less than two genes</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals to validate</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
An exception is thrown if any individuals have less than two genes
</div>
</dd>
<dt>
<h4 class="name" id="validateVariableLength"><span class="type-signature"></span>validateVariableLength<span class="signature">(individuals)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Throws an exception if any individuals are fixed length</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>individuals</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Individual.html">Individual</a>></span>
</td>
<td class="description last"><p>An array of individuals to validate</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="crossoverStrategies.js.html">genetic/crossoverStrategies.js</a>, <a href="crossoverStrategies.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
An exception is thrown if any individuals are fixed length
</div>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Individual.html">Individual</a></li><li><a href="LinearConditionalNode.html">LinearConditionalNode</a></li><li><a href="LinearFunctionNode.html">LinearFunctionNode</a></li><li><a href="LinearGPNode.html">LinearGPNode</a></li><li><a href="LinearIndividual.htm