[14875] | 1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
[14897] | 2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
|
---|
| 3 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
[14875] | 4 |
|
---|
| 5 | public class StringDifferences : BenchmarkSuiteDataDescriptor {
|
---|
| 6 | private const string name = "String Differences";
|
---|
| 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 {
|
---|
| 18 | Name = Name,
|
---|
| 19 | Description = Description,
|
---|
| 20 | Examples = CloneExamples(),
|
---|
| 21 | BestResult = 0,
|
---|
| 22 | WorstResult = 100,
|
---|
| 23 | InputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.String },
|
---|
[14909] | 24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
[14875] | 25 | TrainingCount = 200,
|
---|
| 26 | TestCount = 2000,
|
---|
[14897] | 27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
[14875] | 28 | MaxSize = 1000,
|
---|
| 29 | EvalLimit = 2000,
|
---|
| 30 | ErcOptions = {
|
---|
| 31 | ErcProbability = 0.05,
|
---|
[14897] | 32 | CharErcOptions = new CharErcOptions(
|
---|
| 33 | new IntegerConstantErcValue(' ', '\r')),
|
---|
| 34 | IntegerErcOptions = new IntegerErcOptions(
|
---|
| 35 | new IntegerRangeErcValue(-10, 10))
|
---|
[14875] | 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,
|
---|
[14897] | 45 | OutputPrint = output[0],
|
---|
[14875] | 46 | };
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|