1 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
4 | public class StringDifferences : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "String Differences - Hard";
|
---|
6 | private const string fileName = "StringDifferences.csv";
|
---|
7 | private const string description = "Given 2 strings (without whitespace) as input, find the indices at which the strings have different characters, stopping at the end of the shorter one. For each such index, print a line containing the index as well as the character in each string. For example, if the strings are “dealer” and “dollars”, the program should print: 1 e o, 2 a l, 4 e a";
|
---|
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 2; } }
|
---|
13 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData(ProblemType.StringDifferences) {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | ProgramExecutionBudget = 60000000,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 5000,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.String },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
25 | TrainingCount = 200,
|
---|
26 | TestCount = 2000,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
28 | MaxSize = 1000,
|
---|
29 | EvalLimit = 2000,
|
---|
30 | ErcOptions = {
|
---|
31 | ErcProbability = 0.05,
|
---|
32 | CharErcOptions = new CharErcOptions(
|
---|
33 | new IntegerConstantErc(' ', '\n')),
|
---|
34 | IntegerErcOptions = new IntegerErcOptions(
|
---|
35 | new IntegerRangeErc(-10, 10))
|
---|
36 | }
|
---|
37 | };
|
---|
38 | }
|
---|
39 |
|
---|
40 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
41 | return new Example {
|
---|
42 | InputArgs = input,
|
---|
43 | OutputArgs = output,
|
---|
44 | InputString = input,
|
---|
45 | OutputPrint = output[0],
|
---|
46 | };
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|