namespace HeuristicLab.BenchmarkSuite.Problems { using System.Linq; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; public class XWordLines : BenchmarkSuiteDataDescriptor { private const string name = "X-Word Lines - Hard"; private const string fileName = "XWordLines.csv"; private const string description = "Given an integer X and a string that can contains spaces and newlines, print the string with exactly X words per line. The last line may have fewer than X words."; 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 2; } } protected override int OutputArgumentCount { get { return 1; } } public override ProblemData CreateProblemData() { return new ProblemData(ProblemType.XWordLines) { Name = Name, Description = Description, ProgramExecutionBudget = 45000000, Examples = CloneExamples(), BestResult = 0, WorstResult = 5000, InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.String }, OutputArgumentTypes = new[] { ExampleArgumentType.Print }, TrainingCount = 150, TestCount = 2000, EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print, MaxSize = 800, EvalLimit = 1600, ErcOptions = { ErcProbability = 0.05, CharErcOptions = new CharErcOptions( new IntegerConstantErc(' ', '\n')), } }; } protected override Example ParseExample(string[] input, string[] output) { return new Example { InputArgs = input, OutputArgs = output, InputInteger = ExampleArgumentConverter.ConvertIntegers(input[1]), InputString = new[] { input[0] }, OutputPrint = output[0], // Helper OutputInteger = new[] { input[0].Split(' ', '\n').LongCount(x => !string.IsNullOrWhiteSpace(x)) } }; } } }