Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/17 00:27:31 (8 years ago)
Author:
pkimmesw
Message:

#2665 LexicaseSelector, Performance improvements, UI Fixes, Debugger only shows used stacks, fixed Debugger stepping, Added vector expressions, ERCOptions,

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite
Files:
2 added
7 deleted
11 edited

Legend:

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

    r14777 r14834  
    66  using System.Reflection;
    77  using System.Text.RegularExpressions;
    8 
    9   using HeuristicLab.BenchmarkSuite.ERC;
    108  using HeuristicLab.BenchmarkSuite.Problems;
    119
     
    1917
    2018    private Example[] examples;
    21     public Example[] Examples
    22     {
    23       get
    24       {
    25         return this.examples ?? (this.examples = this.ParseData().ToArray());
    26       }
     19
     20    protected Example[] CloneExamples() {
     21      if (examples == null) examples = ParseData().ToArray();
     22      return examples.Select(e => (Example)e.Clone()).ToArray();
    2723    }
    2824
    29     public Data CreateProblemData() {
    30       return new Data {
    31         Name = Name,
    32         Description = Description,
    33         Examples = Examples.ToArray(),
    34         BestResult = BestResult,
    35         WorstResult = WorstResult,
    36         InputArgumentTypes = InputArgumentTypes,
    37         OutputArgumentTypes = OutputArgumentTypes,
    38         OriginalTestCount = OriginalTestCount,
    39         OriginalTrainingCount = OriginalTrainingCount,
    40         EnabledDataTypes = EnabledDataTypes,
    41         EvalLimit = EvalLimit,
    42         MaxGenerations = MaxGenerations,
    43         MaxSize = MaxSize,
    44         ProgEvalBudget = ProgEvalBudget,
    45         ProblemErcOptions = ProblemErcOptions,
    46       };
    47     }
     25    public abstract Data CreateProblemData();
    4826
     27    protected abstract string FileName { get; }
    4928    public abstract string Name { get; }
    5029    public abstract string Description { get; }
    51     protected abstract string FileName { get; }
    52     public abstract int OriginalTrainingCount { get; }
    53     public abstract int OriginalTestCount { get; }
    54     public abstract int BestResult { get; }
    55     public abstract int WorstResult { get; }
    56     public abstract ExampleArgumentType[] InputArgumentTypes { get; }
    57     public abstract ExampleArgumentType[] OutputArgumentTypes { get; }
    58     public abstract ProblemErcOptions ProblemErcOptions { get; }
    59     public abstract DataTypes EnabledDataTypes { get; }
    60     public abstract int MaxSize { get; }
    61     public abstract int EvalLimit { get; }
    62     public abstract int MaxGenerations { get; }
    63     public abstract int ProgEvalBudget { get; }
     30    protected abstract int InputArgumentCount { get; }
     31    protected abstract int OutputArgumentCount { get; }
    6432
    65     public abstract Example ParseExample(string[] input, string[] output);
     33    protected abstract Example ParseExample(string[] input, string[] output);
    6634
    6735    private IEnumerable<Example> ParseData() {
     
    7947            var fields = parser.ReadFields();
    8048
    81             if (fields.Length != InputArgumentTypes.Length + OutputArgumentTypes.Length)
     49            if (fields.Length != InputArgumentCount + OutputArgumentCount)
    8250              throw new InvalidDataException("Number of values do not fit");
    8351
    84             var input = fields.Take(InputArgumentTypes.Length).ToArray();
    85             var output = fields.Skip(OutputArgumentTypes.Length).ToArray();
     52            var input = fields.Take(InputArgumentCount).ToArray();
     53            var output = fields.Skip(InputArgumentCount).ToArray();
    8654
    8755            yield return ParseExample(input, output);
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteInstanceProvider.cs

    r14777 r14834  
    4747      //yield return new MirrorImage();
    4848      //yield return new NegativeToZero();
    49       //yield return new NumberIo();
     49      yield return new NumberIO();
    5050      //yield return new PigLatin();
    5151      //yield return new ReplaceSpaceWithNewline();
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Example.cs

    r14777 r14834  
    11namespace HeuristicLab.BenchmarkSuite {
    2   using System.Linq;
    32
    43  using HeuristicLab.Common;
     
    76  [StorableClass]
    87  public class Example : DeepCloneable {
     8    private static readonly long[] emptyIntegers = new long[0];
     9    private static readonly double[] emptyFloats = new double[0];
     10    private static readonly bool[] emptyBooleans = new bool[0];
     11    private static readonly char[] emptyChars = new char[0];
     12    private static readonly string[] emptyStrings = new string[0];
     13
     14
    915    public Example() {
    10       this.InputInt = new long[0];
    11       this.InputFloat = new double[0];
    12       this.InputBoolean = new bool[0];
    13       this.OutputInt = this.InputInt;
    14       this.OutputFloat = this.InputFloat;
    15       this.OutputBoolean = this.InputBoolean;
     16      InputInt = emptyIntegers;
     17      InputFloat = emptyFloats;
     18      InputBoolean = emptyBooleans;
     19      InputChar = emptyChars;
     20      InputString = emptyStrings;
     21
     22      OutputInt = emptyIntegers;
     23      OutputFloat = emptyFloats;
     24      OutputBoolean = emptyBooleans;
     25      OutputChar = emptyChars;
     26      OutputString = emptyStrings;
    1627    }
    1728
    1829    public Example(Example origin, Cloner cloner) : base(origin, cloner) {
    19       origin.CopyTo(this);
     30      InputArgs = (string[])origin.InputArgs.Clone();
     31      OutputArgs = (string[])origin.OutputArgs.Clone();
     32
     33      InputBoolean = (bool[])origin.InputBoolean.Clone();
     34      InputInt = (long[])origin.InputInt.Clone();
     35      InputFloat = (double[])origin.InputFloat.Clone();
     36      InputChar = (char[])origin.InputChar.Clone();
     37      InputString = (string[])origin.InputString.Clone();
     38
     39      OutputBoolean = (bool[])origin.OutputBoolean.Clone();
     40      OutputInt = (long[])origin.OutputInt.Clone();
     41      OutputFloat = (double[])origin.OutputFloat.Clone();
     42      OutputChar = (char[])origin.OutputChar.Clone();
     43      OutputString = (string[])origin.OutputString.Clone();
    2044    }
    2145
    2246    [StorableConstructor]
    2347    public Example(bool deserializing) { }
    24 
    25     public void CopyTo(Example example) {
    26       example.InputArgs = InputArgs.ToArray();
    27       example.OutputArgs = OutputArgs.ToArray();
    28 
    29       example.InputBoolean = InputBoolean.ToArray();
    30       example.InputInt = InputInt.ToArray();
    31       example.InputFloat = InputFloat.ToArray();
    32 
    33       example.OutputBoolean = OutputBoolean.ToArray();
    34       example.OutputInt = OutputInt.ToArray();
    35       example.OutputFloat = OutputFloat.ToArray();
    36     }
    3748
    3849    [Storable]
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/ExampleArgumentConverter.cs

    r14777 r14834  
    22  using System;
    33  using System.Collections.Generic;
     4  using System.Globalization;
    45  using System.IO;
    56  using System.Linq;
     
    910    private static readonly char[] ArraySymbolTrim = { '[', ']', '(', ')' };
    1011    public static double[] ConvertDoubles(string input) {
    11       return ConvertMultiple(input, double.Parse);
     12      return ConvertMultiple(input, str => double.Parse(str, CultureInfo.InvariantCulture));
    1213    }
    1314
    1415    public static double ConvertDouble(string input) {
    15       return double.Parse(input);
     16      return double.Parse(input, CultureInfo.InvariantCulture);
    1617    }
    1718
     
    3839    }
    3940
    40     private static string[] trueFormats = new[] { "true", "t", "1" };
    41     private static string[] falseFormats = new[] { "false", "f", "0" };
     41    private static string[] trueFormats = { "true", "t", "1" };
     42    private static string[] falseFormats = { "false", "f", "0" };
    4243
    4344    public static bool ConvertBoolean(string input) {
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj

    r14777 r14834  
    102102    <Compile Include="BenchmarkSuiteInstanceProvider.cs" />
    103103    <Compile Include="DataTypes.cs" />
    104     <Compile Include="ERC\BooleanErcOptions.cs" />
    105     <Compile Include="ERC\ProblemErcOptions.cs" />
    106     <Compile Include="ERC\ErcOption.cs" />
    107     <Compile Include="ERC\ErcOptionRange.cs" />
    108     <Compile Include="ERC\StringErcOptions.cs" />
    109104    <Compile Include="ExampleArgumentConverter.cs" />
    110105    <Compile Include="IBenchmarkSuiteDataDescriptor.cs" />
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CountOdds.cs

    r14777 r14834  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
    2   using HeuristicLab.BenchmarkSuite.ERC;
    3   using HeuristicLab.Data;
    42
    53  public class CountOdds : BenchmarkSuiteDataDescriptor {
     
    75    private const string fileName = "CountOdds.csv";
    86    private const string description = "";
    9     private readonly ExampleArgumentType[] inputArgumentTypes = { ExampleArgumentType.IntegerCollection };
    10     private readonly ExampleArgumentType[] outputArgumentTypes = { ExampleArgumentType.Integer };
    117
    12     private readonly DataTypes enabledDataTypeses = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector;
    13     private readonly ProblemErcOptions problemErcOptions = new ProblemErcOptions {
    14       IntegerErcRange = new ErcOptionRange<IntValue>(
    15         new IntValue(-1000),
    16         new IntValue(1000),
    17         new IntValue(0),
    18         new IntValue(1),
    19         new IntValue(2))
    20     };
    21 
     8    protected override string FileName { get { return fileName; } }
    229    public override string Name { get { return name; } }
    2310    public override string Description { get { return description; } }
    24     protected override string FileName { get { return fileName; } }
    25     public override ExampleArgumentType[] InputArgumentTypes { get { return inputArgumentTypes; } }
    26     public override ExampleArgumentType[] OutputArgumentTypes { get { return outputArgumentTypes; } }
    27     public override int OriginalTrainingCount { get { return 200; } }
    28     public override int OriginalTestCount { get { return 2000; } }
    29     public override int BestResult { get { return 0; } }
    30     public override int WorstResult { get { return 50; } }
    31     public override ProblemErcOptions ProblemErcOptions { get { return this.problemErcOptions; } }
    32     public override DataTypes EnabledDataTypes { get { return this.enabledDataTypeses; } }
    33     public override int MaxSize { get { return 500; } }
    34     public override int EvalLimit { get { return 1500; } }
    35     public override int MaxGenerations { get { return 300; } }
    36     public override int ProgEvalBudget { get { return 60000000; } }
     11    protected override int InputArgumentCount { get { return 1; } }
     12    protected override int OutputArgumentCount { get { return 1; } }
    3713
    38     public override Example ParseExample(string[] input, string[] output) {
     14    public override Data CreateProblemData() {
     15      return new Data {
     16        Name = Name,
     17        Description = Description,
     18        Examples = CloneExamples(),
     19        BestResult = 0,
     20        WorstResult = 50,
     21        InputArgumentTypes = new[] { ExampleArgumentType.IntegerCollection },
     22        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
     23        OriginalTestCount = 2000,
     24        OriginalTrainingCount = 200,
     25        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.IntegerVector,
     26        EvalLimit = 1500,
     27        MaxSize = 500,
     28      };
     29    }
     30
     31    protected override Example ParseExample(string[] input, string[] output) {
    3932      return new Example {
    4033        InputArgs = input,
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Data.cs

    r14777 r14834  
    22  using System.Linq;
    33
    4   using HeuristicLab.BenchmarkSuite.ERC;
    54  using HeuristicLab.Common;
    65  using HeuristicLab.Core;
     
    1615
    1716    public Data(Data origin, Cloner cloner) : base(origin, cloner) {
    18       Name = origin.Name;
    19       Description = origin.Description;
    2017      OriginalTrainingCount = origin.OriginalTrainingCount;
    2118      OriginalTestCount = origin.OriginalTestCount;
     
    2421      InputArgumentTypes = origin.InputArgumentTypes;
    2522      OutputArgumentTypes = origin.OutputArgumentTypes;
    26       Examples = origin.Examples.ToArray();
     23
     24      if (origin.Examples != null)
     25        Examples = origin.Examples.Select(e => (Example)e.Clone(cloner)).ToArray();
     26
    2727      EnabledDataTypes = origin.EnabledDataTypes;
    28       this.ProblemErcOptions = cloner.Clone(origin.ProblemErcOptions);
    2928    }
    3029
    31     [Storable]
    32     public string Name { get; set; }
    33     [Storable]
    34     public string Description { get; set; }
    3530    [Storable]
    3631    public int OriginalTrainingCount { get; set; }
     
    3833    public int OriginalTestCount { get; set; }
    3934    [Storable]
    40     public int BestResult { get; set; }
     35    public double BestResult { get; set; }
    4136    [Storable]
    42     public int WorstResult { get; set; }
     37    public double WorstResult { get; set; }
    4338    [Storable]
    4439    public ExampleArgumentType[] InputArgumentTypes { get; set; }
     
    4843    [Storable]
    4944    public Example[] Examples { get; set; }
    50     [Storable]
    51     public ProblemErcOptions ProblemErcOptions { get; set; }
    5245    [Storable]
    5346    public DataTypes EnabledDataTypes { get; set; }
     
    6760    public int EvalLimit { get; set; }
    6861
    69     /// <summary>
    70     /// “Max Gens” gives the maximum number of generations in a single PushGP run.
    71     /// </summary>
    72     [Storable]
    73     public int MaxGenerations { get; set; }
    74 
    75     /// <summary>
    76     /// “Prog Eval Budget” is the maximum number of programs that will be evaluated before a run is terminated.
    77     /// </summary>
    78     [Storable]
    79     public int ProgEvalBudget { get; set; }
    80 
    8162    public override IDeepCloneable Clone(Cloner cloner) {
    8263      return new Data(this, cloner);
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NumberIo.cs

    r14727 r14834  
    1 //namespace HeuristicLab.BenchmarkSuite.Problems {
    2 //  using System.Linq;
     1namespace HeuristicLab.BenchmarkSuite.Problems {
     2  public class NumberIO : BenchmarkSuiteDataDescriptor {
     3    private const string name = "NumberIO";
     4    private const string fileName = "NumberIO.csv";
     5    private const string description = "Given an integer and a float, calc their sum.";
    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 2; } }
     11    protected override int OutputArgumentCount { get { return 1; } }
    512
    6 //  public class NumberIo : BenchmarkSuiteDataDescriptor<double[], double> {
    7 //    private const string displayMame = "NumberIO";
    8 //    private const string description = " Given an integer and a float, print their sum.";
     13    public override Data CreateProblemData() {
     14      return new Data {
     15        Name = Name,
     16        Description = Description,
     17        Examples = CloneExamples(),
     18        BestResult = 0,
     19        WorstResult = 400,
     20        InputArgumentTypes = new[] { ExampleArgumentType.Float, ExampleArgumentType.Integer },
     21        OutputArgumentTypes = new[] { ExampleArgumentType.Float },
     22        OriginalTrainingCount = 25,
     23        OriginalTestCount = 1000,
     24        EnabledDataTypes = DataTypes.Integer | DataTypes.Float,
     25        EvalLimit = 200,
     26        MaxSize = 200,
     27      };
     28    }
    929
    10 //    public override string Name { get { return displayMame; } }
    11 //    public override string Description { get { return description; } }
     30    protected override Example ParseExample(string[] input, string[] output) {
     31      return new Example {
     32        InputArgs = input,
     33        OutputArgs = output,
     34        InputFloat = ExampleArgumentConverter.ConvertDoubles(input[0]),
     35        InputInt = ExampleArgumentConverter.ConvertIntegers(input[1]),
     36        OutputFloat = ExampleArgumentConverter.ConvertDoubles(output[0])
     37      };
     38    }
     39  }
     40}
    1241
    13 //    protected override int InputArgumentCount { get { return 2; } }
    14 //    protected override int OutputArgumentCount { get { return 1; } }
    15 
    16 //    public override double[] ConvertInput(string[] input) {
    17 //      return input.Select(ConvertDouble).ToArray();
    18 //    }
    19 
    20 //    public override double ConvertOutput(string[] output) {
    21 //      return ConvertDouble(output[0]);
    22 //    }
    23 
    24 //    public override IPushData CreatePushData(Example<double[], double>[] training, Example<double[], double>[] test) {
    25 //      return new NumberIoPushData(training, test);
    26 //    }
    27 //  }
    28 //}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.cs

    r14777 r14834  
    3737
    3838      try {
    39         var newExample = ParseExample(inputArgs, Content.InputArgumentTypes, outputArgs, Content.OutputArgumentTypes);
    40         newExample.CopyTo(example);
     39        Content.Examples[e.RowIndex] = ParseExample(inputArgs, Content.InputArgumentTypes, outputArgs, Content.OutputArgumentTypes);
    4140      }
    4241      catch {
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/ViewHelper.cs

    r14777 r14834  
    3737    private const string IntegerColumnHeader = "int";
    3838    private const string IntegersColumnHeader = "int[]";
    39     private const string DoubleColumnHeader = "double";
    40     private const string DoublesColumnHeader = "double[]";
     39    private const string DoubleColumnHeader = "float";
     40    private const string DoublesColumnHeader = "float[]";
    4141    private const string BooleanColumnHeader = "bool";
    4242    private const string CharColumnHeader = "char";
Note: See TracChangeset for help on using the changeset viewer.