Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Dynamic ErcValues, Separate Push from BenchmarkSuite Push

File size: 2.9 KB
Line 
1namespace 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.IntegerVector;
5  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.String;
6
7  public class WordStats : BenchmarkSuiteDataDescriptor {
8    private const string name = "Word Stats";
9    private const string fileName = "WordStats.csv";
10    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.";
11
12    protected override string FileName { get { return fileName; } }
13    public override string Name { get { return name; } }
14    public override string Description { get { return description; } }
15    protected override int InputArgumentCount { get { return 1; } }
16    protected override int OutputArgumentCount { get { return 1; } }
17
18    public override ProblemData CreateProblemData() {
19      return new ProblemData {
20        Name = Name,
21        Description = Description,
22        Examples = CloneExamples(),
23        BestResult = 0,
24        WorstResult = 1000,
25        InputArgumentTypes = new[] { ExampleArgumentType.String },
26        OutputArgumentTypes = new[] { ExampleArgumentType.String },
27        TrainingCount = 100,
28        TestCount = 1000,
29        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.IntegerVector | DataTypes.FloatVector | DataTypes.StringVector | DataTypes.Print,
30        MaxSize = 1000,
31        EvalLimit = 6000,
32        ErcOptions = {
33          ErcProbability = 0.05,
34          IntegerErcOptions = new IntegerErcOptions(
35            new IntegerRangeErcValue(-100, 100)),
36          IntegerVectorErcOptions = new IntegerVectorErcOptions(
37            new IntegerVectorConstantsErcValue(new int[0])),
38          CharErcOptions = new CharErcOptions(
39            new IntegerConstantErcValue('.', '?', '!', ' ', '\t', '\r', ':')),
40          StringErcOptions = new StringErcOptions(
41            new StringConstantErcValue("words of length ", ": ", "number of sentences: ", "average sentence length: "))
42        }
43      };
44    }
45
46    protected override Example ParseExample(string[] input, string[] output) {
47      return new Example {
48        InputArgs = input,
49        OutputArgs = output,
50        InputString = input,
51        OutputPrint = output[0]
52      };
53    }
54  }
55}
Note: See TracBrowser for help on using the repository browser.