Пример #1
0
 public RandomSearch(TrainingSamplesGenerator gen, int maxDepth, NodeTypeFrequencyProfile profile, int batchSize = 128)
     : base(gen)
 {
     this.profile   = profile;
     this.maxDepth  = maxDepth;
     this.batchSize = batchSize;
 }
Пример #2
0
 public RandomMutationSearch(TrainingSamplesGenerator generator, int mutationsInEachStep, NodeTypeFrequencyProfile profile)
     : base(generator)
 {
     this.mutationsInStep = mutationsInEachStep;
     this.profile         = profile;
     this.mutator         = new PointMutation(profile, 3);
     this.mutatedPrograms = new List <EvaluatedEntity <SolutionProgram> >();
 }
Пример #3
0
        /// <summary>
        /// Evaluates given solution program using given samplesGenerator. Prints a comparison of desiredOutputs to realOutputs and computes success rate.
        /// </summary>
        /// <param name="generator"></param>
        /// <param name="p"></param>
        /// <param name="samplesCount"></param>
        public static void runEvaluation(TrainingSamplesGenerator generator, SolutionProgram p, int samplesCount, bool quiet = false)
        {
            Interpret i            = new Interpret();
            int       currectCount = 0;

            foreach (var sample in generator.generateSamples(samplesCount))
            {
                p.evaluate(sample, i);
                Printing.PrintMsg(sample.ToString() + "\treal output: " + sample.realOutputs2String + " " + (sample.isCorrectlyAnswered ? "OK" : "WRONG"), quiet);
                if (sample.isCorrectlyAnswered)
                {
                    currectCount++;
                }
            }
            Console.WriteLine($"Success rate: {currectCount} out of {samplesCount} ({((double)(currectCount*100) / samplesCount).ToString("0.##")}%)");
        }
Пример #4
0
 protected SearchAlgorithm(TrainingSamplesGenerator generator)
 {
     this.watch     = new Stopwatch();
     this.generator = generator;
     this.i         = new Interpret();
 }
Пример #5
0
 public FullEnumerationSearch(TrainingSamplesGenerator generator, int batchSize = 128)
     : base(generator)
 {
     this.batchSize = batchSize;
 }