mutateGene abstract method
Takes gene
and returns a new one, mutated by strength
.
For example, if the phenotype is encoded by genes that are integers
in the range 0
to 100
, and gene
equals 50
, then:
- If
strength
is0.0
(minimum), then no mutation takes place, and the returned value is50
. - If
strength
is1.0
(maximum), then the returned value should be completely random and independent from the givengene
. In our case, the returned value will be anything between0
and100
. - If
strength
is anything between those values, the mutation should interpolate between the two extremes. The returned value will be somewhat similar to the originalgene
.
By default, GenerationBreeder calls this method with strength
of
1.0
. Unless you're doing something special, you may be able to ignore
strength
altogether and just return a random gene every time.
Implementation
G mutateGene(G gene, num strength);