private static T Mutate <T, E>(T chromosome, MutationAlgorithm mode, Mutate <E> mutate) where T : IMutatable <E> { switch (mode) { case MutationAlgorithm.Chunk: return(MutateChunk(chromosome, mutate)); case MutationAlgorithm.Global: return(MutateGlobal(chromosome, mutate)); case MutationAlgorithm.Inversion: return(MutateInversion(chromosome, mutate)); default: return(MutateChunk <T, E>(chromosome, mutate)); } }
public SimulationSettings(Objective objective) { this.Objective = objective; this.KeepBestCreatures = Default.KeepBestCreatures; this.SimulationTime = Default.SimulationTime; this.PopulationSize = Default.PopulationSize; this.SimulateInBatches = Default.SimulateInBatches; this.BatchSize = Default.BatchSize; this.MutationRate = Default.MutationRate; this.SelectionAlgorithm = Default.SelectionAlgorithm; this.RecombinationAlgorithm = Default.RecombinationAlgorithm; this.MutationAlgorithm = Default.MutationAlgorithm; }
public static float[] Mutate(float[] chromosome, MutationAlgorithm mode) { return(Mutation.Mutate <MutatableFloatArray, float>(new MutatableFloatArray(chromosome), mode, Mutate).Values); }
public static StringBuilder Mutate(StringBuilder builder, MutationAlgorithm mode) { return(Mutation.Mutate <MutatableString, char>(new MutatableString(builder), mode, Mutate).Builder); }
public static void SetMutation(float newMutationRate, MutationAlgorithm newMutationAlgorithm) { mutationRate = newMutationRate; mutationAlgorithm = newMutationAlgorithm; }