[14875] | 1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
[14897] | 2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
|
---|
| 3 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
| 4 |
|
---|
[14875] | 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.";
|
---|
[14727] | 9 |
|
---|
[14875] | 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; } }
|
---|
[14744] | 15 |
|
---|
[14875] | 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 },
|
---|
[14909] | 24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
[14875] | 25 | TrainingCount = 100,
|
---|
| 26 | TestCount = 1000,
|
---|
[14897] | 27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
|
---|
[14875] | 28 | MaxSize = 800,
|
---|
| 29 | EvalLimit = 1500,
|
---|
| 30 | ErcOptions = {
|
---|
| 31 | ErcProbability = 0.05,
|
---|
[14897] | 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))
|
---|
[14875] | 38 | }
|
---|
| 39 | };
|
---|
| 40 | }
|
---|
[14727] | 41 |
|
---|
[14875] | 42 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
| 43 | return new Example {
|
---|
| 44 | InputArgs = input,
|
---|
| 45 | OutputArgs = output,
|
---|
| 46 | InputString = input,
|
---|
[14897] | 47 | OutputPrint = output[0],
|
---|
[14875] | 48 | };
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | }
|
---|