Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/10/17 11:23:05 (8 years ago)
Author:
pkimmesw
Message:

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.Designer.cs

    r14777 r14952  
    4444            | System.Windows.Forms.AnchorStyles.Left)
    4545            | System.Windows.Forms.AnchorStyles.Right)));
     46      this.dataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
    4647      this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
    4748      this.dataGridView.Location = new System.Drawing.Point(6, 26);
    4849      this.dataGridView.Name = "dataGridView";
     50      this.dataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
    4951      this.dataGridView.Size = new System.Drawing.Size(832, 612);
    5052      this.dataGridView.TabIndex = 3;
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.cs

    r14908 r14952  
    44  using System.Collections.Generic;
    55
    6   using HeuristicLab.BenchmarkSuite.Problems;
    76  using HeuristicLab.Core.Views;
    87  using HeuristicLab.MainForm;
     
    152151      nameTextBox.Text = Content.Name;
    153152
    154       var cellTemplate = new DataGridViewTextBoxCell();
     153      var cellTemplate = new DataGridViewTextBoxCell { Style = { WrapMode = DataGridViewTriState.True } };
    155154
    156155      for (var i = 0; i < Content.InputArgumentTypes.Length; i++) {
     
    176175      }
    177176
    178       foreach (var example in Content.Examples) {
    179         var row = new DataGridViewRow();
    180         row.HeaderCell.Value = row.Index + 1;
    181 
     177      for (var rowIdx = 0; rowIdx < Content.Examples.Length; rowIdx++) {
     178        var example = Content.Examples[rowIdx];
     179        var row = new DataGridViewRow {
     180          HeaderCell = {
     181            Value = (rowIdx + 1).ToString(),
     182          }
     183        };
    182184        row.CreateCells(dataGridView);
    183185
     186        var inputArgumentCountDict = ViewHelper.CreateArgumentCountDict();
    184187        for (var i = 0; i < Content.InputArgumentTypes.Length; i++) {
    185           row.Cells[i].Value = ViewHelper.StringifyInput(Content.InputArgumentTypes[i], example, ValueSeparator);
    186         }
    187 
     188          var type = Content.InputArgumentTypes[i];
     189          var offset = inputArgumentCountDict[type];
     190          row.Cells[i].Value = ViewHelper.StringifyInput(type, offset, example, ValueSeparator);
     191          inputArgumentCountDict[type]++;
     192        }
     193
     194        var outputArgumentCountDict = ViewHelper.CreateArgumentCountDict();
    188195        for (var i = 0; i < Content.OutputArgumentTypes.Length; i++) {
    189           row.Cells[Content.InputArgumentTypes.Length + i].Value = ViewHelper.StringifyOutput(Content.OutputArgumentTypes[i], example, ValueSeparator);
     196          var type = Content.OutputArgumentTypes[i];
     197          var offset = outputArgumentCountDict[type];
     198          row.Cells[Content.InputArgumentTypes.Length + i].Value = ViewHelper.StringifyOutput(type, offset, example, ValueSeparator);
     199          outputArgumentCountDict[type]++;
    190200        }
    191201
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.resx

    r14897 r14952  
    11<?xml version="1.0" encoding="utf-8"?>
    22<root>
    3   <!--
    4     Microsoft ResX Schema
    5 
     3  <!-- 
     4    Microsoft ResX Schema 
     5   
    66    Version 2.0
    7 
    8     The primary goals of this format is to allow a simple XML format
    9     that is mostly human readable. The generation and parsing of the
    10     various data types are done through the TypeConverter classes
     7   
     8    The primary goals of this format is to allow a simple XML format 
     9    that is mostly human readable. The generation and parsing of the 
     10    various data types are done through the TypeConverter classes 
    1111    associated with the data types.
    12 
     12   
    1313    Example:
    14 
     14   
    1515    ... ado.net/XML headers & schema ...
    1616    <resheader name="resmimetype">text/microsoft-resx</resheader>
     
    2727        <comment>This is a comment</comment>
    2828    </data>
    29 
    30     There are any number of "resheader" rows that contain simple
     29               
     30    There are any number of "resheader" rows that contain simple 
    3131    name/value pairs.
    32 
    33     Each data row contains a name, and value. The row also contains a
    34     type or mimetype. Type corresponds to a .NET class that support
    35     text/value conversion through the TypeConverter architecture.
    36     Classes that don't support this are serialized and stored with the
     32   
     33    Each data row contains a name, and value. The row also contains a 
     34    type or mimetype. Type corresponds to a .NET class that support 
     35    text/value conversion through the TypeConverter architecture. 
     36    Classes that don't support this are serialized and stored with the 
    3737    mimetype set.
    38 
    39     The mimetype is used for serialized objects, and tells the
    40     ResXResourceReader how to depersist the object. This is currently not
     38   
     39    The mimetype is used for serialized objects, and tells the 
     40    ResXResourceReader how to depersist the object. This is currently not 
    4141    extensible. For a given mimetype the value must be set accordingly:
    42 
    43     Note - application/x-microsoft.net.object.binary.base64 is the format
    44     that the ResXResourceWriter will generate, however the reader can
     42   
     43    Note - application/x-microsoft.net.object.binary.base64 is the format 
     44    that the ResXResourceWriter will generate, however the reader can 
    4545    read any of the formats listed below.
    46 
     46   
    4747    mimetype: application/x-microsoft.net.object.binary.base64
    48     value   : The object must be serialized with
     48    value   : The object must be serialized with 
    4949            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
    5050            : and then encoded with base64 encoding.
    51 
     51   
    5252    mimetype: application/x-microsoft.net.object.soap.base64
    53     value   : The object must be serialized with
     53    value   : The object must be serialized with 
    5454            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
    5555            : and then encoded with base64 encoding.
    5656
    5757    mimetype: application/x-microsoft.net.object.bytearray.base64
    58     value   : The object must be serialized into a byte array
     58    value   : The object must be serialized into a byte array 
    5959            : using a System.ComponentModel.TypeConverter
    6060            : and then encoded with base64 encoding.
     
    6767          <xsd:element name="metadata">
    6868            <xsd:complexType>
    69               <xsd:items>
     69              <xsd:sequence>
    7070                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    71               </xsd:items>
     71              </xsd:sequence>
    7272              <xsd:attribute name="name" use="required" type="xsd:string" />
    7373              <xsd:attribute name="type" type="xsd:string" />
     
    8484          <xsd:element name="data">
    8585            <xsd:complexType>
    86               <xsd:items>
     86              <xsd:sequence>
    8787                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    8888                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    89               </xsd:items>
     89              </xsd:sequence>
    9090              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    9191              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
     
    9696          <xsd:element name="resheader">
    9797            <xsd:complexType>
    98               <xsd:items>
     98              <xsd:sequence>
    9999                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    100               </xsd:items>
     100              </xsd:sequence>
    101101              <xsd:attribute name="name" type="xsd:string" use="required" />
    102102            </xsd:complexType>
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/ViewHelper.cs

    r14909 r14952  
    11namespace HeuristicLab.BenchmarkSuite.Views {
     2  using System;
     3  using System.Collections.Generic;
     4  using System.Globalization;
    25  using System.Linq;
    36
    47  public static class ViewHelper {
    5     public static string StringifyInput(ExampleArgumentType type, Example example, string valueSeparator) {
     8    public static string StringifyInput(ExampleArgumentType type, int offset, Example example, string valueSeparator) {
    69      switch (type) {
    7         case ExampleArgumentType.Integer: return string.Join(valueSeparator, example.InputInteger);
    8         case ExampleArgumentType.IntegerVector: return "[" + string.Join("], [", example.InputIntegerVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     10        case ExampleArgumentType.Integer: return example.InputInteger[offset].ToString();
     11        case ExampleArgumentType.IntegerVector: return "[" + string.Join(", ", example.InputIntegerVector[offset]) + "]";
    912
    10         case ExampleArgumentType.Float: return string.Join(valueSeparator, example.InputFloat);
    11         case ExampleArgumentType.FloatVector: return "[" + string.Join("], [", example.InputFloatVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     13        case ExampleArgumentType.Float: return example.InputFloat[offset].ToString(CultureInfo.CurrentUICulture);
     14        case ExampleArgumentType.FloatVector: return "[" + string.Join(", ", example.InputFloatVector[offset]) + "]";
    1215
    13         case ExampleArgumentType.Boolean: return string.Join(valueSeparator, example.InputBoolean);
    14         case ExampleArgumentType.Char: return string.Join(valueSeparator, example.InputChar);
     16        case ExampleArgumentType.Boolean: return example.InputBoolean[offset].ToString();
     17        case ExampleArgumentType.Char: return example.InputChar[offset].ToString();
    1518
    16         case ExampleArgumentType.String: return string.Join(valueSeparator, example.InputString);
    17         case ExampleArgumentType.StringVector: return "[" + string.Join("], [", example.InputStringVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     19        case ExampleArgumentType.String: return example.InputString[offset];
     20        case ExampleArgumentType.StringVector: return "[" + string.Join(", ", example.InputStringVector[offset]) + "]";
     21
    1822        default: return string.Empty;
    1923      }
    2024    }
    2125
    22     public static string StringifyOutput(ExampleArgumentType type, Example example, string valueSeparator) {
     26    public static string StringifyOutput(ExampleArgumentType type, int offset, Example example, string valueSeparator) {
    2327      switch (type) {
    24         case ExampleArgumentType.Integer: return string.Join(valueSeparator, example.OutputInteger);
    25         case ExampleArgumentType.IntegerVector: return "[" + string.Join("], [", example.OutputIntegerVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     28        case ExampleArgumentType.Integer: return example.OutputInteger[offset].ToString();
     29        case ExampleArgumentType.IntegerVector: return "[" + string.Join(", ", example.OutputIntegerVector[offset]) + "]";
    2630
    27         case ExampleArgumentType.Float: return string.Join(valueSeparator, example.OutputFloat);
    28         case ExampleArgumentType.FloatVector: return "[" + string.Join("], [", example.OutputFloatVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     31        case ExampleArgumentType.Float: return example.OutputFloat[offset].ToString(CultureInfo.CurrentUICulture);
     32        case ExampleArgumentType.FloatVector: return "[" + string.Join(", ", example.OutputFloatVector[offset]) + "]";
    2933
    30         case ExampleArgumentType.Boolean: return string.Join(valueSeparator, example.OutputBoolean);
    31         case ExampleArgumentType.Char: return string.Join(valueSeparator, example.OutputChar);
     34        case ExampleArgumentType.Boolean: return example.OutputBoolean[offset].ToString();
     35        case ExampleArgumentType.Char: return example.OutputChar[offset].ToString();
    3236
    33         case ExampleArgumentType.String: return string.Join(valueSeparator, example.OutputString);
    34         case ExampleArgumentType.Print: return string.Join(valueSeparator, example.OutputPrint);
    35         case ExampleArgumentType.StringVector: return "[" + string.Join("], [", example.OutputStringVector.Select(vector => string.Join(valueSeparator, vector))) + "]";
     37        case ExampleArgumentType.String: return example.OutputString[offset];
     38        case ExampleArgumentType.Print: return example.OutputPrint;
     39        case ExampleArgumentType.StringVector: return "[" + string.Join(", ", example.OutputStringVector[offset]) + "]";
    3640
    3741        default: return string.Empty;
     
    6266      }
    6367    }
     68
     69    public static Dictionary<ExampleArgumentType, int> CreateArgumentCountDict() {
     70      return Enum.GetValues(typeof(ExampleArgumentType)).Cast<ExampleArgumentType>().ToDictionary(type => type, _ => 0);
     71    }
    6472  }
    6573}
Note: See TracChangeset for help on using the changeset viewer.