GODPAPER | All Packages | All Classes | Index | Frames No Frames |
ArrayGenome

Package | com.suckatmath.machinelearning.genetic.impl
Class | public class ArrayGenome
Inheritance | ArrayGenome 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

| Property | Defined By
--- | --- | ---
|  | exampleGene : Gene example Gene to use for new random Genes | ArrayGenome
|  | length : int number of genes | ArrayGenome

Public Methods

| Method | Defined By
--- | --- | ---
|  | ArrayGenome() create a new empty ArrayGenome | ArrayGenome
|  | clone():Genome 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
|  | newRandom():Genome generate a new random genome. | ArrayGenome
|  | setExampleGene(g:Gene):void 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

exampleGene | property

`public var exampleGene:Gene`

example Gene to use for new random Genes

length | property |

`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

Thu Jan 16 2014, 01:11 PM +08:00