Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs

File size: 3.0 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 - Hard";
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(ProblemType.WordStats) {
20        Name = Name,
21        Description = Description,
22        Examples = CloneExamples(),
23        BestResult = 0,
24        WorstResult = 1000,
25        InputArgumentTypes = new[] { ExampleArgumentType.String },
26        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
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 IntegerRangeErc(-100, 100)),
36          IntegerVectorErcOptions = new IntegerVectorErcOptions(
37            new IntegerVectorConstantsErc(new int[0])),
38          CharErcOptions = new CharErcOptions(
39            new IntegerConstantErc('.', '?', '!', ' ', '\t', '\n', ':')),
40          StringErcOptions = new StringErcOptions(
41            new StringConstantErc("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.