Example #1
0
        public NoveltyThread(JSPopulationEvaluator jsPop, AssessGenotypeFunction assess, int popSize)
        {
            //save our objects for executing later!
            popEval        = jsPop;
            populationSize = popSize;

            autoEvent = new AutoResetEvent(false);


            waitNextTime = true;

            novelThread = new Thread(delegate()
            {
                autoEvent.WaitOne();

                //we'll start by testing with 0 parents, and popsize of 15 yay!
                noveltyRun = EvolutionManager.SharedEvolutionManager.initializeEvolutionAlgorithm(popEval, populationSize, assess);

                //let our algoirhtm know we want to do novelty gosh darnit
                if (noveltyRun.multiobjective != null)
                {
                    noveltyRun.multiobjective.doNovelty = true;
                }

                //we make sure we don't wait in this loop, since we just got started!
                waitNextTime = false;

                while (true)
                {
                    //this will cause us to pause!
                    if (waitNextTime)
                    {
                        waitNextTime = false;
                        autoEvent.WaitOne();
                    }
                    // Start the stopwatch we'll use to measure eval performance
                    Stopwatch sw = Stopwatch.StartNew();

                    //run the generation
                    noveltyRun.PerformOneGeneration();

                    // Stop the stopwatch
                    sw.Stop();

                    // Report the results
                    Console.WriteLine("Time used per gen (float): {0} ms", sw.Elapsed.TotalMilliseconds);
                    Console.WriteLine("Time used per gen (rounded): {0} ms", sw.ElapsedMilliseconds);
                }
            });

            novelThread.Start();
        }
Example #2
0
        public NoveltyThread(JSPopulationEvaluator jsPop, AssessGenotypeFunction assess, int popSize)
        {
            //save our objects for executing later!
            popEval = jsPop;
            populationSize = popSize;

            autoEvent = new AutoResetEvent(false);

            waitNextTime = true;

            novelThread = new Thread(delegate()
                {
                    autoEvent.WaitOne();

                    //we'll start by testing with 0 parents, and popsize of 15 yay!
                    noveltyRun = EvolutionManager.SharedEvolutionManager.initializeEvolutionAlgorithm(popEval, populationSize, assess);

                    //let our algoirhtm know we want to do novelty gosh darnit
                    if(noveltyRun.multiobjective != null)
                         noveltyRun.multiobjective.doNovelty = true;

                    //we make sure we don't wait in this loop, since we just got started!
                    waitNextTime = false;

                    while (true)
                    {
                        //this will cause us to pause!
                        if (waitNextTime)
                        {
                            waitNextTime = false;
                            autoEvent.WaitOne();
                        }
                        // Start the stopwatch we'll use to measure eval performance
                        Stopwatch sw = Stopwatch.StartNew();

                        //run the generation
                        noveltyRun.PerformOneGeneration();

                        // Stop the stopwatch
                        sw.Stop();

                        // Report the results
                        Console.WriteLine("Time used per gen (float): {0} ms", sw.Elapsed.TotalMilliseconds);
                        Console.WriteLine("Time used per gen (rounded): {0} ms", sw.ElapsedMilliseconds);

                    }
                });

            novelThread.Start();
        }
Example #3
0
        public SimpleExperiment()
        {
            //We need to create some parameters, a population evaluator
            //And then we can create an EvoManager

            jsPop = new JSPopulationEvaluator();

            //we want to use leo
            esSubstrate.useLEO = true;
            evolutionManager.loadSeed("leoEmptySeed.xml");//NoConnections.xml");


            //set up default ins and outs (it's already 4,3 by default, this is just for customization later maybe)
            evolutionManager.setDefaultCPPNs(4, 3);
        }
Example #4
0
        public SimpleExperiment()
        {
            //We need to create some parameters, a population evaluator
            //And then we can create an EvoManager

            jsPop = new JSPopulationEvaluator();

            //we want to use leo
            esSubstrate.useLEO = true;
            evolutionManager.loadSeed("leoEmptySeed.xml");//NoConnections.xml");

            //set up default ins and outs (it's already 4,3 by default, this is just for customization later maybe)
            evolutionManager.setDefaultCPPNs(4, 3);
        }