Exemplo n.º 1
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            pop          = InitPopulation();
            score        = new PlantScore();
            this.genetic = new BasicEA(pop, score);

            //this.genetic.Speciation = new ArraySpeciation<DoubleArrayGenome>();

            genetic.AddOperation(0.9, new Splice(PlantUniverse.GenomeSize / 3));
            genetic.AddOperation(0.1, new MutatePerturb(0.1));

            // Display

            this.universe = new PlantUniverse();
            this.universe.Reset();


            DoubleArrayGenome bestGenome = (DoubleArrayGenome)genetic.BestGenome;
            PlantPhysics      physics    = new PlantPhysics();
            PlantGrowth       growth     = new PlantGrowth();

            for (int i = 0; i < 100; i++)
            {
                physics.RunPhysics(universe);
                growth.RunGrowth(universe, bestGenome.Data);
            }

            this.display          = new DisplayPlant(CanvasOutput);
            this.display.Universe = this.universe;
            Thread t = new Thread(DoWork);

            t.Start();
        }
Exemplo n.º 2
0
 private void Init()
 {
     _display = new DisplayPlant(CanvasOutput);
 }