Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new
Fitness
trait that is different to the previousFitness
trait.The
Fitness
trait was originally introduced in #29 as an extension to theIndividual
trait to provide a newfitness
method. The trait was named after the method but didn't quite fit the naming conventions in this crate or the wider Rust ecosystem. At the time it seemed preferable toWithFitness
,Fit
,Score
, or any other option. Now that theFitness
trait has been merged with theIndividual
trait in #97 the name is free to be repurposed.This change introduces a new
Fitness
trait that represents the value instead of an individual with a fitness. The trait has a single methodnil
which was chosen based on theNil
fitness from #98 and to avoid conflicting with thezero
method from theZero
trait. Unfortunately types such asReverse
do not implementZero
and it requiredAdd
so that was not an option. TheDefault
trait was ruled out because that may imply a non-zero value. However, nil may suggest no value rather than a zero value so there is no clear option. At the very least the method justifies the existence of the trait.This also updates various trait bounds to replace
Default
withFitness
and updates the associatedFitness
in theIndividual
trait to add a new bound.