示例#1
0
    public void Stop(MouseScript mouse)
    {
        if (!complete)
        {
            double   mouse_fitness  = mouse.GetGenotype_Fitness().GetFitness();
            double[] mouse_genotype = (double[])mouse.GetGenotype_Fitness().GetGenotype().Clone();

            genotype_fitness.Add(mouse.GetGenotype_Fitness().Clone());
            Destroy(mouse.gameObject);

            if (mouse_fitness > best_fitness)
            {
                new_best      = true;
                best_fitness  = mouse_fitness;
                best_genotype = mouse_genotype;
            }

            act_mouse++;
            if (act_mouse == pop_size)
            {
                act_mouse = 0;
                GA();
            }
        }
        else
        {
            Destroy(mouse.gameObject);
        }
    }
示例#2
0
 public void Complete(MouseScript mouse)
 {
     complete = true;
     Debug.Log("Complete");
     best_genotype = (double[])mouse.GetGenotype_Fitness().GetGenotype().Clone();
     Destroy(mouse.gameObject);
     SpawnBestMouse();
 }