Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ReplaceSpaceWithNewline.cs @ 14875

Last change on this file since 14875 was 14875, checked in by pkimmesw, 8 years ago

#2665 BenchmarkSuite, all examples, partially tested, VectorExpressions added

File size: 2.3 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
3
4  public class ReplaceSpaceWithNewline : BenchmarkSuiteDataDescriptor {
5    private const string name = "Replace Space with Newline";
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 {
17        Name = Name,
18        Description = Description,
19        Examples = CloneExamples(),
20        BestResult = 0,
21        WorstResult = 20,
22        InputArgumentTypes = new[] { ExampleArgumentType.String },
23        OutputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.Integer },
24        TrainingCount = 100,
25        TestCount = 1000,
26        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
27        MaxSize = 800,
28        EvalLimit = 1600,
29        ErcOptions = {
30          ErcProbability = 0.05,
31          CharErcOptions = {
32            IsEnabled = true,
33            Constants = new [] { ' ', '\r' },
34            Start = 0x20,
35            End = 0x7e
36          },
37          StringErcOptions = {
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        OutputString = new[] { output[0] },
54        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[1]),
55      };
56    }
57  }
58}
Note: See TracBrowser for help on using the repository browser.