Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Fixed VectorExpression errors, Fixed BenchmarkSuite Problem Data View issues

File size: 2.3 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 Checksum : BenchmarkSuiteDataDescriptor {
6    private const string name = "Checksum";
7    private const string fileName = "Checksum.csv";
8    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.";
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 1; } }
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 = char.MaxValue,
23        InputArgumentTypes = new[] { ExampleArgumentType.String },
24        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
25        TrainingCount = 100,
26        TestCount = 1000,
27        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
28        MaxSize = 800,
29        EvalLimit = 1500,
30        ErcOptions = {
31          ErcProbability = 0.05,
32          IntegerErcOptions = new IntegerErcOptions(
33            new IntegerConstantErcValue(64),
34            new IntegerRangeErcValue(-128, 128)),
35          CharErcOptions = new CharErcOptions(
36            new IntegerConstantErcValue(' '),
37            new IntegerRangeErcValue(0x20, 0x7e))
38        }
39      };
40    }
41
42    protected override Example ParseExample(string[] input, string[] output) {
43      return new Example {
44        InputArgs = input,
45        OutputArgs = output,
46        InputString = input,
47        OutputPrint = output[0],
48      };
49    }
50  }
51}
Note: See TracBrowser for help on using the repository browser.