1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
|
---|
3 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
4 |
|
---|
5 | public class StringDifferences : BenchmarkSuiteDataDescriptor {
|
---|
6 | private const string name = "String Differences - Hard";
|
---|
7 | private const string fileName = "StringDifferences.csv";
|
---|
8 | 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";
|
---|
9 |
|
---|
10 | protected override string FileName { get { return fileName; } }
|
---|
11 | public override string Name { get { return name; } }
|
---|
12 | public override string Description { get { return description; } }
|
---|
13 | protected override int InputArgumentCount { get { return 2; } }
|
---|
14 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
15 |
|
---|
16 | public override ProblemData CreateProblemData() {
|
---|
17 | return new ProblemData(ProblemType.StringDifferences) {
|
---|
18 | Name = Name,
|
---|
19 | Description = Description,
|
---|
20 | ProgramExecutionBudget = 60000000,
|
---|
21 | Examples = CloneExamples(),
|
---|
22 | BestResult = 0,
|
---|
23 | WorstResult = 5000,
|
---|
24 | InputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.String },
|
---|
25 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
26 | TrainingCount = 200,
|
---|
27 | TestCount = 2000,
|
---|
28 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
29 | MaxSize = 1000,
|
---|
30 | EvalLimit = 2000,
|
---|
31 | ErcOptions = {
|
---|
32 | ErcProbability = 0.05,
|
---|
33 | CharErcOptions = new CharErcOptions(
|
---|
34 | new IntegerConstantErc(' ', '\n')),
|
---|
35 | IntegerErcOptions = new IntegerErcOptions(
|
---|
36 | new IntegerRangeErc(-10, 10))
|
---|
37 | }
|
---|
38 | };
|
---|
39 | }
|
---|
40 |
|
---|
41 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
42 | return new Example {
|
---|
43 | InputArgs = input,
|
---|
44 | OutputArgs = output,
|
---|
45 | InputString = input,
|
---|
46 | OutputPrint = output[0],
|
---|
47 | };
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }
|
---|