Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NumberIo.cs @ 17460

Last change on this file since 17460 was 15344, checked in by pkimmesw, 7 years ago

#2665 Fixed Integer Overflow Exceptions, Adjusted Offspring Selection Experiments

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