Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ScrabbleScore.cs @ 16101

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

#2665 Testet Problems, Improved Performance

File size: 2.7 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
3  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.IntegerVector;
4
5  public class ScrabbleScore : BenchmarkSuiteDataDescriptor {
6    private const string name = "Scrabble Score - Hard";
7    private const string fileName = "ScrabbleScore.csv";
8    private const string description = "Given a string of visible ASCII characters, return the Scrabble score for that string. Each letter has a corresponding value according to normal Scrabble rules, and non-letter characters are worth zero.";
9
10    protected override string FileName { get { return fileName; } }
11    public override string Name { get { return name; } }
12    public override string Description { get { return description; } }
13    protected override int InputArgumentCount { get { return 1; } }
14    protected override int OutputArgumentCount { get { return 1; } }
15
16    //vector containing Scrabble values (indexed by ASCII values)
17    private static readonly int[] ScrabbleValues = {
18      1, // A
19      3, // B
20      3, // C
21      2, // D
22      1, // E
23      4, // F
24      2, // G
25      4, // H
26      1, // I
27      8, // J
28      5, // K
29      1, // L
30      3, // M
31      1, // N
32      1, // O
33      3, // P
34     10, // Q
35      1, // R
36      1, // S
37      1, // T
38      1, // U
39      4, // V
40      4, // W
41      8, // X
42      4, // Y
43     10, // Z
44    };
45
46    public override ProblemData CreateProblemData() {
47      return new ProblemData(ProblemType.ScrabbleScore) {
48        Name = Name,
49        Description = Description,
50        ProgramExecutionBudget = 60000000,
51        Examples = CloneExamples(),
52        BestResult = 0,
53        WorstResult = 1000,
54        InputArgumentTypes = new[] { ExampleArgumentType.String },
55        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
56        TrainingCount = 200,
57        TestCount = 1000,
58        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.IntegerVector,
59        MaxSize = 1000,
60        EvalLimit = 2000,
61        ErcOptions = {
62          ErcProbability = 0.05,
63          IntegerErcOptions = new IntegerErcOptions(
64            new IntegerConstantErc(ScrabbleValues)),
65          IntegerVectorErcOptions = new IntegerVectorErcOptions(
66            new IntegerVectorConstantsErc(ScrabbleValues))
67        }
68      };
69    }
70
71    protected override Example ParseExample(string[] input, string[] output) {
72      return new Example {
73        InputArgs = input,
74        OutputArgs = output,
75        InputString = input,
76        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0])
77      };
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.