Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/17 01:15:25 (7 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/PigLatin.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class PigLatin : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Pig Latin";
     4    private const string fileName = "PigLatin.csv";
     5    private const string description = "Given a string containing lowercase words separated by single spaces, print the string with each word translated to pig Latin.Specifically, if a word starts with a vowel, it should have“ay”added to its end; otherwise, the first letter is moved to the end of the word, followed by “ay”.";
    36
    4 //  public class PigLatin : BenchmarkSuiteDataDescriptor<string, string> {
    5 //    private const string displayMame = "Pig Latin";
    6 //    private const string description = "Given a string containing lowercase words separated by single spaces, print the string with each word translated to pig Latin.Specifically, if a word starts with a vowel, it should have“ay”added to its end; otherwise, the first letter is moved to the end of the word, followed by “ay”";
     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 1; } }
     11    protected override int OutputArgumentCount { get { return 1; } }
    712
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
    10 //    protected override int InputArgumentCount { get { return 1; } }
    11 //    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 = 100,
     20        InputArgumentTypes = new[] { ExampleArgumentType.String },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 200,
     23        TestCount = 1000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
     25        MaxSize = 1000,
     26        EvalLimit = 2000,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          CharErcOptions = {
     30            IsEnabled = true,
     31            Constants = new [] { ' ', 'a', 'e', 'i', 'o', 'u' },
     32            Start = 0x20,
     33            End = 0x7e
     34          },
     35          StringErcOptions = {
     36            IsEnabled = true,
     37            Constants = new [] { "ay", "aeiou" },
     38            AllowLowercaseLetters = true,
     39            AllowUppercaseLetters = false,
     40            AllowSpace = true,
     41            SpaceProbability = 0.2,
     42          }
     43        }
     44      };
     45    }
    1246
    13 //    public override string ConvertInput(string[] input) {
    14 //      return input[0];
    15 //    }
    16 
    17 //    public override string ConvertOutput(string[] output) {
    18 //      return output[0];
    19 //    }
    20 
    21 //    public override IPushData CreatePushData(Example<string, string>[] training, Example<string, string>[] test) {
    22 //      return new PigLatinPushData(training, test);
    23 //    }
    24 //  }
    25 //}
     47    protected override Example ParseExample(string[] input, string[] output) {
     48      return new Example {
     49        InputArgs = input,
     50        OutputArgs = output,
     51        InputString = input,
     52        OutputString = output,
     53      };
     54    }
     55  }
     56}
Note: See TracChangeset for help on using the changeset viewer.