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(ProblemType.ReplaceSpaceWithNewline) {
|
---|
19 | Name = Name,
|
---|
20 | Description = Description,
|
---|
21 | ProgramExecutionBudget = 30000000,
|
---|
22 | Examples = CloneExamples(),
|
---|
23 | BestResult = 0,
|
---|
24 | WorstResult = 5000,
|
---|
25 | InputArgumentTypes = new[] { ExampleArgumentType.String },
|
---|
26 | OutputArgumentTypes = new[] { ExampleArgumentType.Print, ExampleArgumentType.Integer },
|
---|
27 | TrainingCount = 100,
|
---|
28 | TestCount = 1000,
|
---|
29 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
30 | MaxSize = 800,
|
---|
31 | EvalLimit = 1600,
|
---|
32 | ErcOptions = {
|
---|
33 | ErcProbability = 0.05,
|
---|
34 | CharErcOptions = new CharErcOptions(
|
---|
35 | new IntegerConstantErc(' ', '\n'),
|
---|
36 | new IntegerRangeErc(0x20, 0x7e)),
|
---|
37 | StringErcOptions = new StringErcOptions(
|
---|
38 | new StringRandomErc {
|
---|
39 | IsEnabled = true,
|
---|
40 | AllowLowercaseLetters = true,
|
---|
41 | AllowUppercaseLetters = false,
|
---|
42 | AllowSpace = true,
|
---|
43 | SpaceProbability = 0.2
|
---|
44 | })
|
---|
45 | }
|
---|
46 | };
|
---|
47 | }
|
---|
48 |
|
---|
49 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
50 | return new Example {
|
---|
51 | InputArgs = input,
|
---|
52 | OutputArgs = output,
|
---|
53 | InputString = input,
|
---|
54 | OutputPrint = output[0],
|
---|
55 | OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[1]),
|
---|
56 | };
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|