Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/17 01:15:25 (7 years ago)
Author:
pkimmesw
Message:

#2665 BenchmarkSuite, all examples, partially tested, VectorExpressions added

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems
Files:
15 added
1 deleted
15 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;
     1namespace 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.";
    46
    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; } }
    1112
    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    }
    2144
    22 //    public override 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}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CollatzNumbers.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
    32
    4 //  public class CollatzNumbers : BenchmarkSuiteDataDescriptor<long[], long[]> {
    5 //    private const string displayMame = "Collatz Numbers";
    6 //    private const string description = "";
    73
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
    10 //    protected override int InputArgumentCount { get { return 1; } }
    11 //    protected override int OutputArgumentCount { get { return 1; } }
     4  public class CollatzNumbers : BenchmarkSuiteDataDescriptor {
     5    private const string name = "Collatz Numbers";
     6    private const string fileName = "CollatzNumbers.csv";
     7    private const string description = "Given an integer, find the number of terms in the Collatz(hailstone) sequence starting from that integer.";
    128
    13 //    public override long[] ConvertInput(string[] input) {
    14 //      return Array.ConvertAll(input, ConvertInteger);
    15 //    }
     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; } }
    1614
    17 //    public override long[] ConvertOutput(string[] output) {
    18 //      return Array.ConvertAll(output, ConvertInteger);
    19 //    }
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
     17        Name = Name,
     18        Description = Description,
     19        Examples = CloneExamples(),
     20        BestResult = 0,
     21        WorstResult = 300,
     22        InputArgumentTypes = new[] { ExampleArgumentType.Integer },
     23        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
     24        TrainingCount = 200,
     25        TestCount = 2000,
     26        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.Boolean,
     27        MaxSize = 600,
     28        EvalLimit = 15000,
     29        ErcOptions = {
     30          ErcProbability = 0.05,
     31          IntegerErcOptions = {
     32            IsEnabled = true,
     33            Constants = new [] { 0, 1 },
     34            Start = -100,
     35            End = 100
     36          }
     37        }
     38      };
     39    }
    2040
    21 //    public override Data CreateData() {
    22 //      var input = this.GetInput();
    23 //      var output = this.GetOutput();
    24 
    25 //      return new Data(0, double.MaxValue, 0, 0,
    26 //        inputInt: input,
    27 //        outputInt: output);
    28 //    }
    29 //  }
    30 //}
     41    protected override Example ParseExample(string[] input, string[] output) {
     42      return new Example {
     43        InputArgs = input,
     44        OutputArgs = output,
     45        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[0]),
     46        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]),
     47      };
     48    }
     49  }
     50}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CountOdds.cs

    r14834 r14875  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
    23
    34  public class CountOdds : BenchmarkSuiteDataDescriptor {
    45    private const string name = "Count Odds";
    56    private const string fileName = "CountOdds.csv";
    6     private const string description = "";
     7    private const string description = "Given a vector of integers, return the number of integers that are odd, without use of a specific even or odd instruction(but allowing instructions such as mod and quotient)";
    78
    89    protected override string FileName { get { return fileName; } }
     
    1213    protected override int OutputArgumentCount { get { return 1; } }
    1314
    14     public override Data CreateProblemData() {
    15       return new Data {
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
    1617        Name = Name,
    1718        Description = Description,
     
    1920        BestResult = 0,
    2021        WorstResult = 50,
    21         InputArgumentTypes = new[] { ExampleArgumentType.IntegerCollection },
     22        InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
    2223        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
    23         OriginalTestCount = 2000,
    24         OriginalTrainingCount = 200,
     24        TestCount = 2000,
     25        TrainingCount = 200,
    2526        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     27        MaxSize = 500,
    2628        EvalLimit = 1500,
    27         MaxSize = 500,
     29        ErcOptions = {
     30          ErcProbability = 0.05,
     31          IntegerErcOptions = {
     32            IsEnabled = true,
     33            Constants = new [] { 0, 1, 2},
     34            Start = -1000,
     35            End = 1000
     36          }
     37        }
    2838      };
    2939    }
     
    3343        InputArgs = input,
    3444        OutputArgs = output,
    35         InputInt = ExampleArgumentConverter.ConvertIntegers(input[0]),
    36         OutputInt = ExampleArgumentConverter.ConvertIntegers(output[0])
     45        InputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(input[0]) },
     46        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0])
    3747      };
    3848    }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Digits.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class Digits : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Digits";
     4    private const string fileName = "Digits.csv";
     5    private const string description = "Given an integer, print that integer’s digits each on their own line starting with the least significant digit.A negative integer should have the negative sign printed before the most significant digit.";
    36
    4 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     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; } }
    512
    6 //  public class Digits : BenchmarkSuiteDataDescriptor<long, long[]> {
    7 //    private const string displayMame = "Digits";
    8 //    private const string description = "";
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 20,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 100,
     23        TestCount = 1000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
     25        MaxSize = 300,
     26        EvalLimit = 600,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          IntegerErcOptions = {
     30            IsEnabled = true,
     31            Start = -10,
     32            End = 10
     33          },
     34          CharErcOptions = {
     35            IsEnabled = true,
     36            Constants = new [] { '\r' },
     37          }
     38        }
     39      };
     40    }
    941
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
    12 
    13 //    protected override int InputArgumentCount { get { return 1; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
    15 
    16 //    public override long ConvertInput(string[] input) {
    17 //      return ConvertInteger(input[0]);
    18 //    }
    19 
    20 //    public override long[] ConvertOutput(string[] output) {
    21 //      return SplitByNewLine(output[0])
    22 //        .Select(ConvertInteger)
    23 //        .ToArray();
    24 //    }
    25 //  }
    26 //}
     42    protected override Example ParseExample(string[] input, string[] output) {
     43      return new Example {
     44        InputArgs = input,
     45        OutputArgs = output,
     46        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[0]),
     47        OutputString = output,
     48      };
     49    }
     50  }
     51}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/DoubleLetters.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
    33
    4 //  public class DoubleLetters : BenchmarkSuiteDataDescriptor<string, string> {
    5 //    private const string displayMame = "Double Letters";
    6 //    private const string description = "";
     4  public class DoubleLetters : BenchmarkSuiteDataDescriptor {
     5    private const string name = "Double Letters";
     6    private const string fileName = "DoubleLetters.csv";
     7    private const string description = "Given a string, print the string, doubling every letter character, and tripling every exclamation point.All other non-alphabetic and non-exclamation characters should be printed a single time each";
    78
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
    10 //    protected override int InputArgumentCount { get { return 1; } }
    11 //    protected override int OutputArgumentCount { get { return 1; } }
     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; } }
    1214
    13 //    public override string ConvertInput(string[] input) {
    14 //      return input[0];
    15 //    }
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
     17        Name = Name,
     18        Description = Description,
     19        Examples = CloneExamples(),
     20        BestResult = 0,
     21        WorstResult = 100,
     22        InputArgumentTypes = new[] { ExampleArgumentType.String },
     23        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     24        TrainingCount = 100,
     25        TestCount = 1000,
     26        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String | DataTypes.Char,
     27        MaxSize = 800,
     28        EvalLimit = 1600,
     29        ErcOptions = {
     30          ErcProbability = 0.02,
     31          CharErcOptions = {
     32            IsEnabled = true,
     33            Constants = new [] { '!' }
     34          }
     35        }
     36      };
     37    }
    1638
    17 //    public override string ConvertOutput(string[] output) {
    18 //      return output[0];
    19 //    }
    20 
    21 //    public override IPushData CreatePushData(Example<string, string>[] training, Example<string, string>[] test) {
    22 //      return new DoubleLettersPushData(training, test);
    23 //    }
    24 //  }
    25 //}
     39    protected override Example ParseExample(string[] input, string[] output) {
     40      return new Example {
     41        InputArgs = input,
     42        OutputArgs = output,
     43        InputString = input,
     44        OutputString = output,
     45      };
     46    }
     47  }
     48}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/EvenSquares.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class EvenSquares : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Even Sqaures";
     4    private const string fileName = "EvenSquares.csv";
     5    private const string description = " Given an integer n, print all of the positive even perfect squares less than n on separate lines.";
    36
    4 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     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; } }
    512
    6 //  public class EvenSquares : BenchmarkSuiteDataDescriptor<long, long[]> {
    7 //    private const string displayMame = "Even Squares";
    8 //    private const string description = "";
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 400,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 100,
     23        TestCount = 1000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean,
     25        MaxSize = 400,
     26        EvalLimit = 2000,
     27      };
     28    }
    929
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
    12 
    13 //    protected override int InputArgumentCount { get { return 1; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
    15 
    16 //    public override long ConvertInput(string[] input) {
    17 //      return ConvertInteger(input[0]);
    18 //    }
    19 
    20 //    public override long[] ConvertOutput(string[] output) {
    21 //      return SplitByNewLine(output[0])
    22 //        .Select(ConvertInteger)
    23 //        .ToArray();
    24 //    }
    25 
    26 //    public override IPushData CreatePushData(Example<long, long[]>[] training, Example<long, long[]>[] test) {
    27 //      return new EvenSquaresPushData(training, test);
    28 //    }
    29 //  }
    30 //}
     30    protected override Example ParseExample(string[] input, string[] output) {
     31      return new Example {
     32        InputArgs = input,
     33        OutputArgs = output,
     34        InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
     35        OutputString = output,
     36      };
     37    }
     38  }
     39}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ForLoopIndex.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class ForLoopIndex : BenchmarkSuiteDataDescriptor {
     3    private const string name = "For Loop Index";
     4    private const string fileName = "ForLoopIndex.csv";
     5    private const string description = "Given 3 integer inputs start,end, and step, print the integers in the sequence n|0 = start, n|i = n|i−1 + step for each n|i < end, each on their own line.";
    36
    4 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     7    protected override string FileName { get { return fileName; } }
    58
    6 //  public class ForLoopIndex : BenchmarkSuiteDataDescriptor<long[], long[]> {
    7 //    private const string displayMame = "For Loop Index";
    8 //    private const string description = "";
     9    public override string Name { get { return name; } }
    910
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
     11    public override string Description { get { return description; } }
    1212
    13 //    protected override int InputArgumentCount { get { return 3; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
     13    protected override int InputArgumentCount { get { return 3; } }
    1514
    16 //    public override long[] ConvertInput(string[] input) {
    17 //      return input.Select(ConvertInteger).ToArray();
    18 //    }
     15    protected override int OutputArgumentCount { get { return 1; } }
    1916
    20 //    public override long[] ConvertOutput(string[] output) {
    21 //      return SplitByNewLine(output[0])
    22 //        .Select(ConvertInteger)
    23 //        .ToArray();
    24 //    }
     17    public override ProblemData CreateProblemData() {
     18      return new ProblemData {
     19        Name = Name,
     20        Description = Description,
     21        Examples = CloneExamples(),
     22        BestResult = 0,
     23        WorstResult = 1000,
     24        InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer },
     25        OutputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
     26        TrainingCount = 100,
     27        TestCount = 1000,
     28        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     29        MaxSize = 300,
     30        EvalLimit = 600,
     31      };
     32    }
    2533
    26 //    public override IPushData CreatePushData(Example<long[], long[]>[] training, Example<long[], long[]>[] test) {
    27 //      return new ForLoopIndexPushData(training, test);
    28 //    }
    29 //  }
    30 //}
     34    protected override Example ParseExample(string[] input, string[] output) {
     35      return new Example {
     36        InputArgs = input,
     37        OutputArgs = output,
     38        InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
     39        OutputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(output[0]) }
     40      };
     41    }
     42  }
     43}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Grades.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
    3 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class Grades : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Grades";
     4    private const string fileName = "Grades.csv";
     5    private const string description = "Given 5 integers, the first four represent the lower numeric thresholds for achieving an A, B, C, and D, and will be distinct and in descending order.The fifth represents the student’s numeric grade.The program must print Student has a X grade., where X is A, B, C, D, or F depending on the thresholds and the numeric grade.";
    46
    5 //  public class Grades : BenchmarkSuiteDataDescriptor<long[], string> {
    6 //    private const string displayMame = "Checksum";
    7 //    private const string description = "";
     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 5; } }
     11    protected override int OutputArgumentCount { get { return 1; } }
    812
    9 //    public override string Name { get { return displayMame; } }
    10 //    public override string Description { get { return description; } }
    11 //    protected override int InputArgumentCount { get { return 5; } }
    12 //    protected override int OutputArgumentCount { get { return 1; } }
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 25,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 200,
     23        TestCount = 2000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String,
     25        MaxSize = 400,
     26        EvalLimit = 800,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          IntegerErcOptions = {
     30            IsEnabled = true,
     31            Start = 0,
     32            End = 100
     33          },
     34          StringErcOptions = {
     35            IsEnabled = true,
     36            Constants = new [] { "Student has a ", " grade", "A", "B", "C", "D", "F" },
     37          }
     38        }
     39      };
     40    }
    1341
    14 //    public override long[] ConvertInput(string[] input) {
    15 //      return input.Select(ConvertInteger).ToArray();
    16 //    }
    17 
    18 //    public override string ConvertOutput(string[] output) {
    19 //      return output[0];
    20 //    }
    21 
    22 //    public override IPushData CreatePushData(Example<long[], string>[] training, Example<long[], string>[] test) {
    23 //      return new GradePushData(training, test);
    24 //    }
    25 //  }
    26 //}
     42    protected override Example ParseExample(string[] input, string[] output) {
     43      return new Example {
     44        InputArgs = input,
     45        OutputArgs = output,
     46        InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
     47        OutputString = output,
     48      };
     49    }
     50  }
     51}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/LastIndexOfZero.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
    33
    4 //  public class LastIndexOfZero : BenchmarkSuiteDataDescriptor<long[], long> {
    5 //    private const string displayMame = "Last Index of Zero";
    6 //    private const string description = "";
     4  public class LastIndexOfZero : BenchmarkSuiteDataDescriptor {
     5    private const string name = "Last Index of Zero";
     6    private const string fileName = "LastIndexOfZero.csv";
     7    private const string description = "Given a vector of integers, at least one of which is 0, return the index of the last occurrence of 0 in the vector.";
    78
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
     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; } }
    1014
    11 //    protected override int InputArgumentCount { get { return 1; } }
    12 //    protected override int OutputArgumentCount { get { return 1; } }
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
     17        Name = Name,
     18        Description = Description,
     19        Examples = CloneExamples(),
     20        BestResult = 0,
     21        WorstResult = 50,
     22        InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
     23        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
     24        TrainingCount = 150,
     25        TestCount = 1000,
     26        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     27        MaxSize = 300,
     28        EvalLimit = 600,
     29        ErcOptions = {
     30          ErcProbability = 0.05,
     31          IntegerErcOptions = {
     32            IsEnabled = true,
     33            Constants = new [] { 0 },
     34            Start = -50,
     35            End = 50
     36          }
     37        }
     38      };
     39    }
    1340
    14 //    public override long[] ConvertInput(string[] input) {
    15 //      return ConvertIntegers(input[0]);
    16 //    }
    17 
    18 //    public override long ConvertOutput(string[] output) {
    19 //      return ConvertInteger(output[0]);
    20 //    }
    21 
    22 //    public override IPushData CreatePushData(Example<long[], long>[] training, Example<long[], long>[] test) {
    23 //      return new LastIndexOfZeroPushData(training, test);
    24 //    }
    25 //  }
    26 //}
     41    protected override Example ParseExample(string[] input, string[] output) {
     42      return new Example {
     43        InputArgs = input,
     44        OutputArgs = output,
     45        InputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(input[0]) },
     46        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]),
     47      };
     48    }
     49  }
     50}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Median.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class Median : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Median";
     4    private const string fileName = "Median.csv";
     5    private const string description = "Given 3 integers, print their median.";
    36
    4 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     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 3; } }
     11    protected override int OutputArgumentCount { get { return 1; } }
    512
    6 //  public class Median : BenchmarkSuiteDataDescriptor<long[], long> {
    7 //    private const string displayMame = "Median";
    8 //    private const string description = "";
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 100,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
     22        TrainingCount = 100,
     23        TestCount = 1000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean,
     25        MaxSize = 200,
     26        EvalLimit = 200,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          IntegerErcOptions = {
     30            IsEnabled = true,
     31            Start = -100,
     32            End = 100
     33          }
     34        }
     35      };
     36    }
    937
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
    12 
    13 //    protected override int InputArgumentCount { get { return 3; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
    15 
    16 //    public override long[] ConvertInput(string[] input) {
    17 //      return input.Select(ConvertInteger).ToArray();
    18 //    }
    19 
    20 //    public override long ConvertOutput(string[] output) {
    21 //      return ConvertInteger(output[0]);
    22 //    }
    23 
    24 //    public override IPushData CreatePushData(Example<long[], long>[] training, Example<long[], long>[] test) {
    25 //      return new MedianPushData(training, test);
    26 //    }
    27 //  }
    28 //}
     38    protected override Example ParseExample(string[] input, string[] output) {
     39      return new Example {
     40        InputArgs = input,
     41        OutputArgs = output,
     42        InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
     43        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]),
     44      };
     45    }
     46  }
     47}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/MirrorImage.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
    32
    4 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     3  public class MirrorImage : BenchmarkSuiteDataDescriptor {
     4    private const string name = "Mirror Image";
     5    private const string fileName = "MirrorImage.csv";
     6    private const string description = "Given two vectors of integers, return true if one vector is the reverse of the other, and false otherwise.";
    57
    6 //  public class MirrorImage : BenchmarkSuiteDataDescriptor<long[][], bool> {
    7 //    private const string displayMame = "Mirror Image";
    8 //    private const string description = "Given two vectors of integers, return true if one vector is the reverse of the other, and false otherwise";
     8    protected override string FileName { get { return fileName; } }
     9    public override string Name { get { return name; } }
     10    public override string Description { get { return description; } }
     11    protected override int InputArgumentCount { get { return 2; } }
     12    protected override int OutputArgumentCount { get { return 1; } }
    913
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
     14    public override ProblemData CreateProblemData() {
     15      return new ProblemData {
     16        Name = Name,
     17        Description = Description,
     18        Examples = CloneExamples(),
     19        BestResult = 0,
     20        WorstResult = 1,
     21        InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector, ExampleArgumentType.IntegerVector },
     22        OutputArgumentTypes = new[] { ExampleArgumentType.Boolean },
     23        TrainingCount = 100,
     24        TestCount = 1000,
     25        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     26        MaxSize = 300,
     27        EvalLimit = 600,
     28        ErcOptions = {
     29          ErcProbability = 0.05,
     30          BooleanErcOptions = {
     31            IsEnabled = true,
     32            AllowFalse = true,
     33            AllowTrue = true
     34          }
     35        }
     36      };
     37    }
    1238
    13 //    protected override int InputArgumentCount { get { return 2; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
    15 
    16 //    public override long[][] ConvertInput(string[] input) {
    17 //      return input.Select(ConvertIntegers).ToArray();
    18 //    }
    19 
    20 //    public override bool ConvertOutput(string[] output) {
    21 //      return ConvertBool(output[0]);
    22 //    }
    23 
    24 //    public override IPushData CreatePushData(Example<long[][], bool>[] training, Example<long[][], bool>[] test) {
    25 //      return new MirrorImagePushData(training, test);
    26 //    }
    27 //  }
    28 //}
     39    protected override Example ParseExample(string[] input, string[] output) {
     40      return new Example {
     41        InputArgs = input,
     42        OutputArgs = output,
     43        InputIntegerVector = new[] {
     44          ExampleArgumentConverter.ConvertIntegers(input[0]),
     45          ExampleArgumentConverter.ConvertIntegers(input[1])
     46        },
     47        OutputBoolean = ExampleArgumentConverter.ConvertBooleans(output[0]),
     48      };
     49    }
     50  }
     51}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NegativeToZero.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class NegativeToZero : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Negative to Zero";
     4    private const string fileName = "NegativeToZero.csv";
     5    private const string description = "Given a vector of integers, return the vector where all negative integers have been replaced by 0.";
    36
    4 //  public class NegativeToZero : BenchmarkSuiteDataDescriptor<long[], long[]> {
    5 //    private const string displayMame = "Negative To Zero";
    6 //    private const string description = "Given a vector of integers, return the vector where all negative integers have been replaced by 0.";
     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; } }
    712
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 50000,
     20        InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.IntegerVector },
     22        TrainingCount = 200,
     23        TestCount = 2000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     25        MaxSize = 500,
     26        EvalLimit = 1500,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          IntegerErcOptions = {
     30            IsEnabled = true,
     31            Constants = new [] { 0 }
     32          },
     33          IntegerVectorErcOptions = {
     34            IsEnabled = true,
     35            Constants = new [] { new int[0] }
     36          }
     37        }
     38      };
     39    }
    1040
    11 //    protected override int InputArgumentCount { get { return 1; } }
    12 //    protected override int OutputArgumentCount { get { return 1; } }
    13 
    14 //    public override long[] ConvertInput(string[] input) {
    15 //      return ConvertIntegers(input[0]);
    16 //    }
    17 
    18 //    public override long[] ConvertOutput(string[] output) {
    19 //      return ConvertIntegers(output[0]);
    20 //    }
    21 
    22 //    public override IPushData CreatePushData(Example<long[], long[]>[] training, Example<long[], long[]>[] test) {
    23 //      return new NegativeToZeroPushData(training, test);
    24 //    }
    25 //  }
    26 //}
     41    protected override Example ParseExample(string[] input, string[] output) {
     42      return new Example {
     43        InputArgs = input,
     44        OutputArgs = output,
     45        InputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(input[0]) },
     46        OutputIntegerVector = new[] { ExampleArgumentConverter.ConvertIntegers(output[0]) },
     47      };
     48    }
     49  }
     50}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NumberIo.cs

    r14834 r14875  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
     3
    24  public class NumberIO : BenchmarkSuiteDataDescriptor {
    35    private const string name = "NumberIO";
     
    1113    protected override int OutputArgumentCount { get { return 1; } }
    1214
    13     public override Data CreateProblemData() {
    14       return new Data {
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
    1517        Name = Name,
    1618        Description = Description,
     
    2022        InputArgumentTypes = new[] { ExampleArgumentType.Float, ExampleArgumentType.Integer },
    2123        OutputArgumentTypes = new[] { ExampleArgumentType.Float },
    22         OriginalTrainingCount = 25,
    23         OriginalTestCount = 1000,
     24        TrainingCount = 25,
     25        TestCount = 1000,
    2426        EnabledDataTypes = DataTypes.Integer | DataTypes.Float,
    2527        EvalLimit = 200,
    2628        MaxSize = 200,
     29        ErcOptions = {
     30          ErcProbability = 0.05,
     31          IntegerErcOptions = {
     32            IsEnabled = true,
     33            Start = -100,
     34            End = 100
     35          },
     36          FloatErcOptions = {
     37            IsEnabled = true,
     38            Start = -100.0,
     39            End = 100.0
     40          }
     41        }
    2742      };
    2843    }
     
    3348        OutputArgs = output,
    3449        InputFloat = ExampleArgumentConverter.ConvertDoubles(input[0]),
    35         InputInt = ExampleArgumentConverter.ConvertIntegers(input[1]),
     50        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[1]),
    3651        OutputFloat = ExampleArgumentConverter.ConvertDoubles(output[0])
    3752      };
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/PigLatin.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class PigLatin : BenchmarkSuiteDataDescriptor {
     3    private const string name = "Pig Latin";
     4    private const string fileName = "PigLatin.csv";
     5    private const string description = "Given a string containing lowercase words separated by single spaces, print the string with each word translated to pig Latin.Specifically, if a word starts with a vowel, it should have“ay”added to its end; otherwise, the first letter is moved to the end of the word, followed by “ay”.";
    36
    4 //  public class PigLatin : BenchmarkSuiteDataDescriptor<string, string> {
    5 //    private const string displayMame = "Pig Latin";
    6 //    private const string description = "Given a string containing lowercase words separated by single spaces, print the string with each word translated to pig Latin.Specifically, if a word starts with a vowel, it should have“ay”added to its end; otherwise, the first letter is moved to the end of the word, followed by “ay”";
     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; } }
    712
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
    10 //    protected override int InputArgumentCount { get { return 1; } }
    11 //    protected override int OutputArgumentCount { get { return 1; } }
     13    public override ProblemData CreateProblemData() {
     14      return new ProblemData {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 100,
     20        InputArgumentTypes = new[] { ExampleArgumentType.String },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.String },
     22        TrainingCount = 200,
     23        TestCount = 1000,
     24        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
     25        MaxSize = 1000,
     26        EvalLimit = 2000,
     27        ErcOptions = {
     28          ErcProbability = 0.05,
     29          CharErcOptions = {
     30            IsEnabled = true,
     31            Constants = new [] { ' ', 'a', 'e', 'i', 'o', 'u' },
     32            Start = 0x20,
     33            End = 0x7e
     34          },
     35          StringErcOptions = {
     36            IsEnabled = true,
     37            Constants = new [] { "ay", "aeiou" },
     38            AllowLowercaseLetters = true,
     39            AllowUppercaseLetters = false,
     40            AllowSpace = true,
     41            SpaceProbability = 0.2,
     42          }
     43        }
     44      };
     45    }
    1246
    13 //    public override string ConvertInput(string[] input) {
    14 //      return input[0];
    15 //    }
    16 
    17 //    public override string ConvertOutput(string[] output) {
    18 //      return output[0];
    19 //    }
    20 
    21 //    public override IPushData CreatePushData(Example<string, string>[] training, Example<string, string>[] test) {
    22 //      return new PigLatinPushData(training, test);
    23 //    }
    24 //  }
    25 //}
     47    protected override Example ParseExample(string[] input, string[] output) {
     48      return new Example {
     49        InputArgs = input,
     50        OutputArgs = output,
     51        InputString = input,
     52        OutputString = output,
     53      };
     54    }
     55  }
     56}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ReplaceSpaceWithNewline.cs

    r14727 r14875  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using HeuristicLab.BenchmarkSuite.ProblemData;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
    33
    4 //  public class ReplaceSpaceWithNewline : BenchmarkSuiteDataDescriptor<string, string[]> {
    5 //    private const string displayMame = "Replace Space with Newline";
    6 //    private const string description = "Given a string input, print the string, replacing spaces with newlines.Also, return the integer count of the non- whitespace characters. The input string will not have tabs or newlines.";
     4  public class ReplaceSpaceWithNewline : BenchmarkSuiteDataDescriptor {
     5    private const string name = "Replace Space with Newline";
     6    private const string fileName = "ReplaceSpaceWithNewline.csv";
     7    private const string description = " Given a string input, print the string, replacing spaces with newlines.Also, return the integer count of the non- whitespace characters. The input string will not have tabs or newlines.";
    78
    8 //    public override string Name { get { return displayMame; } }
    9 //    public override string Description { get { return description; } }
    10 //    protected override int InputArgumentCount { get { return 1; } }
    11 //    protected override int OutputArgumentCount { get { return 2; } }
     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 2; } }
    1214
    13 //    public override string ConvertInput(string[] input) {
    14 //      return input[0];
    15 //    }
     15    public override ProblemData CreateProblemData() {
     16      return new ProblemData {
     17        Name = Name,
     18        Description = Description,
     19        Examples = CloneExamples(),
     20        BestResult = 0,
     21        WorstResult = 20,
     22        InputArgumentTypes = new[] { ExampleArgumentType.String },
     23        OutputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.Integer },
     24        TrainingCount = 100,
     25        TestCount = 1000,
     26        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String,
     27        MaxSize = 800,
     28        EvalLimit = 1600,
     29        ErcOptions = {
     30          ErcProbability = 0.05,
     31          CharErcOptions = {
     32            IsEnabled = true,
     33            Constants = new [] { ' ', '\r' },
     34            Start = 0x20,
     35            End = 0x7e
     36          },
     37          StringErcOptions = {
     38            IsEnabled = true,
     39            AllowLowercaseLetters = true,
     40            AllowUppercaseLetters = false,
     41            AllowSpace = true,
     42            SpaceProbability = 0.2
     43          }
     44        }
     45      };
     46    }
    1647
    17 //    public override string[] ConvertOutput(string[] output) {
    18 //      return output;
    19 //    }
    20 
    21 //    public override IPushData CreatePushData(Example<string, string[]>[] training, Example<string, string[]>[] test) {
    22 //      return new ReplaceSpaceWithNewlinePushData(training, test);
    23 //    }
    24 //  }
    25 //}
     48    protected override Example ParseExample(string[] input, string[] output) {
     49      return new Example {
     50        InputArgs = input,
     51        OutputArgs = output,
     52        InputString = input,
     53        OutputString = new[] { output[0] },
     54        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[1]),
     55      };
     56    }
     57  }
     58}
Note: See TracChangeset for help on using the changeset viewer.