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

Package | com.suckatmath.machinelearning.genetic.impl
Class | public class FixedLengthStringGenome
Inheritance | FixedLengthStringGenome Object
Implements | Genome

An entire Genome based on a single backing String

Public Properties

| Property | Defined By
--- | --- | ---
|  | alphabet : String alphabet of valid letters | FixedLengthStringGenome
|  | content : String backing string | FixedLengthStringGenome
|  | length : int length of backing string | FixedLengthStringGenome

Public Methods

| Method | Defined By
--- | --- | ---
|  | FixedLengthStringGenome(l:int = 0, ab:String = abcdefghijklmnopqrstuvwxyz, c:String = null) create a new FixedLengthStringGenome | FixedLengthStringGenome
|  | clone():Genome return a copy of this Genome | FixedLengthStringGenome
|  | crossover(others:Array, np:int):Genome "sexual" reproduction. | FixedLengthStringGenome
|  | mutate(probability:Number):Genome return a new FixedLengthStringGenome copy, possibly mutated | FixedLengthStringGenome
|  | newRandom():Genome return a new FixedLengthStringGenome filled with random letters from alphabet | FixedLengthStringGenome
|  | toString():String returns String representation | FixedLengthStringGenome

Property Detail

alphabet | property

`public var alphabet:String`

alphabet of valid letters

content | property |

`public var content:String`

backing string

length | property |

`public var length:int`

length of backing string

Constructor Detail

FixedLengthStringGenome | () | Constructor

`public function FixedLengthStringGenome(l:int = 0, ab:String = abcdefghijklmnopqrstuvwxyz, c:String = null)`

create a new FixedLengthStringGenome

Parameters

| `l:int` (default = `0`)`` — int length
| `ab:String` (default = `abcdefghijklmnopqrstuvwxyz`)`` — String alphabet
| `c:String` (default = `null`)`` — String content - if null, will be random

Method Detail

clone | () | method

`public function clone():Genome`

return a copy of this Genome

Returns

| `Genome` —

crossover | () | method |

`public function crossover(others:Array, np:int):Genome`

"sexual" reproduction. Combines this Genome with others by splicing together parts at crossover points

Parameters

| `others:Array` — Array of FixedLengthStringGenome parents
| `np:int` — int number of crossover points

Returns

| `Genome` — FixedLengthStringGenome as Genome

mutate | () | method |

`public function mutate(probability:Number):Genome`

return a new FixedLengthStringGenome copy, possibly mutated

Parameters

| `probability:Number` — Number

Returns

| `Genome` — FixedLengthStringGenome as Genome

newRandom | () | method |

`public function newRandom():Genome`

return a new FixedLengthStringGenome filled with random letters from alphabet

Returns

| `Genome` —

toString | () | method |

`public function toString():String`

returns String representation

Returns

| `String` —

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