예제 #1
0
 /// <summary>
 /// Perform one training iteration.
 /// </summary>
 public void Iteration(GATracker gATracker)
 {
     PreIteration();
     Helper.Iteration(gATracker);
     Error = Helper.Error;
     PostIteration();
 }
예제 #2
0
        static AnalyticsHelper()
        {
            var gaInstace = GoogleAnalytics.GetInstance(AppContext);

            //gaInstace.SetLocalDispatchPeriod(10);
            GATracker = gaInstace.NewTracker(GATrackingId);
            GATracker.EnableAdvertisingIdCollection(true);
            GATracker.EnableExceptionReporting(true);
        }
예제 #3
0
        /// <summary>
        /// Perform one generation.
        /// </summary>
        public virtual void Iteration(GATracker gaTracker)
        {
            int countToMate          = (int)(Population.Genomes.Count * PercentToMate);
            int matingPopulationSize = (int)(Population.Genomes.Count * MatingPopulation);

            //The only individuals we want to preserve is the mating population.
            //i.e. everything but the mating population gets replaced.
            int newOffspringCount = Population.Genomes.Count - matingPopulationSize;
            int newOffspringIndex = Population.Genomes.Count - newOffspringCount;

            int offspringCount = countToMate * 2;

            //int offspringIndex = Population.Genomes.Count - offspringCount;

            //TaskGroup group = EngineConcurrency.Instance.CreateTaskGroup();

            // mate and form the next generation
            //20 < 80
            while (newOffspringIndex < newOffspringCount + matingPopulationSize)
            {
                for (int i = 0; i < countToMate; i++)
                {
                    IGenome mother    = Population.Genomes[i];
                    int     fatherInt = (int)(ThreadSafeRandom.NextDouble() * matingPopulationSize);
                    IGenome father    = Population.Genomes[fatherInt];
                    IGenome child1    = Population.Genomes[newOffspringIndex];
                    IGenome child2    = Population.Genomes[newOffspringIndex + 1];

                    GATracker.MatedElement matedElement = new GATracker.MatedElement(i, fatherInt, newOffspringIndex, newOffspringIndex + 1);
                    MateWorker             worker       = new MateWorker(mother, father, child1, child2, matedElement);

                    //EngineConcurrency.Instance.ProcessTask(worker, group);
                    worker.Run();

                    //Add the matedElement to the GATracker
                    gaTracker.AddMatedElement(matedElement);

                    newOffspringIndex += 2;
                }
            }

            //group.WaitForComplete();

            // sort the next generation
            Population.Sort();
        }
예제 #4
0
 public static void SendException(string description, bool isFatal)
 {
     GATracker.Send(new HitBuilders.ExceptionBuilder().SetDescription(description).SetFatal(isFatal).Build());
 }
예제 #5
0
 public static void SendEvent(string category, string action)
 {
     GATracker.Send(new HitBuilders.EventBuilder(category, action).SetLabel("AppEvent").Build());
 }
예제 #6
0
 public static void SendView(string viewName)
 {
     GATracker.SetScreenName(viewName);
     GATracker.Send(new HitBuilders.ScreenViewBuilder().Build());
 }