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