1 | namespace 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”.";
|
---|
6 |
|
---|
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; } }
|
---|
12 |
|
---|
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 | }
|
---|
46 |
|
---|
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 | }
|
---|