namespace HeuristicLab.BenchmarkSuite.Problems { using System; using System.Globalization; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Float; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; public class NumberIO : BenchmarkSuiteDataDescriptor { private const string name = "NumberIO - Easy"; private const string fileName = "NumberIO.csv"; private const string description = "Given an integer and a float, calc their sum."; 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.NumberIO) { Name = Name, FloatStringFormat = "N6", Description = Description, ProgramExecutionBudget = 5000000, Examples = CloneExamples(), BestResult = 0, WorstResult = 5000, InputArgumentTypes = new[] { ExampleArgumentType.Float, ExampleArgumentType.Integer }, OutputArgumentTypes = new[] { ExampleArgumentType.Print }, TrainingCount = 25, TestCount = 1000, EnabledDataTypes = DataTypes.Integer | DataTypes.Float | DataTypes.Print, EvalLimit = 200, MaxSize = 200, ErcOptions = { ErcProbability = 0.01, IntegerErcOptions = new IntegerErcOptions( new IntegerRangeErc(-100, 100)), FloatErcOptions = new FloatErcOptions( new FloatRangeErc(-100, 100)) } }; } protected override Example ParseExample(string[] input, string[] output) { var estimedFloatValue = double.Parse(output[0], CultureInfo.InvariantCulture); estimedFloatValue = Math.Round(estimedFloatValue, 6); return new Example { InputArgs = input, OutputArgs = output, InputFloat = ExampleArgumentConverter.ConvertDoubles(input[0]), InputInteger = ExampleArgumentConverter.ConvertIntegers(input[1]), OutputFloat = new[] { estimedFloatValue }, OutputPrint = estimedFloatValue.ToString("N6", CultureInfo.InvariantCulture), }; } } }