Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/17 21:42:09 (7 years ago)
Author:
pkimmesw
Message:

#2665 Renamings due to typos, ManagedPool tests, Skip Noops in Debugger

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs

    r14727 r14744  
    99
    1010  using HeuristicLab.BenchmarkSuite.Problems;
     11  using HeuristicLab.Common;
     12  using HeuristicLab.Core;
     13  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1114
    1215  using Microsoft.VisualBasic.FileIO;
    1316
    14   public abstract class BenchmarkSuiteDataDescriptor : IBenchmarkSuiteDataDescriptor, IExampleParser {
    15     protected const string InstanceArchiveName = "HeuristicLab.BenchmarkSuite.Data.BenchmarkExamples.zip";
    16     protected const string ResourcePath = @".*\.Data\.";
    17     protected const string ExampleSeparator = ",";
    1817
    19     protected const char ArrayValueSeparator = ' ';
    20     protected static readonly char[] ArraySymbolTrim = { '[', ']' };
     18  [StorableClass]
     19  public abstract class BenchmarkSuiteDataDescriptor : NamedItem, IBenchmarkSuiteDataDescriptor {
     20    private const string InstanceArchiveName = "HeuristicLab.BenchmarkSuite.Data.BenchmarkExamples.zip";
     21    private const string ResourcePath = @".*\.Data\.";
     22    private const string ExampleSeparator = ",";
    2123
    22     private readonly Lazy<Data> data;
    23     private readonly Lazy<Example[]> examples;
     24    private const char ArrayValueSeparator = ' ';
     25    private static readonly char[] ArraySymbolTrim = { '[', ']' };
    2426
    25     protected BenchmarkSuiteDataDescriptor() {
    26       examples = new Lazy<Example[]>(ParseData().ToArray, false);
     27    protected BenchmarkSuiteDataDescriptor() { }
     28
     29    [StorableConstructor]
     30    protected BenchmarkSuiteDataDescriptor(bool deserializing) : base(deserializing) { }
     31
     32
     33    [Storable]
     34    private Example[] examples;
     35    public Example[] Examples
     36    {
     37      get
     38      {
     39        return this.examples ?? (this.examples = this.ParseData().ToArray());
     40      }
    2741    }
    2842
    29     protected Example[] Examples { get { return examples.Value; } }
    30 
    31     public abstract string Name { get; }
    32     public abstract string FileName { get; }
    33     public abstract string Description { get; }
    34     protected abstract int OriginalTrainingCount { get; }
    35     protected abstract int OriginalTestCount { get; }
    36     protected abstract int BestResult { get; }
    37     protected abstract int WorstResult { get; }
    38     protected abstract int InputArgumentCount { get; }
    39     protected abstract int OutputArgumentCount { get; }
    40     protected int TotalArgumentCount { get { return InputArgumentCount + OutputArgumentCount; } }
     43    public new abstract string Name { get; }
     44    protected abstract string FileName { get; }
     45    public new abstract string Description { get; }
     46    public abstract int OriginalTrainingCount { get; }
     47    public abstract int OriginalTestCount { get; }
     48    public abstract int BestResult { get; }
     49    public abstract int WorstResult { get; }
     50    public abstract int InputArgumentCount { get; }
     51    public abstract int OutputArgumentCount { get; }
     52    public int TotalArgumentCount { get { return InputArgumentCount + OutputArgumentCount; } }
    4153
    4254    public abstract Example ParseExample(string[] input, string[] output);
    43 
    44     public Data CreateData() {
    45       return new Data(
    46         BestResult,
    47         WorstResult,
    48         OriginalTestCount,
    49         OriginalTrainingCount,
    50         InputArgumentCount,
    51         OutputArgumentCount,
    52         Examples,
    53         this);
    54     }
    5555
    5656    private IEnumerable<Example> ParseData() {
     
    127127      throw new InvalidDataException(string.Format("Unable to parse {0} as boolean", str));
    128128    }
     129
     130    public override IDeepCloneable Clone(Cloner cloner) {
     131      return this;
     132    }
    129133  }
    130134}
Note: See TracChangeset for help on using the changeset viewer.