1 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
4 | public class WallisPi : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "Wallis Pi - Hard";
|
---|
6 | private const string fileName = "WallisPi.csv";
|
---|
7 | 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.";
|
---|
8 |
|
---|
9 | protected override string FileName { get { return fileName; } }
|
---|
10 | public override string Name { get { return name; } }
|
---|
11 | public override string Description { get { return description; } }
|
---|
12 | protected override int InputArgumentCount { get { return 1; } }
|
---|
13 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData(ProblemType.WallisPi) {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | ProgramExecutionBudget = 45000000,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 1000000,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.Integer },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Float },
|
---|
25 | TrainingCount = 150,
|
---|
26 | TestCount = 50,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.Boolean,
|
---|
28 | MaxSize = 600,
|
---|
29 | EvalLimit = 8000,
|
---|
30 | FloatStringFormat = "N5",
|
---|
31 | ErcOptions = {
|
---|
32 | ErcProbability = 0.05,
|
---|
33 | FloatErcOptions = new FloatErcOptions(
|
---|
34 | new FloatRangeErc(-500, 500)),
|
---|
35 | IntegerErcOptions = new IntegerErcOptions(
|
---|
36 | new IntegerRangeErc(-500, 500))
|
---|
37 | }
|
---|
38 | };
|
---|
39 | }
|
---|
40 |
|
---|
41 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
42 | return new Example {
|
---|
43 | InputArgs = input,
|
---|
44 | OutputArgs = output,
|
---|
45 | InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
|
---|
46 | OutputFloat = ExampleArgumentConverter.ConvertDoubles(output),
|
---|
47 | OutputFloatPrecision = 5
|
---|
48 | };
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|