1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
3 |
|
---|
4 | public class LastIndexOfZero : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "Last Index of Zero - Hard";
|
---|
6 | private const string fileName = "LastIndexOfZero.csv";
|
---|
7 | private const string description = "Given a vector of integers, at least one of which is 0, return the index of the last occurrence of 0 in the vector.";
|
---|
8 |
|
---|
9 | protected override string FileName { get { return fileName; } }
|
---|
10 | public override string Name { get { return name; } }
|
---|
11 | public override string Description { get { return description; } }
|
---|
12 | protected override int InputArgumentCount { get { return 1; } }
|
---|
13 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | Examples = CloneExamples(),
|
---|
20 | BestResult = 0,
|
---|
21 | WorstResult = 50,
|
---|
22 | InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
|
---|
23 | OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
|
---|
24 | TrainingCount = 150,
|
---|
25 | TestCount = 1000,
|
---|
26 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
|
---|
27 | MaxSize = 300,
|
---|
28 | EvalLimit = 600,
|
---|
29 | ErcOptions = {
|
---|
30 | ErcProbability = 0.05,
|
---|
31 | IntegerErcOptions = new IntegerErcOptions(
|
---|
32 | new IntegerConstantErc(0),
|
---|
33 | new IntegerRangeErc(-50, 50))
|
---|
34 | }
|
---|
35 | };
|
---|
36 | }
|
---|
37 |
|
---|
38 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
39 | return new Example {
|
---|
40 | InputArgs = input,
|
---|
41 | OutputArgs = output,
|
---|
42 | InputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(input[0]) },
|
---|
43 | OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]),
|
---|
44 | };
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|