Closed
Description
The Constraint
interface only checks and repairs individuals, which has been destroyed during the evolution process. Individuals, created by the given Factory<Genotype<G>>
, are not validated/repaired. Allow to create wrapped Factory<Genotype<G>>
, which obey a given constraint, when creating new individuals.
// Unconstraint factory.
final Factory<Genotype<G>> gtf = ...;
final Constraint<DoubleGene, Double> constraint = ...;
// This factory will create individuals, which obeys the `constraint`
final Factory<Genotype<G>> constraintFactory = constraint.constrain(gtf);