The optimizer specifies how to rank individuals against each other based on an arbitrary fitness score. For example, minimizing the sum of squared error for a regression curve Min would be used, as a smaller fitness score is indicative of better fit.
optimizeKey
Description
Min
The smaller fitness score of two individuals is best
Max
The greater fitness score of two individuals is best
Selection
An algorithm can be either genetic or evolutionary depending on which selection operations are used. An algorithm is evolutionary if it only uses a Single SelectType. If both Single and Pair-wise operations are used (and if crossover is implemented) it is genetic.
Select Type
Required
Description
select (Single)
Yes
Selects a single individual for survival from a population
pair (Pair-wise)
Optional
Selects two individuals from a population for mating/crossover
Individual Configuration Parameters
interfaceIndividualConfig{
fitness:(entity:any): number
mutate:(entity:any): any
mate:(mother:any,father:any): [any,any]
}
Parameter
Type
Description
fitness
Function
Calculates the fitness score of an individual
mutate
Function
Mutates an individual
mate
Function
Mates 2 individuals and returns 2 new individuals
Building
To clone, build, and test Genetic.js issue the following command: