Class: LinearIndividual

LinearIndividual

new LinearIndividual(options)

Linear genetic programming individual

Parameters:
Name Type Description
options object

Linear indivdual options

Properties
Name Type Attributes Default Description
numInputs number

The number of inputs that the individual accepts

numOutputs number

The number of output the individual should return

functionSet Array.<function()>

An array of functions that are made available to the individual

removeIntrons boolean <optional>
true

Specify whether introns should be removed before execution

conditionalSet Array.<function()> <optional>
[]

An array of functions that can be used to control logic

Properties:
Name Type Description
options object

Linear indivdual options

Source:

Extends

Methods

copy() → {Individual}

Creates a deep copy of the individual

Inherited From:
Source:
Returns:

A copy of the Individual instance

Type
Individual

createNew() → {Individual}

Creates a deep copy of the individual and then re initialises

Inherited From:
Source:
Returns:

A new individual based on the current individual

Type
Individual

execute(An) → {Array.<object>}

Executes the liner code represented by the indivduals body

Parameters:
Name Type Description
An Array.<object>

array of inputs

Source:
Returns:

An array of outputs

Type
Array.<object>

initialise() → {Individual}

Re creates the individuals body with randomly generated genes

Inherited From:
Source:
Returns:

Reference to current object for chaining

Type
Individual

isFixedLength() → {boolean}

Determine whether the individual body length can change (i.e. minLength === maxLength)

Inherited From:
Source:
Returns:

A true value if the indiviuals body is of fixed length, otherwise false

Type
boolean

mutate() → {Individual}

Mutates the individual by swapping a single gene with a randomly created gene

Inherited From:
Source:
Returns:

Reference to current object for chaining

Type
Individual

removeIntrons() → {LinearIndividual}

Removes all structurally noneffective code until the body length reaches the minimum allowed length

Source:
Returns:

Reference to current object for chaining

Type
LinearIndividual

setDefaultOptionsIfNotProvided() → {LinearIndividual}

Sets default values for options that have not been defined

Source:
Returns:

Reference to current object for chaining

Type
LinearIndividual

toString() → {string}

Returns a string containing an executable representation of the individual

Source:
Returns:

A string containing an executable representation of the individual

Type
string

validateRequiredOptions() → {LinearIndividual}

Validates the linear individuals current options

Source:
Throws:
An exception will occur if a required option is missing
Returns:

Reference to current object for chaining

Type
LinearIndividual