Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/StringDifferences.cs @ 14952

Last change on this file since 14952 was 14952, checked in by pkimmesw, 8 years ago

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

File size: 2.2 KB
Line 
1namespace 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 {
18        Name = Name,
19        Description = Description,
20        Examples = CloneExamples(),
21        BestResult = 0,
22        WorstResult = 100,
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}
Note: See TracBrowser for help on using the repository browser.