1 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
4 | public class ReplaceSpaceWithNewline : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "Replace Space with Newline - Medium";
|
---|
6 | private const string fileName = "ReplaceSpaceWithNewline.csv";
|
---|
7 | 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.";
|
---|
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 2; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData(ProblemType.ReplaceSpaceWithNewline) {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | ProgramExecutionBudget = 30000000,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 5000,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.String },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print, ExampleArgumentType.Integer },
|
---|
25 | TrainingCount = 100,
|
---|
26 | TestCount = 1000,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
28 | MaxSize = 800,
|
---|
29 | EvalLimit = 1600,
|
---|
30 | ErcOptions = {
|
---|
31 | ErcProbability = 0.05,
|
---|
32 | CharErcOptions = new CharErcOptions(
|
---|
33 | new IntegerConstantErc(' ', '\n'),
|
---|
34 | new IntegerRangeErc(0x20, 0x7e)),
|
---|
35 | StringErcOptions = new StringErcOptions(
|
---|
36 | new StringRandomErc {
|
---|
37 | IsEnabled = true,
|
---|
38 | AllowLowercaseLetters = true,
|
---|
39 | AllowUppercaseLetters = false,
|
---|
40 | AllowSpace = true,
|
---|
41 | SpaceProbability = 0.2
|
---|
42 | })
|
---|
43 | }
|
---|
44 | };
|
---|
45 | }
|
---|
46 |
|
---|
47 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
48 | return new Example {
|
---|
49 | InputArgs = input,
|
---|
50 | OutputArgs = output,
|
---|
51 | InputString = input,
|
---|
52 | OutputPrint = output[0],
|
---|
53 | OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[1]),
|
---|
54 | };
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|