Exemplo n.º 1
0
    public void CreateGA()
    {
        System.Random r = new System.Random(Time.frameCount);

        string selectType = "god mode";
        string mutateType = "randomChoice";
        string crossType  = "OnePt";

        Encoder    encoder    = new Encoder();
        string     target     = encoder.Encode(TextureNoise.CreateNoise(width, height, r));
        Fitness    fitness    = new Fitness(target);
        Population population = new Population(20, fitness._targetString)
        {
            _name = "images"
        };
        Selection selection = new Selection(selectType);
        CrossOver crossover = new CrossOver(crossType);
        Mutation  mutation  = new Mutation(mutateType);

        geneticAlgo = new GeneticAlgo(encoder, fitness, population, selection, crossover, mutation);
    }
Exemplo n.º 2
0
 private void OnEnable()
 {
     creator = target as TextureNoise;
     Undo.undoRedoPerformed += RefreshCreator;
 }