Changeset 14952 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views
- Timestamp:
- 05/10/17 11:23:05 (8 years ago)
- 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 44 44 | System.Windows.Forms.AnchorStyles.Left) 45 45 | System.Windows.Forms.AnchorStyles.Right))); 46 this.dataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; 46 47 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 47 48 this.dataGridView.Location = new System.Drawing.Point(6, 26); 48 49 this.dataGridView.Name = "dataGridView"; 50 this.dataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders; 49 51 this.dataGridView.Size = new System.Drawing.Size(832, 612); 50 52 this.dataGridView.TabIndex = 3; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.cs
r14908 r14952 4 4 using System.Collections.Generic; 5 5 6 using HeuristicLab.BenchmarkSuite.Problems;7 6 using HeuristicLab.Core.Views; 8 7 using HeuristicLab.MainForm; … … 152 151 nameTextBox.Text = Content.Name; 153 152 154 var cellTemplate = new DataGridViewTextBoxCell ();153 var cellTemplate = new DataGridViewTextBoxCell { Style = { WrapMode = DataGridViewTriState.True } }; 155 154 156 155 for (var i = 0; i < Content.InputArgumentTypes.Length; i++) { … … 176 175 } 177 176 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 }; 182 184 row.CreateCells(dataGridView); 183 185 186 var inputArgumentCountDict = ViewHelper.CreateArgumentCountDict(); 184 187 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(); 188 195 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]++; 190 200 } 191 201 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/DataEditorView.resx
r14897 r14952 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <root> 3 <!-- 4 Microsoft ResX Schema 5 3 <!-- 4 Microsoft ResX Schema 5 6 6 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 11 11 associated with the data types. 12 12 13 13 Example: 14 14 15 15 ... ado.net/XML headers & schema ... 16 16 <resheader name="resmimetype">text/microsoft-resx</resheader> … … 27 27 <comment>This is a comment</comment> 28 28 </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 31 31 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 37 37 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 41 41 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 45 45 read any of the formats listed below. 46 46 47 47 mimetype: application/x-microsoft.net.object.binary.base64 48 value : The object must be serialized with 48 value : The object must be serialized with 49 49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter 50 50 : and then encoded with base64 encoding. 51 51 52 52 mimetype: application/x-microsoft.net.object.soap.base64 53 value : The object must be serialized with 53 value : The object must be serialized with 54 54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter 55 55 : and then encoded with base64 encoding. 56 56 57 57 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 59 59 : using a System.ComponentModel.TypeConverter 60 60 : and then encoded with base64 encoding. … … 67 67 <xsd:element name="metadata"> 68 68 <xsd:complexType> 69 <xsd: items>69 <xsd:sequence> 70 70 <xsd:element name="value" type="xsd:string" minOccurs="0" /> 71 </xsd: items>71 </xsd:sequence> 72 72 <xsd:attribute name="name" use="required" type="xsd:string" /> 73 73 <xsd:attribute name="type" type="xsd:string" /> … … 84 84 <xsd:element name="data"> 85 85 <xsd:complexType> 86 <xsd: items>86 <xsd:sequence> 87 87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> 88 88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> 89 </xsd: items>89 </xsd:sequence> 90 90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> 91 91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> … … 96 96 <xsd:element name="resheader"> 97 97 <xsd:complexType> 98 <xsd: items>98 <xsd:sequence> 99 99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> 100 </xsd: items>100 </xsd:sequence> 101 101 <xsd:attribute name="name" type="xsd:string" use="required" /> 102 102 </xsd:complexType> -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/ViewHelper.cs
r14909 r14952 1 1 namespace HeuristicLab.BenchmarkSuite.Views { 2 using System; 3 using System.Collections.Generic; 4 using System.Globalization; 2 5 using System.Linq; 3 6 4 7 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) { 6 9 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]) + "]"; 9 12 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]) + "]"; 12 15 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(); 15 18 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 18 22 default: return string.Empty; 19 23 } 20 24 } 21 25 22 public static string StringifyOutput(ExampleArgumentType type, Example example, string valueSeparator) {26 public static string StringifyOutput(ExampleArgumentType type, int offset, Example example, string valueSeparator) { 23 27 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]) + "]"; 26 30 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]) + "]"; 29 33 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(); 32 36 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]) + "]"; 36 40 37 41 default: return string.Empty; … … 62 66 } 63 67 } 68 69 public static Dictionary<ExampleArgumentType, int> CreateArgumentCountDict() { 70 return Enum.GetValues(typeof(ExampleArgumentType)).Cast<ExampleArgumentType>().ToDictionary(type => type, _ => 0); 71 } 64 72 } 65 73 }
Note: See TracChangeset
for help on using the changeset viewer.