1 | namespace 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(ProblemType.SmallOrLarge) {
|
---|
19 | Name = Name,
|
---|
20 | Description = Description,
|
---|
21 | ProgramExecutionBudget = 30000000,
|
---|
22 | Examples = CloneExamples(),
|
---|
23 | BestResult = 0,
|
---|
24 | WorstResult = 5000,
|
---|
25 | InputArgumentTypes = new[] { ExampleArgumentType.Integer },
|
---|
26 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
27 | TrainingCount = 100,
|
---|
28 | TestCount = 1000,
|
---|
29 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String | DataTypes.Print,
|
---|
30 | MaxSize = 200,
|
---|
31 | EvalLimit = 300,
|
---|
32 | ErcOptions = {
|
---|
33 | ErcProbability = 0.05,
|
---|
34 | IntegerErcOptions = new IntegerErcOptions(
|
---|
35 | new IntegerRangeErc(-10000, 10000)),
|
---|
36 | StringErcOptions = new StringErcOptions(
|
---|
37 | new StringConstantErc("small", "large"))
|
---|
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[0]),
|
---|
47 | OutputPrint = output[0]
|
---|
48 | };
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|