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/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}
Note: See TracChangeset for help on using the changeset viewer.