Phenotype<G, R extends FitnessResult> class
abstract
A phenotype (also called chromosome or genotype) is one particular solution to the problem (equation). The solution is encoded in genes.
After being evaluated by an Evaluator
, the phenotypes result is filled
with the output of the fitness function. If niching is at play, the result
is then modified into resultWithFitnessSharingApplied.
Phenotype can have genes of any type G
, although most often, G
will be
either bool (binary genes) or num (continuous genes).
Subclasses must define mutateGene, which returns a gene mutated by a given strength.
- Implemented types
-
- Comparable<
Phenotype< G, R> >
- Comparable<
Constructors
Properties
-
genes
↔ List<
G> -
getter/setter pair
- genesAsString → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- result ↔ R?
-
This is populated later by the algorithm.
getter/setter pair
- resultWithFitnessSharingApplied ↔ num?
-
This is populated later by the algorithm if the evaluator applies
fitness sharing.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
compareTo(
Phenotype< G, R> other) → int -
Compares this object to another object.
override
-
computeHammingDistance(
covariant Phenotype< G, R> other) → num -
Returns the degree to which this chromosome has dissimilar genes with the
other. If chromosomes are identical, returns
0.0
. If all genes are different, returns1.0
. -
mutateGene(
G gene, num strength) → G -
Takes
gene
and returns a new one, mutated bystrength
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited