Пример #1
0
        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));
            }
        }
Пример #2
0
 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;
 }
Пример #3
0
 public static float[] Mutate(float[] chromosome, MutationAlgorithm mode)
 {
     return(Mutation.Mutate <MutatableFloatArray, float>(new MutatableFloatArray(chromosome), mode, Mutate).Values);
 }
Пример #4
0
 public static StringBuilder Mutate(StringBuilder builder, MutationAlgorithm mode)
 {
     return(Mutation.Mutate <MutatableString, char>(new MutatableString(builder), mode, Mutate).Builder);
 }
Пример #5
0
 public static void SetMutation(float newMutationRate, MutationAlgorithm newMutationAlgorithm)
 {
     mutationRate      = newMutationRate;
     mutationAlgorithm = newMutationAlgorithm;
 }