[14875] | 1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
[14897] | 2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
| 3 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.IntegerVector;
|
---|
[14875] | 4 |
|
---|
| 5 | public class ScrabbleScore : BenchmarkSuiteDataDescriptor {
|
---|
[14952] | 6 | private const string name = "Scrabble Score - Hard";
|
---|
[14875] | 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() {
|
---|
[15017] | 47 | return new ProblemData(ProblemType.ReplaceSpaceWithNewline) {
|
---|
[14875] | 48 | Name = Name,
|
---|
| 49 | Description = Description,
|
---|
[15334] | 50 | ProgramExecutionBudget = 60000000,
|
---|
[14875] | 51 | Examples = CloneExamples(),
|
---|
| 52 | BestResult = 0,
|
---|
[15334] | 53 | WorstResult = 1000,
|
---|
[14875] | 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,
|
---|
[14897] | 63 | IntegerErcOptions = new IntegerErcOptions(
|
---|
[14952] | 64 | new IntegerConstantErc(ScrabbleValues)),
|
---|
[14897] | 65 | IntegerVectorErcOptions = new IntegerVectorErcOptions(
|
---|
[14952] | 66 | new IntegerVectorConstantsErc(ScrabbleValues))
|
---|
[14875] | 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,
|
---|
[14909] | 76 | OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0])
|
---|
[14875] | 77 | };
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | }
|
---|