Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ScrabbleScore.cs @ 14952

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

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

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 {
48        Name = Name,
49        Description = Description,
50        Examples = CloneExamples(),
51        BestResult = 0,
52        WorstResult = 500,
53        InputArgumentTypes = new[] { ExampleArgumentType.String },
54        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
55        TrainingCount = 200,
56        TestCount = 1000,
57        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.IntegerVector,
58        MaxSize = 1000,
59        EvalLimit = 2000,
60        ErcOptions = {
61          ErcProbability = 0.05,
62          IntegerErcOptions = new IntegerErcOptions(
63            new IntegerConstantErc(ScrabbleValues)),
64          IntegerVectorErcOptions = new IntegerVectorErcOptions(
65            new IntegerVectorConstantsErc(ScrabbleValues))
66        }
67      };
68    }
69
70    protected override Example ParseExample(string[] input, string[] output) {
71      return new Example {
72        InputArgs = input,
73        OutputArgs = output,
74        InputString = input,
75        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0])
76      };
77    }
78  }
79}
Note: See TracBrowser for help on using the repository browser.