Free cookie consent management tool by TermsFeed Policy Generator

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

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

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

File size: 2.7 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  public class WordStats : BenchmarkSuiteDataDescriptor {
3    private const string name = "Word Stats";
4    private const string fileName = "WordStats.csv";
5    private const string description = "Given a string, print the number of words containing n characters for n from 1 to the length of the longest word. At the end of the output, print a line that gives the number of sentences and line that gives the average sentence length. A word is any string of consecutive non-whitespace characters(including sentence terminators). Every string will contain at least one sentence terminator(period, exclamation point, or question mark). The average sentence length is the number of words in the file divided by the number of sentence terminator characters.";
6
7    protected override string FileName { get { return fileName; } }
8    public override string Name { get { return name; } }
9    public override string Description { get { return description; } }
10    protected override int InputArgumentCount { get { return 1; } }
11    protected override int OutputArgumentCount { get { return 1; } }
12
13    public override ProblemData CreateProblemData() {
14      return new ProblemData {
15        Name = Name,
16        Description = Description,
17        Examples = CloneExamples(),
18        BestResult = 0,
19        WorstResult = 1000,
20        InputArgumentTypes = new[] { ExampleArgumentType.String },
21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
22        TrainingCount = 100,
23        TestCount = 1000,
24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.IntegerVector | DataTypes.FloatVector | DataTypes.StringVector,
25        MaxSize = 1000,
26        EvalLimit = 6000,
27        ErcOptions = {
28          ErcProbability = 0.05,
29          IntegerErcOptions = {
30            IsEnabled = true,
31            Start = 100,
32            End = 100
33          },
34          IntegerVectorErcOptions = {
35            IsEnabled = true,
36            Constants = new [] { new int[0] }
37          },
38          CharErcOptions = {
39            IsEnabled = true,
40            Constants = new [] { '.', '?', '!', ' ', '\t', '\r', ':' }
41          },
42          StringErcOptions = {
43            IsEnabled = true,
44            Constants = new [] { "words of length ", ": ", "number of sentences: ", "average sentence length: " }
45          }
46        }
47      };
48    }
49
50    protected override Example ParseExample(string[] input, string[] output) {
51      return new Example {
52        InputArgs = input,
53        OutputArgs = output,
54        InputString = input,
55        OutputString = output,
56      };
57    }
58  }
59}
Note: See TracBrowser for help on using the repository browser.