Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs @ 14875

Last change on this file since 14875 was 14875, checked in by pkimmesw, 7 years ago

#2665 BenchmarkSuite, all examples, partially tested, VectorExpressions added

File size: 2.2 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  public class Checksum : BenchmarkSuiteDataDescriptor {
3    private const string name = "Checksum";
4    private const string fileName = "Checksum.csv";
5    private const string description = "Given a string, convert each character in the string into its integer ASCII value, sum them, take the sum modulo 64, add the integer value of the space character, and then convert that integer back into its corresponding character(the checksum character). The program must print Check sum is X, where X is replaced by the correct checksum character.";
6
7    protected override string FileName { get { return fileName; } }
8    public override string Name { get { return name; } }
9    public override string Description { get { return description; } }
10    protected override int InputArgumentCount { get { return 1; } }
11    protected override int OutputArgumentCount { get { return 1; } }
12
13    public override ProblemData CreateProblemData() {
14      return new ProblemData {
15        Name = Name,
16        Description = Description,
17        Examples = CloneExamples(),
18        BestResult = 0,
19        WorstResult = char.MaxValue,
20        InputArgumentTypes = new[] { ExampleArgumentType.String },
21        OutputArgumentTypes = new[] { ExampleArgumentType.Char },
22        TrainingCount = 100,
23        TestCount = 1000,
24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
25        MaxSize = 800,
26        EvalLimit = 1500,
27        ErcOptions = {
28          ErcProbability = 0.05,
29          IntegerErcOptions = {
30            IsEnabled = true,
31            Constants = new [] { 64 },
32            Start = -128,
33            End = 128
34          },
35          CharErcOptions = {
36            IsEnabled = true,
37            Constants = new [] { ' ' },
38            Start = 0x20,
39            End = 0x7e
40          }
41        }
42      };
43    }
44
45    protected override Example ParseExample(string[] input, string[] output) {
46      return new Example {
47        InputArgs = input,
48        OutputArgs = output,
49        InputString = input,
50        OutputChar = output[0].ToCharArray(),
51      };
52    }
53  }
54}
Note: See TracBrowser for help on using the repository browser.