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