1 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
4 | public class PigLatin : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "Pig Latin - Hard";
|
---|
6 | private const string fileName = "PigLatin.csv";
|
---|
7 | 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”.";
|
---|
8 |
|
---|
9 | protected override string FileName { get { return fileName; } }
|
---|
10 | public override string Name { get { return name; } }
|
---|
11 | public override string Description { get { return description; } }
|
---|
12 | protected override int InputArgumentCount { get { return 1; } }
|
---|
13 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData(ProblemType.PigLatin) {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | ProgramExecutionBudget = 60000000,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 5000,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.String },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
25 | TrainingCount = 200,
|
---|
26 | TestCount = 1000,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
28 | MaxSize = 1000,
|
---|
29 | EvalLimit = 2000,
|
---|
30 | ErcOptions = {
|
---|
31 | ErcProbability = 0.05,
|
---|
32 | CharErcOptions = new CharErcOptions(
|
---|
33 | new IntegerConstantErc(' ', 'a', 'e', 'i', 'o', 'u'),
|
---|
34 | new IntegerRangeErc(0x20, 0x7e)),
|
---|
35 | StringErcOptions = new StringErcOptions(
|
---|
36 | new StringConstantErc("ay", "aeiou"),
|
---|
37 | new StringRandomErc {
|
---|
38 | IsEnabled = true,
|
---|
39 | AllowLowercaseLetters = true,
|
---|
40 | AllowUppercaseLetters = false,
|
---|
41 | AllowSpace = true,
|
---|
42 | SpaceProbability = 0.2,
|
---|
43 | })
|
---|
44 | }
|
---|
45 | };
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
49 | return new Example {
|
---|
50 | InputArgs = input,
|
---|
51 | OutputArgs = output,
|
---|
52 | InputString = input,
|
---|
53 | OutputPrint = output[0],
|
---|
54 | };
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|