namespace HeuristicLab.BenchmarkSuite.Problems { using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.IntegerVector; public class ScrabbleScore : BenchmarkSuiteDataDescriptor { private const string name = "Scrabble Score - Hard"; private const string fileName = "ScrabbleScore.csv"; 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."; protected override string FileName { get { return fileName; } } public override string Name { get { return name; } } public override string Description { get { return description; } } protected override int InputArgumentCount { get { return 1; } } protected override int OutputArgumentCount { get { return 1; } } //vector containing Scrabble values (indexed by ASCII values) private static readonly int[] ScrabbleValues = { 1, // A 3, // B 3, // C 2, // D 1, // E 4, // F 2, // G 4, // H 1, // I 8, // J 5, // K 1, // L 3, // M 1, // N 1, // O 3, // P 10, // Q 1, // R 1, // S 1, // T 1, // U 4, // V 4, // W 8, // X 4, // Y 10, // Z }; public override ProblemData CreateProblemData() { return new ProblemData(ProblemType.ReplaceSpaceWithNewline) { Name = Name, Description = Description, ProgramExecutionBudget = 60000000, Examples = CloneExamples(), BestResult = 0, WorstResult = 1000, InputArgumentTypes = new[] { ExampleArgumentType.String }, OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, TrainingCount = 200, TestCount = 1000, EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.IntegerVector, MaxSize = 1000, EvalLimit = 2000, ErcOptions = { ErcProbability = 0.05, IntegerErcOptions = new IntegerErcOptions( new IntegerConstantErc(ScrabbleValues)), IntegerVectorErcOptions = new IntegerVectorErcOptions( new IntegerVectorConstantsErc(ScrabbleValues)) } }; } protected override Example ParseExample(string[] input, string[] output) { return new Example { InputArgs = input, OutputArgs = output, InputString = input, OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]) }; } } }