using HeuristicLab.Problems.ProgramSynthesis; namespace HeuristicLab.BenchmarkSuite.Problems { public class WallisPi : BenchmarkSuiteDataDescriptor { private const string name = "Wallis Pi - Hard"; private const string fileName = "WallisPi.csv"; private const string description = " John Wallis gave a infinite product that converges to π/4. Given an integer input n, compute an approximation of this product out to n terms. Results are rounded to 5 decimal places."; 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; } } public override ProblemData CreateProblemData() { return new ProblemData(ProblemType.WallisPi) { Name = Name, Description = Description, ProgramExecutionBudget = 45000000, Examples = CloneExamples(), BestResult = 0, WorstResult = 1000000, InputArgumentTypes = new[] { ExampleArgumentType.Integer }, OutputArgumentTypes = new[] { ExampleArgumentType.Float }, TrainingCount = 150, TestCount = 50, EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.Boolean, MaxSize = 600, EvalLimit = 8000, FloatStringFormat = "N5", ErcOptions = { ErcProbability = 0.05, FloatErcOptions = new FloatErcOptions( new FloatRangeErc(-500, 500)), IntegerErcOptions = new IntegerErcOptions( new IntegerRangeErc(-500, 500)) } }; } protected override Example ParseExample(string[] input, string[] output) { return new Example { InputArgs = input, OutputArgs = output, InputInteger = ExampleArgumentConverter.ConvertIntegers(input), OutputFloat = ExampleArgumentConverter.ConvertDoubles(output), OutputFloatPrecision = 5 }; } } }