public void Recombine() { Func <DoubleGene> Factory = delegate() { return(DoubleGene.Of(0, 100)); }; var v = MutableSeq.Of(Factory, 10); var w = MutableSeq.Of(Factory, 10); var recombinator = new IntermediateCrossover <DoubleGene, double>(0.1, 10); recombinator.Crossover(v, w); Assert.True(v.ForAll(dg => dg.IsValid)); Assert.True(w.ForAll(dg => dg.IsValid)); }
public void Recombine() { DoubleGene Factory() { return(DoubleGene.Of(0, 100)); } var v = MutableSeq.Of(Factory, 10); var w = MutableSeq.Of(Factory, 10); var recombinator = new LineCrossover <DoubleGene, double>(); recombinator.Crossover(v, w); Assert.True(v.ForAll(dg => dg.IsValid)); Assert.True(w.ForAll(dg => dg.IsValid)); }
public static Phenotype <DoubleGene, double> NewDoublePhenotype(double value) { return(Phenotype.Of(Genotype.Of( DoubleChromosome.Of(DoubleGene.Of(value, 0, 10))), 0, Ff ).Evaluate()); }
private static Phenotype <DoubleGene, double> CreatePhenotype(double value) { return(Phenotype.Of(Genotype.Of(DoubleChromosome.Of(DoubleGene.Of(value, 0, 10))), 0, gt => gt.Gene.Allele)); }