Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NumberIo.cs @ 15215

Last change on this file since 15215 was 15189, checked in by pkimmesw, 8 years ago

#2665 Fixed small issues, testet benchmark suite, added INX Expressions

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