Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/17 01:15:25 (8 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/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}
Note: See TracChangeset for help on using the changeset viewer.