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 ReplaceSpaceWithNewline : BenchmarkSuiteDataDescriptor {
|
---|
7 | private const string name = "Replace Space with Newline - Medium";
|
---|
8 | private const string fileName = "ReplaceSpaceWithNewline.csv";
|
---|
9 | private const string description = " Given a string input, print the string, replacing spaces with newlines.Also, return the integer count of the non- whitespace characters. The input string will not have tabs or newlines.";
|
---|
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 2; } }
|
---|
16 |
|
---|
17 | public override ProblemData CreateProblemData() {
|
---|
18 | return new ProblemData {
|
---|
19 | Name = Name,
|
---|
20 | Description = Description,
|
---|
21 | Examples = CloneExamples(),
|
---|
22 | BestResult = 0,
|
---|
23 | WorstResult = 20,
|
---|
24 | InputArgumentTypes = new[] { ExampleArgumentType.String },
|
---|
25 | OutputArgumentTypes = new[] { ExampleArgumentType.Print, ExampleArgumentType.Integer },
|
---|
26 | TrainingCount = 100,
|
---|
27 | TestCount = 1000,
|
---|
28 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
29 | MaxSize = 800,
|
---|
30 | EvalLimit = 1600,
|
---|
31 | ErcOptions = {
|
---|
32 | ErcProbability = 0.05,
|
---|
33 | CharErcOptions = new CharErcOptions(
|
---|
34 | new IntegerConstantErc(' ', '\n'),
|
---|
35 | new IntegerRangeErc(0x20, 0x7e)),
|
---|
36 | StringErcOptions = new StringErcOptions(
|
---|
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 | OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[1]),
|
---|
55 | };
|
---|
56 | }
|
---|
57 | }
|
---|
58 | }
|
---|