Changeset 14875 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs
- Timestamp:
- 04/18/17 01:15:25 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs
r14777 r14875 1 //namespace HeuristicLab.BenchmarkSuite.Problems { 2 // using System; 3 // using System.Text; 1 namespace 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."; 4 6 5 // public class Checksum : BenchmarkSuiteDataDescriptor { 6 // private const string name = "Checksum"; 7 // private const string fileName = "Checksum.csv"; 8 // private const string description = ""; 9 // private readonly ExampleArgumentType[] inputArgumentTypes = { ExampleArgumentType.IntegerCollection }; 10 // private readonly ExampleArgumentType[] outputArgumentTypes = { ExampleArgumentType.IntegerCollection }; 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; } } 11 12 12 // public override string Name { get { return name; } } 13 // protected override string FileName { get { return fileName; } } 14 // public override string Description { get { return description; } } 15 // public override ExampleArgumentType[] InputArgumentTypes { get { return inputArgumentTypes; } } 16 // public override ExampleArgumentType[] OutputArgumentTypes { get { return outputArgumentTypes; } } 17 // public override int OriginalTrainingCount { get { return 228; } } 18 // public override int OriginalTestCount { get { return 1254; } } 19 // public override int BestResult { get { return 0; } } 20 // public override int WorstResult { get { return byte.MaxValue; } } 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 } 21 44 22 // publicoverride Example ParseExample(string[] input, string[] output) {23 //return new Example {24 //InputArgs = input,25 //OutputArgs = output,26 // InputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(input[0]), c => (long)c),27 // OutputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(output[0]), c => (long)c) 28 //};29 //}30 //}31 //}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 TracChangeset
for help on using the changeset viewer.