Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/17 01:15:25 (8 years ago)
Author:
pkimmesw
Message:

#2665 BenchmarkSuite, all examples, partially tested, VectorExpressions added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Grades.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
    3 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class Grades : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Grades";
     4    private const string fileName = "Grades.csv";
     5    private const string description = "Given 5 integers, the first four represent the lower numeric thresholds for achieving an A, B, C, and D, and will be distinct and in descending order.The fifth represents the student’s numeric grade.The program must print Student has a X grade., where X is A, B, C, D, or F depending on the thresholds and the numeric grade.";
    46
    5 //  public class Grades : BenchmarkSuiteDataDescriptor<long[], string> {
    6 //    private const string displayMame = "Checksum";
    7 //    private const string description = "";
     7    protected override string FileName { get { return fileName; } }
     8    public override string Name { get { return name; } }
     9    public override string Description { get { return description; } }
     10    protected override int InputArgumentCount { get { return 5; } }
     11    protected override int OutputArgumentCount { get { return 1; } }
    812
    9 //    public override string Name { get { return displayMame; } }
    10 //    public override string Description { get { return description; } }
    11 //    protected override int InputArgumentCount { get { return 5; } }
    12 //    protected override int OutputArgumentCount { get { return 1; } }
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 25,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 200,
     23        TestCount = 2000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String,
     25        MaxSize = 400,
     26        EvalLimit = 800,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          IntegerErcOptions = {
     30            IsEnabled = true,
     31            Start = 0,
     32            End = 100
     33          },
     34          StringErcOptions = {
     35            IsEnabled = true,
     36            Constants = new [] { "Student has a ", " grade", "A", "B", "C", "D", "F" },
     37          }
     38        }
     39      };
     40    }
    1341
    14 //    public override long[] ConvertInput(string[] input) {
    15 //      return input.Select(ConvertInteger).ToArray();
    16 //    }
    17 
    18 //    public override string ConvertOutput(string[] output) {
    19 //      return output[0];
    20 //    }
    21 
    22 //    public override IPushData CreatePushData(Example<long[], string>[] training, Example<long[], string>[] test) {
    23 //      return new GradePushData(training, test);
    24 //    }
    25 //  }
    26 //}
     42    protected override Example ParseExample(string[] input, string[] output) {
     43      return new Example {
     44        InputArgs = input,
     45        OutputArgs = output,
     46        InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
     47        OutputString = output,
     48      };
     49    }
     50  }
     51}
Note: See TracChangeset for help on using the changeset viewer.