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