Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/BenchmarkSuite/Problems/Checksum.cs @ 15771

Last change on this file since 15771 was 15771, checked in by bburlacu, 6 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 2.4 KB
Line 
1using HeuristicLab.Problems.ProgramSynthesis;
2
3namespace HeuristicLab.BenchmarkSuite.Problems {
4  public class Checksum : BenchmarkSuiteDataDescriptor {
5    private const string name = "Checksum - Hard";
6    private const string fileName = "Checksum.csv";
7    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.";
8
9    protected override string FileName { get { return fileName; } }
10    public override string Name { get { return name; } }
11    public override string Description { get { return description; } }
12    protected override int InputArgumentCount { get { return 1; } }
13    protected override int OutputArgumentCount { get { return 1; } }
14
15    public override ProblemData CreateProblemData() {
16      return new ProblemData(ProblemType.Checksum) {
17        Name = Name,
18        Description = Description,
19        ProgramExecutionBudget = 30000000,
20        Examples = CloneExamples(),
21        BestResult = 0,
22        WorstResult = 1000,
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 IntegerConstantErc(64),
34            new IntegerRangeErc(-128, 128)),
35          CharErcOptions = new CharErcOptions(
36            new IntegerConstantErc(' '),
37            new IntegerRangeErc(0x20, 0x7e)),
38          StringErcOptions = new StringErcOptions(
39            new StringConstantErc("Check sum is "))
40        }
41      };
42    }
43
44    protected override Example ParseExample(string[] input, string[] output) {
45      return new Example {
46        InputArgs = input,
47        OutputArgs = output,
48        InputString = input,
49        OutputPrint = output[0],
50      };
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.