Packagecom.suckatmath.machinelearning.genetic.impl
Classpublic class ArrayGenome
InheritanceArrayGenome Inheritance Object
Implements Genome

Basic array backed genome implementation. Use this for collections of independently varying genes. This is not a good match for genomes in which copying, swapping, or moving of genes.



Public Properties
 PropertyDefined By
  exampleGene : Gene
example Gene to use for new random Genes
ArrayGenome
  length : int
number of genes
ArrayGenome
Public Methods
 MethodDefined By
  
create a new empty ArrayGenome
ArrayGenome
  
generate a copy of this Genome.
ArrayGenome
  
crossover(others:Array, numpoints:int):Genome
construct a new genome from this and others.
ArrayGenome
  
getGenes():Array
get actual genes
ArrayGenome
  
mutate(probability:Number):Genome
create a copy of this genome with some probability of mutation.
ArrayGenome
  
generate a new random genome.
ArrayGenome
  
set example Gene to use for new random genes
ArrayGenome
  
setLength(l:int):void
set length
ArrayGenome
  
toString():String
Return a string representation of this Genome
ArrayGenome
Property Detail
exampleGeneproperty
public var exampleGene:Gene

example Gene to use for new random Genes

lengthproperty 
public var length:int

number of genes

Constructor Detail
ArrayGenome()Constructor
public function ArrayGenome()

create a new empty ArrayGenome

Method Detail
clone()method
public function clone():Genome

generate a copy of this Genome.

Returns
Genome — Genome
crossover()method 
public function crossover(others:Array, numpoints:int):Genome

construct a new genome from this and others.

Parameters

others:Array
 
numpoints:int

Returns
Genome
getGenes()method 
public function getGenes():Array

get actual genes

Returns
Array — Array
mutate()method 
public function mutate(probability:Number):Genome

create a copy of this genome with some probability of mutation. Mutates at most 1 gene.

Parameters

probability:Number — Number between 0 and 1

Returns
Genome
newRandom()method 
public function newRandom():Genome

generate a new random genome. Uses exampleGene to create random Genes

Returns
Genome — Genome
setExampleGene()method 
public function setExampleGene(g:Gene):void

set example Gene to use for new random genes

Parameters

g:Gene

setLength()method 
public function setLength(l:int):void

set length

Parameters

l:int

toString()method 
public function toString():String

Return a string representation of this Genome

Returns
String — String