Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/BenchmarkSuite/Problems/NumberIo.cs @ 18183

Last change on this file since 18183 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 2.3 KB
Line 
1using System;
2using System.Globalization;
3using HeuristicLab.Problems.ProgramSynthesis;
4
5namespace HeuristicLab.BenchmarkSuite.Problems {
6  public class NumberIO : BenchmarkSuiteDataDescriptor {
7    private const string name = "NumberIO - Easy";
8    private const string fileName = "NumberIO.csv";
9    private const string description = "Given an integer and a float, calc their sum.";
10
11    protected override string FileName { get { return fileName; } }
12    public override string Name { get { return name; } }
13    public override string Description { get { return description; } }
14    protected override int InputArgumentCount { get { return 2; } }
15    protected override int OutputArgumentCount { get { return 1; } }
16
17    public override ProblemData CreateProblemData() {
18      return new ProblemData(ProblemType.NumberIO) {
19        Name = Name,
20        FloatStringFormat = "N6",
21        Description = Description,
22        ProgramExecutionBudget = 5000000,
23        Examples = CloneExamples(),
24        BestResult = 0,
25        WorstResult = 5000,
26        InputArgumentTypes = new[] { ExampleArgumentType.Float, ExampleArgumentType.Integer },
27        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
28        TrainingCount = 25,
29        TestCount = 1000,
30        EnabledDataTypes = DataTypes.Integer | DataTypes.Float | DataTypes.Print,
31        EvalLimit = 200,
32        MaxSize = 200,
33        ErcOptions = {
34          ErcProbability = 0.01,
35          IntegerErcOptions = new IntegerErcOptions(
36            new IntegerRangeErc(-100, 100)),
37          FloatErcOptions = new FloatErcOptions(
38            new FloatRangeErc(-100, 100))
39        }
40      };
41    }
42
43    protected override Example ParseExample(string[] input, string[] output) {
44      var estimedFloatValue = double.Parse(output[0], CultureInfo.InvariantCulture);
45      estimedFloatValue = Math.Round(estimedFloatValue, 6);
46
47      return new Example {
48        InputArgs = input,
49        OutputArgs = output,
50        InputFloat = ExampleArgumentConverter.ConvertDoubles(input[0]),
51        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[1]),
52        OutputFloat = new[] { estimedFloatValue },
53        OutputPrint = estimedFloatValue.ToString("N6", CultureInfo.InvariantCulture),
54      };
55    }
56  }
57}
58
Note: See TracBrowser for help on using the repository browser.