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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.