Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/SmallOrLarge.cs @ 14952

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

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

File size: 2.0 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
3  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.String;
4
5  public class SmallOrLarge : BenchmarkSuiteDataDescriptor {
6    private const string name = "Small or Large - Hard";
7    private const string fileName = "SmallOrLarge.csv";
8    private const string description =
9      "Given an integer n, print “small” if n < 1000 and “large” if n ≥ 2000 (and nothing if 1000 ≤ n < 2000).";
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 1; } }
15    protected override int OutputArgumentCount { get { return 1; } }
16
17    public override ProblemData CreateProblemData() {
18      return new ProblemData {
19        Name = Name,
20        Description = Description,
21        Examples = CloneExamples(),
22        BestResult = 0,
23        WorstResult = 5,
24        InputArgumentTypes = new[] { ExampleArgumentType.Integer },
25        OutputArgumentTypes = new[] { ExampleArgumentType.String },
26        TrainingCount = 100,
27        TestCount = 1000,
28        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String | DataTypes.Print,
29        MaxSize = 200,
30        EvalLimit = 300,
31        ErcOptions = {
32          ErcProbability = 0.05,
33          IntegerErcOptions = new IntegerErcOptions(
34            new IntegerRangeErc(-10000, 10000)),
35          StringErcOptions = new StringErcOptions(
36            new StringConstantErc("small", "large"))
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[0]),
46        OutputString = output
47      };
48    }
49  }
50}
Note: See TracBrowser for help on using the repository browser.