Changeset 17439
- Timestamp:
- 02/17/20 15:13:17 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/HeuristicLab.JsonInterface.App.csproj
r17324 r17439 83 83 <Name>HeuristicLab.Problems.Instances-3.3</Name> 84 84 </ProjectReference> 85 <ProjectReference Include="..\HeuristicLab.SequentialEngine\3.3\HeuristicLab.SequentialEngine-3.3.csproj"> 86 <Project>{DC3D7072-7999-4719-B65D-3997744D5DC1}</Project> 87 <Name>HeuristicLab.SequentialEngine-3.3</Name> 88 </ProjectReference> 85 89 </ItemGroup> 86 90 <ItemGroup /> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs
r17395 r17439 7 7 using System.Threading.Tasks; 8 8 using HeuristicLab.Optimization; 9 using HeuristicLab.SequentialEngine; 9 10 10 11 namespace HeuristicLab.JsonInterface.App { … … 12 13 internal static void Run(string template, string config, string outputFile = @"C:\Workspace\test.txt") { 13 14 IOptimizer optimizer = JsonTemplateInstantiator.Instantiate(template, config); 14 15 if(optimizer is EngineAlgorithm e) 16 e.Engine = new SequentialEngine.SequentialEngine(); 17 15 18 Task task = optimizer.StartAsync(); 16 19 while(!task.IsCompleted) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs
r17433 r17439 42 42 set { 43 43 selected = value; 44 if(TreeNode != null) 44 if(TreeNode != null) { 45 45 TreeNode.ForeColor = (selected ? Color.Black : Color.Red); 46 TreeNode.Checked = value; 47 } 46 48 if (TreeView != null) 47 49 TreeView.Refresh(); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs
r17435 r17439 30 30 this.groupBoxDetails = new System.Windows.Forms.GroupBox(); 31 31 this.panel = new System.Windows.Forms.Panel(); 32 this.jsonItemBindingSource = new System.Windows.Forms.BindingSource(this.components);33 32 this.resultItems = new System.Windows.Forms.CheckedListBox(); 34 33 this.groupBox2 = new System.Windows.Forms.GroupBox(); 35 34 this.groupBox3 = new System.Windows.Forms.GroupBox(); 36 this.splitContainer1 = new System.Windows.Forms.SplitContainer();37 35 this.splitContainer2 = new System.Windows.Forms.SplitContainer(); 36 this.tabControl1 = new System.Windows.Forms.TabControl(); 37 this.tabPage1 = new System.Windows.Forms.TabPage(); 38 this.tabPage2 = new System.Windows.Forms.TabPage(); 39 this.jsonItemBindingSource = new System.Windows.Forms.BindingSource(this.components); 38 40 this.groupBoxDetails.SuspendLayout(); 39 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).BeginInit();40 41 this.groupBox2.SuspendLayout(); 41 42 this.groupBox3.SuspendLayout(); 42 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();43 this.splitContainer1.Panel1.SuspendLayout();44 this.splitContainer1.Panel2.SuspendLayout();45 this.splitContainer1.SuspendLayout();46 43 ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); 47 44 this.splitContainer2.Panel1.SuspendLayout(); 48 45 this.splitContainer2.Panel2.SuspendLayout(); 49 46 this.splitContainer2.SuspendLayout(); 47 this.tabControl1.SuspendLayout(); 48 this.tabPage1.SuspendLayout(); 49 this.tabPage2.SuspendLayout(); 50 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).BeginInit(); 50 51 this.SuspendLayout(); 51 52 // … … 60 61 this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 61 62 | System.Windows.Forms.AnchorStyles.Right))); 62 this.exportButton.Location = new System.Drawing.Point( 3, 570);63 this.exportButton.Location = new System.Drawing.Point(591, 578); 63 64 this.exportButton.Name = "exportButton"; 64 this.exportButton.Size = new System.Drawing.Size( 422, 29);65 this.exportButton.Size = new System.Drawing.Size(229, 29); 65 66 this.exportButton.TabIndex = 1; 66 67 this.exportButton.Text = "Export"; … … 73 74 | System.Windows.Forms.AnchorStyles.Left) 74 75 | System.Windows.Forms.AnchorStyles.Right))); 76 this.treeView.CheckBoxes = true; 75 77 this.treeView.Location = new System.Drawing.Point(6, 19); 76 78 this.treeView.Name = "treeView"; 77 this.treeView.Size = new System.Drawing.Size(35 3, 327);79 this.treeView.Size = new System.Drawing.Size(352, 497); 78 80 this.treeView.TabIndex = 3; 79 81 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); … … 85 87 | System.Windows.Forms.AnchorStyles.Right))); 86 88 this.groupBoxDetails.Controls.Add(this.panel); 87 this.groupBoxDetails.Location = new System.Drawing.Point(3, 3);89 this.groupBoxDetails.Location = new System.Drawing.Point(3, 0); 88 90 this.groupBoxDetails.Name = "groupBoxDetails"; 89 this.groupBoxDetails.Size = new System.Drawing.Size(4 22, 561);91 this.groupBoxDetails.Size = new System.Drawing.Size(415, 522); 90 92 this.groupBoxDetails.TabIndex = 4; 91 93 this.groupBoxDetails.TabStop = false; … … 100 102 this.panel.Location = new System.Drawing.Point(7, 20); 101 103 this.panel.Name = "panel"; 102 this.panel.Size = new System.Drawing.Size(40 9, 535);104 this.panel.Size = new System.Drawing.Size(402, 496); 103 105 this.panel.TabIndex = 0; 104 //105 // jsonItemBindingSource106 //107 this.jsonItemBindingSource.DataSource = typeof(HeuristicLab.JsonInterface.IJsonItem);108 106 // 109 107 // resultItems … … 115 113 this.resultItems.Location = new System.Drawing.Point(6, 19); 116 114 this.resultItems.Name = "resultItems"; 117 this.resultItems.Size = new System.Drawing.Size( 353, 199);115 this.resultItems.Size = new System.Drawing.Size(777, 499); 118 116 this.resultItems.TabIndex = 5; 119 117 // … … 124 122 | System.Windows.Forms.AnchorStyles.Right))); 125 123 this.groupBox2.Controls.Add(this.treeView); 126 this.groupBox2.Location = new System.Drawing.Point( 3, 3);124 this.groupBox2.Location = new System.Drawing.Point(0, 0); 127 125 this.groupBox2.Name = "groupBox2"; 128 this.groupBox2.Size = new System.Drawing.Size(36 5, 352);126 this.groupBox2.Size = new System.Drawing.Size(364, 522); 129 127 this.groupBox2.TabIndex = 6; 130 128 this.groupBox2.TabStop = false; … … 137 135 | System.Windows.Forms.AnchorStyles.Right))); 138 136 this.groupBox3.Controls.Add(this.resultItems); 139 this.groupBox3.Location = new System.Drawing.Point( 3, 3);137 this.groupBox3.Location = new System.Drawing.Point(6, 6); 140 138 this.groupBox3.Name = "groupBox3"; 141 this.groupBox3.Size = new System.Drawing.Size( 365, 231);139 this.groupBox3.Size = new System.Drawing.Size(789, 522); 142 140 this.groupBox3.TabIndex = 7; 143 141 this.groupBox3.TabStop = false; 144 142 this.groupBox3.Text = "Result Elements"; 145 143 // 146 // splitContainer1147 //148 this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)149 | System.Windows.Forms.AnchorStyles.Left)150 | System.Windows.Forms.AnchorStyles.Right)));151 this.splitContainer1.Location = new System.Drawing.Point(3, 3);152 this.splitContainer1.Name = "splitContainer1";153 this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;154 //155 // splitContainer1.Panel1156 //157 this.splitContainer1.Panel1.Controls.Add(this.groupBox2);158 //159 // splitContainer1.Panel2160 //161 this.splitContainer1.Panel2.Controls.Add(this.groupBox3);162 this.splitContainer1.Size = new System.Drawing.Size(371, 599);163 this.splitContainer1.SplitterDistance = 358;164 this.splitContainer1.TabIndex = 8;165 //166 144 // splitContainer2 167 145 // … … 169 147 | System.Windows.Forms.AnchorStyles.Left) 170 148 | System.Windows.Forms.AnchorStyles.Right))); 171 this.splitContainer2.Location = new System.Drawing.Point( 12, 12);149 this.splitContainer2.Location = new System.Drawing.Point(6, 6); 172 150 this.splitContainer2.Name = "splitContainer2"; 173 151 // 174 152 // splitContainer2.Panel1 175 153 // 176 this.splitContainer2.Panel1.Controls.Add(this. splitContainer1);154 this.splitContainer2.Panel1.Controls.Add(this.groupBox2); 177 155 // 178 156 // splitContainer2.Panel2 179 157 // 180 158 this.splitContainer2.Panel2.Controls.Add(this.groupBoxDetails); 181 this.splitContainer2.Panel2.Controls.Add(this.exportButton); 182 this.splitContainer2.Size = new System.Drawing.Size(809, 605); 183 this.splitContainer2.SplitterDistance = 377; 159 this.splitContainer2.Size = new System.Drawing.Size(789, 522); 160 this.splitContainer2.SplitterDistance = 367; 184 161 this.splitContainer2.TabIndex = 9; 162 // 163 // tabControl1 164 // 165 this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 166 | System.Windows.Forms.AnchorStyles.Left) 167 | System.Windows.Forms.AnchorStyles.Right))); 168 this.tabControl1.Controls.Add(this.tabPage1); 169 this.tabControl1.Controls.Add(this.tabPage2); 170 this.tabControl1.Location = new System.Drawing.Point(12, 12); 171 this.tabControl1.Name = "tabControl1"; 172 this.tabControl1.SelectedIndex = 0; 173 this.tabControl1.Size = new System.Drawing.Size(809, 560); 174 this.tabControl1.TabIndex = 10; 175 // 176 // tabPage1 177 // 178 this.tabPage1.Controls.Add(this.splitContainer2); 179 this.tabPage1.Location = new System.Drawing.Point(4, 22); 180 this.tabPage1.Name = "tabPage1"; 181 this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 182 this.tabPage1.Size = new System.Drawing.Size(801, 534); 183 this.tabPage1.TabIndex = 0; 184 this.tabPage1.Text = "Parameters"; 185 this.tabPage1.UseVisualStyleBackColor = true; 186 // 187 // tabPage2 188 // 189 this.tabPage2.Controls.Add(this.groupBox3); 190 this.tabPage2.Location = new System.Drawing.Point(4, 22); 191 this.tabPage2.Name = "tabPage2"; 192 this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 193 this.tabPage2.Size = new System.Drawing.Size(801, 534); 194 this.tabPage2.TabIndex = 1; 195 this.tabPage2.Text = "Results"; 196 this.tabPage2.UseVisualStyleBackColor = true; 197 // 198 // jsonItemBindingSource 199 // 200 this.jsonItemBindingSource.DataSource = typeof(HeuristicLab.JsonInterface.IJsonItem); 185 201 // 186 202 // ExportJsonDialog … … 188 204 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 189 205 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 190 this.ClientSize = new System.Drawing.Size(833, 629); 191 this.Controls.Add(this.splitContainer2); 206 this.ClientSize = new System.Drawing.Size(833, 619); 207 this.Controls.Add(this.exportButton); 208 this.Controls.Add(this.tabControl1); 192 209 this.Name = "ExportJsonDialog"; 193 210 this.RightToLeft = System.Windows.Forms.RightToLeft.No; … … 195 212 this.Text = "Export Json"; 196 213 this.groupBoxDetails.ResumeLayout(false); 197 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).EndInit();198 214 this.groupBox2.ResumeLayout(false); 199 215 this.groupBox3.ResumeLayout(false); 200 this.splitContainer1.Panel1.ResumeLayout(false);201 this.splitContainer1.Panel2.ResumeLayout(false);202 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();203 this.splitContainer1.ResumeLayout(false);204 216 this.splitContainer2.Panel1.ResumeLayout(false); 205 217 this.splitContainer2.Panel2.ResumeLayout(false); 206 218 ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); 207 219 this.splitContainer2.ResumeLayout(false); 220 this.tabControl1.ResumeLayout(false); 221 this.tabPage1.ResumeLayout(false); 222 this.tabPage2.ResumeLayout(false); 223 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).EndInit(); 208 224 this.ResumeLayout(false); 209 225 … … 222 238 private System.Windows.Forms.GroupBox groupBox2; 223 239 private System.Windows.Forms.GroupBox groupBox3; 224 private System.Windows.Forms.SplitContainer splitContainer1;225 240 private System.Windows.Forms.SplitContainer splitContainer2; 241 private System.Windows.Forms.TabControl tabControl1; 242 private System.Windows.Forms.TabPage tabPage1; 243 private System.Windows.Forms.TabPage tabPage2; 226 244 } 227 245 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17436 r17439 18 18 private static SaveFileDialog SaveFileDialog { get; set; } 19 19 private IDictionary<int, UserControl> Hash2Control { get; set; } = new Dictionary<int, UserControl>(); 20 private IDictionary<TreeNode, JsonItemVMBase> Node2VM { get; set; } = new Dictionary<TreeNode, JsonItemVMBase>(); 20 21 private IJsonItem Root { get; set; } 21 22 private IOptimizer Optimizer { get; set; } … … 38 39 Root = JsonItemConverter.Extract(Optimizer); 39 40 TreeNode parent = new TreeNode(Root.Name); 40 41 treeView.AfterCheck += TreeView_AfterCheck; 41 42 BuildTreeNode(parent, Root); 42 43 treeView.Nodes.Add(parent); … … 44 45 45 46 } 47 } 48 49 private void TreeView_AfterCheck(object sender, TreeViewEventArgs e) { 50 if (e.Action != TreeViewAction.Unknown) { 51 if (Node2VM.TryGetValue(e.Node, out JsonItemVMBase vm)) { 52 vm.Selected = e.Node.Checked; 53 } 54 } 46 55 } 47 56 … … 107 116 vm.TreeNode = node; 108 117 vm.TreeView = treeView; 118 Node2VM.Add(node, vm); 119 node.Checked = vm.Selected; 109 120 UserControl control = vm.GetControl(); 110 121 Hash2Control.Add(node.GetHashCode(), control); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Constants.cs
r17435 r17439 15 15 internal const string HLFileLocation = "HLFileLocation"; 16 16 internal const string Parameters = "Parameters"; 17 internal const string ActivatedResults = "ActivatedResults";17 internal const string Results = "Results"; 18 18 19 19 internal const string Template = @"{ … … 23 23 }, 24 24 '" + Parameters + @"': [], 25 '" + ActivatedResults + @"': []25 '" + Results + @"': [] 26 26 }"; 27 27 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs
r17433 r17439 16 16 17 17 dynamic val = item as dynamic; 18 foreach (var op in val.Operators) 19 val.Operators.SetItemCheckedState(op, GetOperatorState(op.Name, data)); 18 foreach (var op in val.Operators) { 19 IJsonItem childItem = GetChildItem(op.Name, data); 20 if(childItem != null) { 21 if(childItem.Value is bool b) { 22 val.Operators.SetItemCheckedState(op, b); 23 } 24 root.Inject((IItem)op, childItem, root); 25 } 26 } 20 27 } 21 28 … … 24 31 dynamic val = value as dynamic; 25 32 foreach (var op in val.Operators) { 26 item.AddChildren(new BoolJsonItem() {33 IJsonItem operatorItem = new BoolJsonItem() { 27 34 Name = op.Name, 28 35 Description = op.Description, 29 36 Value = val.Operators.ItemChecked(op), 30 37 Range = new bool[] { false, true } 31 }); 38 }; 39 IJsonItem c = root.Extract((IItem)op, root); 40 if(c != null && c.Children != null) 41 operatorItem.AddChildren(c.Children); 42 item.AddChildren(operatorItem); 32 43 } 33 44 return item; … … 42 53 return false; 43 54 } 55 56 private IJsonItem GetChildItem(string name, IJsonItem parent) { 57 foreach(var c in parent.Children) { 58 if (c.Name == name) return c; 59 } 60 return null; 61 } 44 62 #endregion 45 63 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueParameterConverter.cs
r17433 r17439 16 16 if (parameter.ActualValue == null && data.Value != null) 17 17 parameter.ActualValue = Instantiate(parameter.DataType); 18 root.Inject(parameter.ActualValue, data, root); 18 19 if(parameter.ActualValue != null) { 20 if (data.Children == null || data.Children.Count == 0) 21 root.Inject(parameter.ActualValue, data, root); 22 else 23 root.Inject(parameter.ActualValue, data.Children?.First(), root); 24 25 } 19 26 } 20 27 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
r17410 r17439 64 64 <Compile Include="Converters\AlgorithmConverter.cs" /> 65 65 <Compile Include="Converters\RegressionProblemDataConverter.cs" /> 66 <Compile Include="Converters\ResultParameterConverter.cs" /> 66 67 <Compile Include="Converters\ValueLookupParameterConverter.cs" /> 67 68 <Compile Include="Converters\ValueRangeConverter.cs" /> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs
r17435 r17439 29 29 JArray resultItems = new JArray(); 30 30 IList<IJsonItem> jsonItems = new List<IJsonItem>(); 31 string fullPath = Path.Get DirectoryName(Path.GetFullPath(path));31 string fullPath = Path.GetFullPath(path); 32 32 33 33 // recursively filter items with values/ranges/actualNames … … 51 51 template[Constants.Metadata][Constants.HLFileLocation] = hlFilePath; 52 52 template[Constants.Parameters] = parameterItems; 53 template[Constants. ActivatedResults] = resultItems;53 template[Constants.Results] = resultItems; 54 54 55 55 // serialize template and write file -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
r17410 r17439 20 20 = new Dictionary<Type, IJsonItemConverter>(); 21 21 22 private IDictionary<int, IJsonItem> Cache { get; set; } 22 private IDictionary<int, IJsonItem> InjectCache { get; set; } 23 = new Dictionary<int, IJsonItem>(); 24 25 private IDictionary<int, IJsonItem> ExtractCache { get; set; } 23 26 = new Dictionary<int, IJsonItem>(); 24 27 … … 52 55 53 56 public void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 54 if (item != null && !Cache.ContainsKey(item.GetHashCode())) {57 if (item != null && !InjectCache.ContainsKey(item.GetHashCode())) { 55 58 IJsonItemConverter converter = GetConverter(item.GetType()); 56 59 if(converter != null) converter.Inject(item, data, root); 60 InjectCache.Add(item.GetHashCode(), data); 57 61 } 58 62 } … … 60 64 public IJsonItem Extract(IItem item, IJsonItemConverter root) { 61 65 int hash = item.GetHashCode(); 62 if ( Cache.TryGetValue(hash, out IJsonItem val))66 if (ExtractCache.TryGetValue(hash, out IJsonItem val)) 63 67 return val; 64 68 else { … … 66 70 if (converter == null) return new UnsupportedJsonItem(); 67 71 IJsonItem tmp = GetConverter(item.GetType()).Extract(item, root); 68 Cache.Add(hash, tmp);72 ExtractCache.Add(hash, tmp); 69 73 return tmp; 70 74 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs
r17435 r17439 58 58 59 59 // get algorthm data and object 60 IJsonItem optimizerData = instData.Objects [optimizerName];61 60 IJsonItem optimizerData = instData.Objects.First().Value; 61 62 62 // inject configuration 63 63 JsonItemConverter.Inject(optimizer, optimizerData); -
branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs
r17436 r17439 46 46 47 47 JCGenerator generator = new JCGenerator(); 48 generator.GenerateTemplate(@"C:\Workspace \Template.json", alg);49 JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json");50 /*48 generator.GenerateTemplate(@"C:\Workspace", "Template", alg); 49 //JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json"); 50 51 51 List<ICommandLineArgument> arguments = new List<ICommandLineArgument>(); 52 52 arguments.Add(new StartArgument("JsonInterface")); … … 55 55 56 56 app.Run(arguments.ToArray()); 57 */57 58 58 } 59 59 }
Note: See TracChangeset
for help on using the changeset viewer.