Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Fixed small issues, testet benchmark suite, added INX Expressions

File size: 2.5 KB
RevLine 
[14875]1namespace HeuristicLab.BenchmarkSuite.Problems {
[14897]2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
3  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
[15189]4  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.String;
[14897]5
[14875]6  public class Checksum : BenchmarkSuiteDataDescriptor {
[14952]7    private const string name = "Checksum - Hard";
[14875]8    private const string fileName = "Checksum.csv";
9    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.";
[14727]10
[14875]11    protected override string FileName { get { return fileName; } }
12    public override string Name { get { return name; } }
13    public override string Description { get { return description; } }
14    protected override int InputArgumentCount { get { return 1; } }
15    protected override int OutputArgumentCount { get { return 1; } }
[14744]16
[14875]17    public override ProblemData CreateProblemData() {
[15017]18      return new ProblemData(ProblemType.Checksum) {
[14875]19        Name = Name,
20        Description = Description,
21        Examples = CloneExamples(),
22        BestResult = 0,
23        WorstResult = char.MaxValue,
24        InputArgumentTypes = new[] { ExampleArgumentType.String },
[14909]25        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
[14875]26        TrainingCount = 100,
27        TestCount = 1000,
[14897]28        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
[14875]29        MaxSize = 800,
30        EvalLimit = 1500,
31        ErcOptions = {
32          ErcProbability = 0.05,
[14897]33          IntegerErcOptions = new IntegerErcOptions(
[14952]34            new IntegerConstantErc(64),
35            new IntegerRangeErc(-128, 128)),
[14897]36          CharErcOptions = new CharErcOptions(
[14952]37            new IntegerConstantErc(' '),
[15189]38            new IntegerRangeErc(0x20, 0x7e)),
39          StringErcOptions = new StringErcOptions(
40            new StringConstantErc("Check sum is "))
[14875]41        }
42      };
43    }
[14727]44
[14875]45    protected override Example ParseExample(string[] input, string[] output) {
46      return new Example {
47        InputArgs = input,
48        OutputArgs = output,
49        InputString = input,
[14897]50        OutputPrint = output[0],
[14875]51      };
52    }
53  }
54}
Note: See TracBrowser for help on using the repository browser.