Free cookie consent management tool by TermsFeed Policy Generator

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

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

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite
Files:
8 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}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteInstanceProvider.cs

    r14727 r14744  
    33
    44namespace HeuristicLab.BenchmarkSuite {
    5   using System.Linq;
    65
    76  using HeuristicLab.BenchmarkSuite.Problems;
    87  using HeuristicLab.Problems.Instances;
    98
    10   public class BenchmarkSuiteInstanceProvider : ProblemInstanceProvider<Data> {
     9  public class BenchmarkSuiteInstanceProvider : ProblemInstanceProvider<IBenchmarkSuiteDataDescriptor> {
    1110    private const string name = "General Program Synthesis Benchmark Suite";
    1211    private const string referencePublication =
     
    5352    }
    5453
    55     public override Data LoadData(IDataDescriptor descriptor) {
    56       var benchmarkSuiteDataDescriptor = (IBenchmarkSuiteDataDescriptor)descriptor;
    57 
    58       return benchmarkSuiteDataDescriptor.CreateData();
     54    public override IBenchmarkSuiteDataDescriptor LoadData(IDataDescriptor descriptor) {
     55      return (IBenchmarkSuiteDataDescriptor)descriptor;
    5956    }
    6057  }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj

    r14733 r14744  
    9898    <Compile Include="BenchmarkSuiteInstanceProvider.cs" />
    9999    <Compile Include="IBenchmarkSuiteDataDescriptor.cs" />
    100     <Compile Include="IExampleParser.cs" />
    101100    <Compile Include="Plugin.cs" />
    102     <Compile Include="Problems\Data.cs" />
    103101    <Compile Include="Problems\Example.cs" />
    104102    <Compile Include="Problems\ReplaceSpaceWithNewline.cs" />
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/IBenchmarkSuiteDataDescriptor.cs

    r14727 r14744  
    11namespace HeuristicLab.BenchmarkSuite {
    22  using HeuristicLab.BenchmarkSuite.Problems;
     3  using HeuristicLab.Core;
    34  using HeuristicLab.Problems.Instances;
    45
    5   public interface IBenchmarkSuiteDataDescriptor : IDataDescriptor {
    6     Data CreateData();
     6  public interface IBenchmarkSuiteDataDescriptor : IDataDescriptor, INamedItem {
     7    //Data CreateData();
     8    Example[] Examples { get; }
     9
     10    string Name { get; }
     11    string Description { get; }
     12    int OriginalTrainingCount { get; }
     13    int OriginalTestCount { get; }
     14    int BestResult { get; }
     15    int WorstResult { get; }
     16    int InputArgumentCount { get; }
     17    int OutputArgumentCount { get; }
     18    int TotalArgumentCount { get; }
     19
     20    Example ParseExample(string[] input, string[] output);
    721  }
    822}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs

    r14727 r14744  
    33  using System.Text;
    44
     5  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     6
     7  [StorableClass]
    58  public class Checksum : BenchmarkSuiteDataDescriptor {
    69    private const string name = "Checksum";
    710    private const string fileName = "Checksum.csv";
    811    private const string description = "";
     12    public Checksum() { }
     13
     14    [StorableConstructor]
     15    public Checksum(bool deserializing) : base(deserializing) { }
    916
    1017    public override string Name { get { return name; } }
    11     public override string FileName { get { return fileName; } }
     18    protected override string FileName { get { return fileName; } }
    1219    public override string Description { get { return description; } }
    13     protected override int InputArgumentCount { get { return 1; } }
    14     protected override int OutputArgumentCount { get { return 1; } }
    15     protected override int OriginalTrainingCount { get { return 228; } }
    16     protected override int OriginalTestCount { get { return 1254; } }
    17     protected override int BestResult { get { return 0; } }
    18     protected override int WorstResult { get { return byte.MaxValue; } }
     20    public override int InputArgumentCount { get { return 1; } }
     21    public override int OutputArgumentCount { get { return 1; } }
     22    public override int OriginalTrainingCount { get { return 228; } }
     23    public override int OriginalTestCount { get { return 1254; } }
     24    public override int BestResult { get { return 0; } }
     25    public override int WorstResult { get { return byte.MaxValue; } }
    1926
    2027    public override Example ParseExample(string[] input, string[] output) {
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CountOdds.cs

    r14727 r14744  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    23
     4  [StorableClass]
    35  public class CountOdds : BenchmarkSuiteDataDescriptor {
    46    private const string name = "Count Odds";
     
    68    private const string description = "";
    79
     10    public CountOdds() { }
     11
     12    [StorableConstructor]
     13    public CountOdds(bool deserializing) : base(deserializing) { }
     14
    815    public override string Name { get { return name; } }
    9     public override string FileName { get { return fileName; } }
    1016    public override string Description { get { return description; } }
    11     protected override int InputArgumentCount { get { return 1; } }
    12     protected override int OutputArgumentCount { get { return 1; } }
    13     protected override int OriginalTrainingCount { get { return 200; } }
    14     protected override int OriginalTestCount { get { return 2000; } }
    15     protected override int BestResult { get { return 0; } }
    16     protected override int WorstResult { get { return 50; } }
     17    protected override string FileName { get { return fileName; } }
     18    public override int InputArgumentCount { get { return 1; } }
     19    public override int OutputArgumentCount { get { return 1; } }
     20    public override int OriginalTrainingCount { get { return 200; } }
     21    public override int OriginalTestCount { get { return 2000; } }
     22    public override int BestResult { get { return 0; } }
     23    public override int WorstResult { get { return 50; } }
    1724
    1825    public override Example ParseExample(string[] input, string[] output) {
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Example.cs

    r14733 r14744  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using System;
    23
    34  using HeuristicLab.Common;
     
    2324
    2425    public void CopyTo(Example example) {
    25       example.InputArgs = this.InputArgs;
    26       example.OutputArgs = this.OutputArgs;
     26      Array.Copy(InputArgs, example.InputArgs, InputArgs.Length);
     27      Array.Copy(OutputArgs, example.OutputArgs, OutputArgs.Length);
    2728
    28       example.InputBoolean = this.InputBoolean;
    29       example.InputInt = this.InputInt;
    30       example.InputFloat = this.InputFloat;
     29      Array.Copy(InputBoolean, example.InputBoolean, InputBoolean.Length);
     30      Array.Copy(InputInt, example.InputInt, InputInt.Length);
     31      Array.Copy(InputFloat, example.InputFloat, InputFloat.Length);
    3132
    32       example.OutputBoolean = this.OutputBoolean;
    33       example.OutputInt = this.OutputInt;
    34       example.OutputFloat = this.OutputFloat;
     33      Array.Copy(OutputBoolean, example.OutputBoolean, OutputBoolean.Length);
     34      Array.Copy(OutputInt, example.OutputInt, OutputInt.Length);
     35      Array.Copy(OutputFloat, example.OutputFloat, OutputFloat.Length);
    3536    }
    3637
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.cs

    r14727 r14744  
    22
    33namespace HeuristicLab.BenchmarkSuite.Views {
    4 
    5   using HeuristicLab.BenchmarkSuite.Problems;
    64  using HeuristicLab.Core.Views;
    75  using HeuristicLab.MainForm;
    86
    97  [View("Push Expression Selection Editor")]
    10   [Content(typeof(Data), true)]
     8  [Content(typeof(IBenchmarkSuiteDataDescriptor), true)]
    119  public partial class DataEditorView : NamedItemView {
    1210    public DataEditorView() {
     
    3533
    3634      try {
    37         var newExample = Content.ExampleParser.ParseExample(inputArgs, outputArgs);
     35        var newExample = Content.ParseExample(inputArgs, outputArgs);
    3836        newExample.CopyTo(example);
    3937      }
     
    4846    }
    4947
    50     public new Data Content
     48    public new IBenchmarkSuiteDataDescriptor Content
    5149    {
    52       get { return (Data)base.Content; }
     50      get { return (IBenchmarkSuiteDataDescriptor)base.Content; }
    5351      set
    5452      {
     
    6462
    6563    protected override void OnContentChanged() {
    66       const string inputPrefix = "in_";
    67       const string outputPrefix = "out_";
    68 
    6964      dataGridView.Columns.Clear();
    7065      dataGridView.Rows.Clear();
Note: See TracChangeset for help on using the changeset viewer.