Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ScrabbleScore.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.7 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
6  public class ScrabbleScore : BenchmarkSuiteDataDescriptor {
7    private const string name = "Scrabble Score";
8    private const string fileName = "ScrabbleScore.csv";
9    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.";
10
11    protected override string FileName { get { return fileName; } }
12    public override string Name { get { return name; } }
13    public override string Description { get { return description; } }
14    protected override int InputArgumentCount { get { return 1; } }
15    protected override int OutputArgumentCount { get { return 1; } }
16
17    //vector containing Scrabble values (indexed by ASCII values)
18    private static readonly int[] ScrabbleValues = {
19      1, // A
20      3, // B
21      3, // C
22      2, // D
23      1, // E
24      4, // F
25      2, // G
26      4, // H
27      1, // I
28      8, // J
29      5, // K
30      1, // L
31      3, // M
32      1, // N
33      1, // O
34      3, // P
35     10, // Q
36      1, // R
37      1, // S
38      1, // T
39      1, // U
40      4, // V
41      4, // W
42      8, // X
43      4, // Y
44     10, // Z
45    };
46
47    public override ProblemData CreateProblemData() {
48      return new ProblemData {
49        Name = Name,
50        Description = Description,
51        Examples = CloneExamples(),
52        BestResult = 0,
53        WorstResult = 500,
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 IntegerConstantErcValue(ScrabbleValues)),
65          IntegerVectorErcOptions = new IntegerVectorErcOptions(
66            new IntegerVectorConstantsErcValue(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        OutputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(output[0]) }
77      };
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.