Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/17 01:11:18 (8 years ago)
Author:
pkimmesw
Message:

#2665 simplifier, push solution results view, performance improvements, small bug fixes, ui fixes

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite
Files:
11 added
9 edited

Legend:

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

    r14744 r14777  
    11namespace HeuristicLab.BenchmarkSuite {
    2   using System;
    32  using System.Collections.Generic;
    43  using System.IO;
     
    87  using System.Text.RegularExpressions;
    98
     9  using HeuristicLab.BenchmarkSuite.ERC;
    1010  using HeuristicLab.BenchmarkSuite.Problems;
    11   using HeuristicLab.Common;
    12   using HeuristicLab.Core;
    13   using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1411
    1512  using Microsoft.VisualBasic.FileIO;
    1613
    1714
    18   [StorableClass]
    19   public abstract class BenchmarkSuiteDataDescriptor : NamedItem, IBenchmarkSuiteDataDescriptor {
     15  public abstract class BenchmarkSuiteDataDescriptor : IBenchmarkSuiteDataDescriptor {
    2016    private const string InstanceArchiveName = "HeuristicLab.BenchmarkSuite.Data.BenchmarkExamples.zip";
    2117    private const string ResourcePath = @".*\.Data\.";
    2218    private const string ExampleSeparator = ",";
    2319
    24     private const char ArrayValueSeparator = ' ';
    25     private static readonly char[] ArraySymbolTrim = { '[', ']' };
    26 
    27     protected BenchmarkSuiteDataDescriptor() { }
    28 
    29     [StorableConstructor]
    30     protected BenchmarkSuiteDataDescriptor(bool deserializing) : base(deserializing) { }
    31 
    32 
    33     [Storable]
    3420    private Example[] examples;
    3521    public Example[] Examples
     
    4127    }
    4228
    43     public new abstract string Name { get; }
     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    }
     48
     49    public abstract string Name { get; }
     50    public abstract string Description { get; }
    4451    protected abstract string FileName { get; }
    45     public new abstract string Description { get; }
    4652    public abstract int OriginalTrainingCount { get; }
    4753    public abstract int OriginalTestCount { get; }
    4854    public abstract int BestResult { get; }
    4955    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; } }
     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; }
    5364
    5465    public abstract Example ParseExample(string[] input, string[] output);
     
    6879            var fields = parser.ReadFields();
    6980
    70             if (fields.Length != TotalArgumentCount)
     81            if (fields.Length != InputArgumentTypes.Length + OutputArgumentTypes.Length)
    7182              throw new InvalidDataException("Number of values do not fit");
    7283
    73             var input = fields.Take(InputArgumentCount).ToArray();
    74             var output = fields.Skip(InputArgumentCount).ToArray();
     84            var input = fields.Take(InputArgumentTypes.Length).ToArray();
     85            var output = fields.Skip(OutputArgumentTypes.Length).ToArray();
    7586
    7687            yield return ParseExample(input, output);
     
    8697          .SingleOrDefault(x => Regex.Match(x, ResourcePath + fileName).Success);
    8798    }
    88 
    89     protected static double[] ConvertDoubles(string input) {
    90       return ConvertMultiple(input, double.Parse);
    91     }
    92 
    93     protected static double ConvertDouble(string input) {
    94       return double.Parse(input);
    95     }
    96 
    97     protected static long[] ConvertIntegers(string input) {
    98       return ConvertMultiple(input, long.Parse);
    99     }
    100 
    101     protected static long ConvertInteger(string input) {
    102 
    103       return string.IsNullOrEmpty(input) ? default(long) : long.Parse(input);
    104     }
    105 
    106     protected static T[] ConvertMultiple<T>(string input, Func<string, T> converter) {
    107       return input
    108        .Trim(ArraySymbolTrim)
    109        .Split(ArrayValueSeparator)
    110        .Where(s => !string.IsNullOrWhiteSpace(s))
    111        .Select(converter)
    112        .ToArray();
    113     }
    114 
    115     protected static IEnumerable<string> SplitByNewLine(string input) {
    116       return input.Split(new[] { Environment.NewLine, "\n", "\r\n" }, StringSplitOptions.None);
    117     }
    118 
    119     private static string[] trueFormats = new[] { "true", "t", "1" };
    120     private static string[] falseFormats = new[] { "false", "f", "0" };
    121 
    122     protected static bool ConvertBool(string input) {
    123       var str = input.ToLower();
    124 
    125       if (trueFormats.Contains(str)) return true;
    126       if (falseFormats.Contains(str)) return false;
    127       throw new InvalidDataException(string.Format("Unable to parse {0} as boolean", str));
    128     }
    129 
    130     public override IDeepCloneable Clone(Cloner cloner) {
    131       return this;
    132     }
    13399  }
    134100}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteInstanceProvider.cs

    r14744 r14777  
    77  using HeuristicLab.Problems.Instances;
    88
    9   public class BenchmarkSuiteInstanceProvider : ProblemInstanceProvider<IBenchmarkSuiteDataDescriptor> {
     9  public class BenchmarkSuiteInstanceProvider : ProblemInstanceProvider<Data> {
    1010    private const string name = "General Program Synthesis Benchmark Suite";
    1111    private const string referencePublication =
     
    3636      yield return new CountOdds();
    3737      //yield return new CollatzNumbers();
    38       yield return new Checksum();
     38      //yield return new Checksum();
    3939      //yield return new CompareStringLengths();
    4040      //yield return new Digits();
     
    5252    }
    5353
    54     public override IBenchmarkSuiteDataDescriptor LoadData(IDataDescriptor descriptor) {
    55       return (IBenchmarkSuiteDataDescriptor)descriptor;
     54    public override Data LoadData(IDataDescriptor descriptor) {
     55      var benchmarkSuiteDataDescriptor = (IBenchmarkSuiteDataDescriptor)descriptor;
     56
     57      return benchmarkSuiteDataDescriptor.CreateProblemData();
    5658    }
    5759  }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Example.cs

    r14727 r14777  
    1 namespace HeuristicLab.BenchmarkSuite
    2 {
    3   public class Example
    4   {
    5     public string Input { get; set; }
     1namespace HeuristicLab.BenchmarkSuite {
     2  using System.Linq;
    63
    7     public string Output { get; set; }
     4  using HeuristicLab.Common;
     5  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     6
     7  [StorableClass]
     8  public class Example : DeepCloneable {
     9    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    }
     17
     18    public Example(Example origin, Cloner cloner) : base(origin, cloner) {
     19      origin.CopyTo(this);
     20    }
     21
     22    [StorableConstructor]
     23    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    }
     37
     38    [Storable]
     39    public string[] InputArgs { get; set; }
     40    [Storable]
     41    public string[] OutputArgs { get; set; }
     42
     43    [Storable]
     44    public long[] InputInt { get; set; }
     45    [Storable]
     46    public double[] InputFloat { get; set; }
     47    [Storable]
     48    public bool[] InputBoolean { get; set; }
     49    [Storable]
     50    public char[] InputChar { get; set; }
     51    [Storable]
     52    public string[] InputString { get; set; }
     53
     54    [Storable]
     55    public long[] OutputInt { get; set; }
     56    [Storable]
     57    public double[] OutputFloat { get; set; }
     58    [Storable]
     59    public bool[] OutputBoolean { get; set; }
     60    [Storable]
     61    public char[] OutputChar { get; set; }
     62    [Storable]
     63    public string[] OutputString { get; set; }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new Example(this, cloner);
     67    }
    868  }
    969}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/HeuristicLab.BenchmarkSuite.csproj

    r14744 r14777  
    4747      <SpecificVersion>False</SpecificVersion>
    4848      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     49    </Reference>
     50    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     51      <SpecificVersion>False</SpecificVersion>
     52      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
    4953    </Reference>
    5054    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    97101    <Compile Include="BenchmarkSuiteDataDescriptor.cs" />
    98102    <Compile Include="BenchmarkSuiteInstanceProvider.cs" />
     103    <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" />
     109    <Compile Include="ExampleArgumentConverter.cs" />
    99110    <Compile Include="IBenchmarkSuiteDataDescriptor.cs" />
    100111    <Compile Include="Plugin.cs" />
    101     <Compile Include="Problems\Example.cs" />
     112    <Compile Include="Problems\Data.cs" />
     113    <Compile Include="Example.cs" />
     114    <Compile Include="ExampleArgumentType.cs" />
    102115    <Compile Include="Problems\ReplaceSpaceWithNewline.cs" />
    103116    <Compile Include="Problems\PigLatin.cs" />
     
    116129    <Compile Include="Problems\CountOdds.cs" />
    117130    <Compile Include="Properties\AssemblyInfo.cs" />
     131    <Compile Include="Views\ViewHelper.cs" />
    118132    <Compile Include="Views\DataEditorView.cs">
    119133      <SubType>UserControl</SubType>
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/IBenchmarkSuiteDataDescriptor.cs

    r14744 r14777  
    11namespace HeuristicLab.BenchmarkSuite {
    22  using HeuristicLab.BenchmarkSuite.Problems;
    3   using HeuristicLab.Core;
    43  using HeuristicLab.Problems.Instances;
    54
    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);
     5  public interface IBenchmarkSuiteDataDescriptor : IDataDescriptor {
     6    Data CreateProblemData();
    217  }
    228}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs

    r14744 r14777  
    1 namespace HeuristicLab.BenchmarkSuite.Problems {
    2   using System;
    3   using System.Text;
     1//namespace HeuristicLab.BenchmarkSuite.Problems {
     2//  using System;
     3//  using System.Text;
    44
    5   using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     5//  public class Checksum : BenchmarkSuiteDataDescriptor {
     6//    private const string name = "Checksum";
     7//    private const string fileName = "Checksum.csv";
     8//    private const string description = "";
     9//    private readonly ExampleArgumentType[] inputArgumentTypes = { ExampleArgumentType.IntegerCollection };
     10//    private readonly ExampleArgumentType[] outputArgumentTypes = { ExampleArgumentType.IntegerCollection };
    611
    7   [StorableClass]
    8   public class Checksum : BenchmarkSuiteDataDescriptor {
    9     private const string name = "Checksum";
    10     private const string fileName = "Checksum.csv";
    11     private const string description = "";
    12     public Checksum() { }
     12//    public override string Name { get { return name; } }
     13//    protected override string FileName { get { return fileName; } }
     14//    public override string Description { get { return description; } }
     15//    public override ExampleArgumentType[] InputArgumentTypes { get { return inputArgumentTypes; } }
     16//    public override ExampleArgumentType[] OutputArgumentTypes { get { return outputArgumentTypes; } }
     17//    public override int OriginalTrainingCount { get { return 228; } }
     18//    public override int OriginalTestCount { get { return 1254; } }
     19//    public override int BestResult { get { return 0; } }
     20//    public override int WorstResult { get { return byte.MaxValue; } }
    1321
    14     [StorableConstructor]
    15     public Checksum(bool deserializing) : base(deserializing) { }
    16 
    17     public override string Name { get { return name; } }
    18     protected override string FileName { get { return fileName; } }
    19     public override string Description { get { return description; } }
    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; } }
    26 
    27     public override Example ParseExample(string[] input, string[] output) {
    28       return new Example {
    29         InputArgs = input,
    30         OutputArgs = output,
    31         InputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(input[0]), c => (long)c),
    32         OutputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(output[0]), c => (long)c)
    33       };
    34     }
    35   }
    36 }
     22//    public override Example ParseExample(string[] input, string[] output) {
     23//      return new Example {
     24//        InputArgs = input,
     25//        OutputArgs = output,
     26//        InputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(input[0]), c => (long)c),
     27//        OutputInt = Array.ConvertAll(Encoding.ASCII.GetBytes(output[0]), c => (long)c)
     28//      };
     29//    }
     30//  }
     31//}
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CountOdds.cs

    r14744 r14777  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
    2   using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     2  using HeuristicLab.BenchmarkSuite.ERC;
     3  using HeuristicLab.Data;
    34
    4   [StorableClass]
    55  public class CountOdds : BenchmarkSuiteDataDescriptor {
    66    private const string name = "Count Odds";
    77    private const string fileName = "CountOdds.csv";
    88    private const string description = "";
     9    private readonly ExampleArgumentType[] inputArgumentTypes = { ExampleArgumentType.IntegerCollection };
     10    private readonly ExampleArgumentType[] outputArgumentTypes = { ExampleArgumentType.Integer };
    911
    10     public CountOdds() { }
    11 
    12     [StorableConstructor]
    13     public CountOdds(bool deserializing) : base(deserializing) { }
     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    };
    1421
    1522    public override string Name { get { return name; } }
    1623    public override string Description { get { return description; } }
    1724    protected override string FileName { get { return fileName; } }
    18     public override int InputArgumentCount { get { return 1; } }
    19     public override int OutputArgumentCount { get { return 1; } }
     25    public override ExampleArgumentType[] InputArgumentTypes { get { return inputArgumentTypes; } }
     26    public override ExampleArgumentType[] OutputArgumentTypes { get { return outputArgumentTypes; } }
    2027    public override int OriginalTrainingCount { get { return 200; } }
    2128    public override int OriginalTestCount { get { return 2000; } }
    2229    public override int BestResult { get { return 0; } }
    2330    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; } }
    2437
    2538    public override Example ParseExample(string[] input, string[] output) {
     
    2740        InputArgs = input,
    2841        OutputArgs = output,
    29         InputInt = ConvertIntegers(input[0]),
    30         OutputInt = ConvertIntegers(output[0])
     42        InputInt = ExampleArgumentConverter.ConvertIntegers(input[0]),
     43        OutputInt = ExampleArgumentConverter.ConvertIntegers(output[0])
    3144      };
    3245    }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.Designer.cs

    r14727 r14777  
    3333      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    3434      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    35       this.nameTextBox.Size = new System.Drawing.Size(302, 20);
     35      this.nameTextBox.Size = new System.Drawing.Size(758, 20);
    3636      //
    3737      // infoLabel
    3838      //
    39       this.infoLabel.Location = new System.Drawing.Point(366, 3);
     39      this.infoLabel.Location = new System.Drawing.Point(822, 3);
    4040      //
    4141      // dataGridView
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.cs

    r14744 r14777  
    22
    33namespace HeuristicLab.BenchmarkSuite.Views {
     4
     5  using HeuristicLab.BenchmarkSuite.Problems;
    46  using HeuristicLab.Core.Views;
    57  using HeuristicLab.MainForm;
    68
    79  [View("Push Expression Selection Editor")]
    8   [Content(typeof(IBenchmarkSuiteDataDescriptor), true)]
     10  [Content(typeof(Data), true)]
    911  public partial class DataEditorView : NamedItemView {
     12    private const string ValueSeparator = ", ";
     13
    1014    public DataEditorView() {
    1115      InitializeComponent();
     
    2024      var row = dataGridView.Rows[e.RowIndex];
    2125
    22       var inputArgs = new string[Content.InputArgumentCount];
    23       for (var i = 0; i < Content.InputArgumentCount; i++) {
     26      var inputArgs = new string[Content.InputArgumentTypes.Length];
     27      for (var i = 0; i < Content.InputArgumentTypes.Length; i++) {
    2428        inputArgs[i] = row.Cells[i].Value.ToString();
    2529      }
    2630
    27       var outputArgs = new string[Content.OutputArgumentCount];
    28       for (var i = 0; i < Content.OutputArgumentCount; i++) {
    29         outputArgs[i] = row.Cells[Content.InputArgumentCount + i].Value.ToString();
     31      var outputArgs = new string[Content.OutputArgumentTypes.Length];
     32      for (var i = 0; i < Content.OutputArgumentTypes.Length; i++) {
     33        outputArgs[i] = row.Cells[Content.InputArgumentTypes.Length + i].Value.ToString();
    3034      }
    3135
     
    3337
    3438      try {
    35         var newExample = Content.ParseExample(inputArgs, outputArgs);
     39        var newExample = ParseExample(inputArgs, Content.InputArgumentTypes, outputArgs, Content.OutputArgumentTypes);
    3640        newExample.CopyTo(example);
    3741      }
     
    4044
    4145        // reset entry
    42         row.Cells[e.ColumnIndex].Value = e.ColumnIndex < Content.InputArgumentCount
     46        row.Cells[e.ColumnIndex].Value = e.ColumnIndex < Content.InputArgumentTypes.Length
    4347          ? example.InputArgs[e.ColumnIndex]
    44           : example.OutputArgs[e.ColumnIndex - Content.InputArgumentCount];
     48          : example.OutputArgs[e.ColumnIndex - Content.InputArgumentTypes.Length];
    4549      }
    4650    }
    4751
    48     public new IBenchmarkSuiteDataDescriptor Content
     52    private Example ParseExample(string[] inputArgs, ExampleArgumentType[] inputArgTypes, string[] outputArgs, ExampleArgumentType[] outputArgTypes) {
     53      var example = new Example();
     54
     55      example.InputArgs = new string[inputArgs.Length];
     56      for (var i = 0; i < inputArgs.Length; i++) {
     57        var arg = inputArgs[i];
     58        var type = inputArgTypes[i];
     59
     60        switch (type) {
     61          case ExampleArgumentType.Bool:
     62            example.InputBoolean = new[] { ExampleArgumentConverter.ConvertBoolean(arg) };
     63            example.InputArgs[i] = arg;
     64            break;
     65          case ExampleArgumentType.Integer:
     66            example.InputInt = new[] { ExampleArgumentConverter.ConvertInteger(arg) };
     67            example.InputArgs[i] = arg;
     68            break;
     69          case ExampleArgumentType.IntegerCollection:
     70            example.InputInt = ExampleArgumentConverter.ConvertIntegers(arg);
     71            example.InputArgs[i] = string.Join(ValueSeparator, example.InputInt);
     72            break;
     73          case ExampleArgumentType.Float:
     74            example.InputFloat = new[] { ExampleArgumentConverter.ConvertDouble(arg) };
     75            example.InputArgs[i] = arg;
     76            break;
     77          case ExampleArgumentType.FloatCollection:
     78            example.InputFloat = ExampleArgumentConverter.ConvertDoubles(arg);
     79            example.InputArgs[i] = string.Join(ValueSeparator, example.InputFloat);
     80            break;
     81        }
     82      }
     83
     84      example.OutputArgs = new string[outputArgs.Length];
     85      for (var i = 0; i < outputArgs.Length; i++) {
     86        var arg = outputArgs[i];
     87        var type = outputArgTypes[i];
     88
     89        switch (type) {
     90          case ExampleArgumentType.Bool:
     91            example.OutputBoolean = new[] { ExampleArgumentConverter.ConvertBoolean(arg) };
     92            example.OutputArgs[i] = arg;
     93            break;
     94          case ExampleArgumentType.Integer:
     95            example.OutputInt = new[] { ExampleArgumentConverter.ConvertInteger(arg) };
     96            example.OutputArgs[i] = arg;
     97            break;
     98          case ExampleArgumentType.IntegerCollection:
     99            example.OutputInt = ExampleArgumentConverter.ConvertIntegers(arg);
     100            example.OutputArgs[i] = string.Join(ValueSeparator, example.OutputInt);
     101            break;
     102          case ExampleArgumentType.Float:
     103            example.OutputFloat = new[] { ExampleArgumentConverter.ConvertDouble(arg) };
     104            example.OutputArgs[i] = arg;
     105            break;
     106          case ExampleArgumentType.FloatCollection:
     107            example.OutputFloat = ExampleArgumentConverter.ConvertDoubles(arg);
     108            example.OutputArgs[i] = string.Join(ValueSeparator, example.OutputFloat);
     109            break;
     110        }
     111      }
     112
     113      return example;
     114    }
     115
     116    public new Data Content
    49117    {
    50       get { return (IBenchmarkSuiteDataDescriptor)base.Content; }
     118      get { return (Data)base.Content; }
    51119      set
    52120      {
     
    69137      }
    70138
     139      this.nameTextBox.Text = Content.Name;
     140
    71141      var cellTemplate = new DataGridViewTextBoxCell();
    72142
    73       for (var i = 1; i <= Content.InputArgumentCount; i++) {
     143      for (var i = 0; i < Content.InputArgumentTypes.Length; i++) {
     144        var headerTypeName = ViewHelper.GetHeaderTypeName(Content.InputArgumentTypes[i]);
    74145        var column = new DataGridViewColumn {
    75           HeaderText = string.Format("Input {0}", i),
     146          HeaderText = string.Format("Input {0} : {1}", i + 1, headerTypeName),
    76147          AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
    77148          CellTemplate = cellTemplate
     
    81152      }
    82153
    83       for (var i = 1; i <= Content.OutputArgumentCount; i++) {
     154      for (var i = 0; i < Content.OutputArgumentTypes.Length; i++) {
     155        var headerTypeName = ViewHelper.GetHeaderTypeName(Content.OutputArgumentTypes[i]);
    84156        var column = new DataGridViewColumn {
    85           HeaderText = string.Format("Output {0}", i),
     157          HeaderText = string.Format("Output {0} : {1}", i + 1, headerTypeName),
    86158          AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
    87159          CellTemplate = cellTemplate
     
    97169        row.CreateCells(dataGridView);
    98170
    99         for (var i = 0; i < Content.InputArgumentCount; i++) {
    100           row.Cells[i].Value = example.InputArgs[i];
     171        for (var i = 0; i < Content.InputArgumentTypes.Length; i++) {
     172          row.Cells[i].Value = ViewHelper.StringifyInput(Content.InputArgumentTypes[i], example, ValueSeparator);
    101173        }
    102174
    103         for (var i = 0; i < Content.OutputArgumentCount; i++) {
    104           row.Cells[Content.InputArgumentCount + i].Value = example.OutputArgs[i];
     175        for (var i = 0; i < Content.OutputArgumentTypes.Length; i++) {
     176          row.Cells[Content.InputArgumentTypes.Length + i].Value = ViewHelper.StringifyOutput(Content.OutputArgumentTypes[i], example, ValueSeparator);
    105177        }
    106178
Note: See TracChangeset for help on using the changeset viewer.