Packagecom.suckatmath.machinelearning.genetic.impl
Classpublic class FixedLengthStringGenome
InheritanceFixedLengthStringGenome Inheritance Object
Implements Genome

An entire Genome based on a single backing String



Public Properties
 PropertyDefined By
  alphabet : String
alphabet of valid letters
FixedLengthStringGenome
  content : String
backing string
FixedLengthStringGenome
  length : int
length of backing string
FixedLengthStringGenome
Public Methods
 MethodDefined By
  
FixedLengthStringGenome(l:int = 0, ab:String = abcdefghijklmnopqrstuvwxyz, c:String = null)
create a new FixedLengthStringGenome
FixedLengthStringGenome
  
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
  
return a new FixedLengthStringGenome filled with random letters from alphabet
FixedLengthStringGenome
  
toString():String
returns String representation
FixedLengthStringGenome
Property Detail
alphabetproperty
public var alphabet:String

alphabet of valid letters

contentproperty 
public var content:String

backing string

lengthproperty 
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