Changeset 2916 for trunk/sources
- Timestamp:
- 03/03/10 03:14:37 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 2 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.SGA.Views/3.3/SGAView.Designer.cs
r2885 r2916 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.engineTabPage.SuspendLayout(); 47 48 this.tabControl.SuspendLayout(); 48 49 this.parametersTabPage.SuspendLayout(); 49 50 this.problemTabPage.SuspendLayout(); 51 this.resultsTabPage.SuspendLayout(); 50 52 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 51 53 this.SuspendLayout(); 54 // 55 // createUserDefinedAlgorithmButton 56 // 57 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 552); 58 this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm"); 59 // 60 // engineComboBox 61 // 62 this.engineComboBox.Size = new System.Drawing.Size(675, 21); 63 // 64 // engineTabPage 65 // 66 this.engineTabPage.Size = new System.Drawing.Size(736, 401); 67 // 68 // engineViewHost 69 // 70 this.engineViewHost.Size = new System.Drawing.Size(724, 362); 71 // 72 // tabControl 73 // 74 this.tabControl.Size = new System.Drawing.Size(744, 427); 75 // 76 // parametersTabPage 77 // 78 this.parametersTabPage.Size = new System.Drawing.Size(736, 401); 79 // 80 // problemTabPage 81 // 82 this.problemTabPage.Size = new System.Drawing.Size(736, 401); 83 // 84 // parameterCollectionView 85 // 86 this.parameterCollectionView.Size = new System.Drawing.Size(724, 389); 87 // 88 // problemViewHost 89 // 90 this.problemViewHost.Size = new System.Drawing.Size(724, 359); 91 // 92 // newProblemButton 93 // 94 this.toolTip.SetToolTip(this.newProblemButton, "New Problem"); 95 // 96 // saveProblemButton 97 // 98 this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem"); 99 // 100 // openProblemButton 101 // 102 this.toolTip.SetToolTip(this.openProblemButton, "Open Problem"); 103 // 104 // startButton 105 // 106 this.startButton.Location = new System.Drawing.Point(0, 552); 107 this.toolTip.SetToolTip(this.startButton, "Start Algorithm"); 108 // 109 // stopButton 110 // 111 this.stopButton.Location = new System.Drawing.Point(30, 552); 112 this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 113 // 114 // resetButton 115 // 116 this.resetButton.Location = new System.Drawing.Point(60, 552); 117 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 118 // 119 // executionTimeLabel 120 // 121 this.executionTimeLabel.Location = new System.Drawing.Point(518, 559); 122 // 123 // executionTimeTextBox 124 // 125 this.executionTimeTextBox.Location = new System.Drawing.Point(607, 556); 126 // 127 // resultsTabPage 128 // 129 this.resultsTabPage.Size = new System.Drawing.Size(736, 401); 130 // 131 // resultsView 132 // 133 this.resultsView.Size = new System.Drawing.Size(724, 389); 52 134 // 53 135 // nameTextBox … … 55 137 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 56 138 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 139 this.nameTextBox.Size = new System.Drawing.Size(672, 20); 140 // 141 // descriptionTextBox 142 // 143 this.descriptionTextBox.Size = new System.Drawing.Size(672, 87); 57 144 // 58 145 // SGAView … … 61 148 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 62 149 this.Name = "SGAView"; 150 this.Size = new System.Drawing.Size(744, 576); 151 this.engineTabPage.ResumeLayout(false); 152 this.engineTabPage.PerformLayout(); 63 153 this.tabControl.ResumeLayout(false); 64 154 this.parametersTabPage.ResumeLayout(false); 65 155 this.problemTabPage.ResumeLayout(false); 156 this.resultsTabPage.ResumeLayout(false); 66 157 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 67 158 this.ResumeLayout(false); … … 73 164 74 165 166 75 167 } 76 168 } -
trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLab.Algorithms.SGA-3.3.csproj
r2900 r2916 141 141 <None Include="HeuristicLabAlgorithmsSGAPlugin.cs.frame" /> 142 142 <None Include="Properties\AssemblyInfo.frame" /> 143 <None Include="SGAEngine.hl" />144 143 </ItemGroup> 145 144 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests
- Property svn:ignore
-
old new 1 1 bin 2 2 obj 3 *.user
-
- Property svn:ignore
-
trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/HeuristicLab.Algorithms.SGA-3.3.Tests.csproj
r2906 r2916 114 114 <Name>HeuristicLab.Operators-3.3</Name> 115 115 </ProjectReference> 116 <ProjectReference Include="..\..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 117 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 118 <Name>HeuristicLab.Optimization-3.3</Name> 119 </ProjectReference> 116 120 <ProjectReference Include="..\..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 117 121 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> … … 152 156 </ItemGroup> 153 157 <ItemGroup> 154 <None Include="SGA Engine.hl">158 <None Include="SGA.hl"> 155 159 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 156 160 </None> -
trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/UnitTest.cs
r2884 r2916 1 using System; 2 using System.Diagnostics; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 3 23 using System.Threading; 4 using HeuristicLab. Core;24 using HeuristicLab.Optimization; 5 25 using HeuristicLab.Persistence.Default.Xml; 6 26 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 58 78 59 79 [TestMethod] 60 [DeploymentItem(@"SGA Engine.hl")]80 [DeploymentItem(@"SGA.hl")] 61 81 public void SGAPerformanceTest() { 62 I Engine engine = (IEngine)XmlParser.Deserialize("SGAEngine.hl");63 engine.Stopped += new EventHandler(engine_Stopped);64 engine.Prepare();65 engine.Start();82 IAlgorithm sga = (IAlgorithm)XmlParser.Deserialize("SGA.hl"); 83 sga.Stopped += new EventHandler(sga_Stopped); 84 sga.Prepare(); 85 sga.Start(); 66 86 trigger.WaitOne(); 67 TestContext.WriteLine("Runtime: {0}", engine.ExecutionTime.ToString());87 TestContext.WriteLine("Runtime: {0}", sga.ExecutionTime.ToString()); 68 88 } 69 89 70 private void engine_Stopped(object sender, EventArgs e) {90 private void sga_Stopped(object sender, EventArgs e) { 71 91 trigger.Set(); 72 92 } -
trunk/sources/HeuristicLab.Core.Views/3.3/Auxiliary.cs
r2818 r2916 55 55 /// <param name="ex">The exception to format.</param> 56 56 /// <returns>The formated message.</returns> 57 private static string BuildErrorMessage(Exception ex) { 57 public static string BuildErrorMessage(Exception ex) { 58 string nl = Environment.NewLine; 58 59 StringBuilder sb = new StringBuilder(); 59 sb.Append("Sorry, but something went wrong! \n\n" + ex.Message + "\n\n"+ ex.StackTrace);60 sb.Append("Sorry, but something went wrong!" + nl + ex.Message + nl + ex.StackTrace); 60 61 61 62 while (ex.InnerException != null) { 62 63 ex = ex.InnerException; 63 sb.Append( "\n\n-----\n\n" + ex.Message + "\n\n"+ ex.StackTrace);64 sb.Append(nl + "-----" + nl + ex.Message + nl + ex.StackTrace); 64 65 } 65 66 return sb.ToString(); -
trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs
r2834 r2916 33 33 protected override void Dispose(bool disposing) { 34 34 if (disposing) { 35 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();36 35 if (components != null) components.Dispose(); 37 36 } … … 49 48 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 50 49 this.executionTimeLabel = new System.Windows.Forms.Label(); 51 this.scopeView = new HeuristicLab.Core.Views.ScopeView();52 this.resetButton = new System.Windows.Forms.Button();53 50 this.stopButton = new System.Windows.Forms.Button(); 54 51 this.startButton = new System.Windows.Forms.Button(); 55 52 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 56 this.newOperatorGraphButton = new System.Windows.Forms.Button(); 57 this.openOperatorGraphButton = new System.Windows.Forms.Button(); 58 this.saveOperatorGraphButton = new System.Windows.Forms.Button(); 59 this.tabControl = new System.Windows.Forms.TabControl(); 60 this.operatorGraphTabPage = new System.Windows.Forms.TabPage(); 61 this.operatorGraphViewHost = new HeuristicLab.Core.Views.ViewHost(); 62 this.globalScopeTabPage = new System.Windows.Forms.TabPage(); 63 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 64 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 65 this.tabControl.SuspendLayout(); 66 this.operatorGraphTabPage.SuspendLayout(); 67 this.globalScopeTabPage.SuspendLayout(); 53 this.logTextBox = new System.Windows.Forms.TextBox(); 68 54 this.SuspendLayout(); 69 55 // … … 86 72 this.executionTimeLabel.TabIndex = 4; 87 73 this.executionTimeLabel.Text = "&Execution Time:"; 88 //89 // scopeView90 //91 this.scopeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)92 | System.Windows.Forms.AnchorStyles.Left)93 | System.Windows.Forms.AnchorStyles.Right)));94 this.scopeView.Caption = "Scope";95 this.scopeView.Content = null;96 this.scopeView.Location = new System.Drawing.Point(6, 6);97 this.scopeView.Name = "scopeView";98 this.scopeView.Size = new System.Drawing.Size(782, 572);99 this.scopeView.TabIndex = 0;100 //101 // resetButton102 //103 this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));104 this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart;105 this.resetButton.Location = new System.Drawing.Point(60, 616);106 this.resetButton.Name = "resetButton";107 this.resetButton.Size = new System.Drawing.Size(24, 24);108 this.resetButton.TabIndex = 3;109 this.toolTip.SetToolTip(this.resetButton, "Reset Engine");110 this.resetButton.UseVisualStyleBackColor = true;111 this.resetButton.Click += new System.EventHandler(this.resetButton_Click);112 74 // 113 75 // stopButton … … 136 98 this.startButton.Click += new System.EventHandler(this.startButton_Click); 137 99 // 138 // newOperatorGraphButton100 // logTextBox 139 101 // 140 this.newOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument; 141 this.newOperatorGraphButton.Location = new System.Drawing.Point(6, 6); 142 this.newOperatorGraphButton.Name = "newOperatorGraphButton"; 143 this.newOperatorGraphButton.Size = new System.Drawing.Size(24, 24); 144 this.newOperatorGraphButton.TabIndex = 0; 145 this.toolTip.SetToolTip(this.newOperatorGraphButton, "Create New Operator Graph"); 146 this.newOperatorGraphButton.UseVisualStyleBackColor = true; 147 this.newOperatorGraphButton.Click += new System.EventHandler(this.newOperatorGraphButton_Click); 148 // 149 // openOperatorGraphButton 150 // 151 this.openOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open; 152 this.openOperatorGraphButton.Location = new System.Drawing.Point(36, 6); 153 this.openOperatorGraphButton.Name = "openOperatorGraphButton"; 154 this.openOperatorGraphButton.Size = new System.Drawing.Size(24, 24); 155 this.openOperatorGraphButton.TabIndex = 1; 156 this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph"); 157 this.openOperatorGraphButton.UseVisualStyleBackColor = true; 158 this.openOperatorGraphButton.Click += new System.EventHandler(this.openOperatorGraphButton_Click); 159 // 160 // saveOperatorGraphButton 161 // 162 this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save; 163 this.saveOperatorGraphButton.Location = new System.Drawing.Point(66, 6); 164 this.saveOperatorGraphButton.Name = "saveOperatorGraphButton"; 165 this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24); 166 this.saveOperatorGraphButton.TabIndex = 2; 167 this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph"); 168 this.saveOperatorGraphButton.UseVisualStyleBackColor = true; 169 this.saveOperatorGraphButton.Click += new System.EventHandler(this.saveOperatorGraphButton_Click); 170 // 171 // tabControl 172 // 173 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 102 this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 174 103 | System.Windows.Forms.AnchorStyles.Left) 175 104 | System.Windows.Forms.AnchorStyles.Right))); 176 this.tabControl.Controls.Add(this.operatorGraphTabPage); 177 this.tabControl.Controls.Add(this.globalScopeTabPage); 178 this.tabControl.Location = new System.Drawing.Point(0, 0); 179 this.tabControl.Name = "tabControl"; 180 this.tabControl.SelectedIndex = 0; 181 this.tabControl.Size = new System.Drawing.Size(802, 610); 182 this.tabControl.TabIndex = 3; 183 // 184 // operatorGraphTabPage 185 // 186 this.operatorGraphTabPage.Controls.Add(this.operatorGraphViewHost); 187 this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton); 188 this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton); 189 this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton); 190 this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22); 191 this.operatorGraphTabPage.Name = "operatorGraphTabPage"; 192 this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3); 193 this.operatorGraphTabPage.Size = new System.Drawing.Size(794, 584); 194 this.operatorGraphTabPage.TabIndex = 0; 195 this.operatorGraphTabPage.Text = "Operator Graph"; 196 this.operatorGraphTabPage.UseVisualStyleBackColor = true; 197 // 198 // operatorGraphViewHost 199 // 200 this.operatorGraphViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 201 | System.Windows.Forms.AnchorStyles.Left) 202 | System.Windows.Forms.AnchorStyles.Right))); 203 this.operatorGraphViewHost.Content = null; 204 this.operatorGraphViewHost.Location = new System.Drawing.Point(6, 36); 205 this.operatorGraphViewHost.Name = "operatorGraphViewHost"; 206 this.operatorGraphViewHost.Size = new System.Drawing.Size(782, 542); 207 this.operatorGraphViewHost.TabIndex = 3; 208 this.operatorGraphViewHost.ViewType = null; 209 // 210 // globalScopeTabPage 211 // 212 this.globalScopeTabPage.Controls.Add(this.scopeView); 213 this.globalScopeTabPage.Location = new System.Drawing.Point(4, 22); 214 this.globalScopeTabPage.Name = "globalScopeTabPage"; 215 this.globalScopeTabPage.Padding = new System.Windows.Forms.Padding(3); 216 this.globalScopeTabPage.Size = new System.Drawing.Size(794, 584); 217 this.globalScopeTabPage.TabIndex = 1; 218 this.globalScopeTabPage.Text = "Global Scope"; 219 this.globalScopeTabPage.UseVisualStyleBackColor = true; 220 // 221 // openFileDialog 222 // 223 this.openFileDialog.DefaultExt = "hl"; 224 this.openFileDialog.FileName = "Item"; 225 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*"; 226 this.openFileDialog.Title = "Open File"; 227 // 228 // saveFileDialog 229 // 230 this.saveFileDialog.DefaultExt = "hl"; 231 this.saveFileDialog.FileName = "Item"; 232 this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*"; 233 this.saveFileDialog.FilterIndex = 2; 234 this.saveFileDialog.Title = "Save File"; 105 this.logTextBox.Location = new System.Drawing.Point(0, 0); 106 this.logTextBox.Multiline = true; 107 this.logTextBox.Name = "logTextBox"; 108 this.logTextBox.ReadOnly = true; 109 this.logTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; 110 this.logTextBox.Size = new System.Drawing.Size(802, 610); 111 this.logTextBox.TabIndex = 6; 112 this.logTextBox.WordWrap = false; 235 113 // 236 114 // EngineView … … 238 116 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 239 117 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 240 this.Controls.Add(this. tabControl);118 this.Controls.Add(this.logTextBox); 241 119 this.Controls.Add(this.executionTimeTextBox); 242 120 this.Controls.Add(this.stopButton); 243 121 this.Controls.Add(this.executionTimeLabel); 244 this.Controls.Add(this.resetButton);245 122 this.Controls.Add(this.startButton); 246 123 this.Name = "EngineView"; 247 124 this.Size = new System.Drawing.Size(802, 640); 248 this.tabControl.ResumeLayout(false);249 this.operatorGraphTabPage.ResumeLayout(false);250 this.globalScopeTabPage.ResumeLayout(false);251 125 this.ResumeLayout(false); 252 126 this.PerformLayout(); … … 258 132 protected System.Windows.Forms.TextBox executionTimeTextBox; 259 133 protected System.Windows.Forms.Label executionTimeLabel; 260 protected System.Windows.Forms.Button resetButton;261 134 protected System.Windows.Forms.Button stopButton; 262 135 protected System.Windows.Forms.Button startButton; 263 protected HeuristicLab.Core.Views.ScopeView scopeView;264 136 protected System.Windows.Forms.ToolTip toolTip; 265 protected System.Windows.Forms.TabControl tabControl; 266 protected System.Windows.Forms.TabPage globalScopeTabPage; 267 protected System.Windows.Forms.OpenFileDialog openFileDialog; 268 protected System.Windows.Forms.SaveFileDialog saveFileDialog; 269 protected System.Windows.Forms.TabPage operatorGraphTabPage; 270 protected System.Windows.Forms.Button saveOperatorGraphButton; 271 protected System.Windows.Forms.Button openOperatorGraphButton; 272 protected System.Windows.Forms.Button newOperatorGraphButton; 273 protected ViewHost operatorGraphViewHost; 137 protected System.Windows.Forms.TextBox logTextBox; 274 138 275 139 } -
trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs
r2834 r2916 21 21 22 22 using System; 23 using System.Windows.Forms;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.MainForm; 26 using HeuristicLab.Persistence.Default.Xml;27 25 28 26 namespace HeuristicLab.Core.Views { … … 33 31 [Content(typeof(IEngine), false)] 34 32 public partial class EngineView : ItemView { 35 protected TypeSelectorDialog typeSelectorDialog;36 33 private int executionTimeCounter; 37 34 … … 61 58 /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks> 62 59 protected override void DeregisterContentEvents() { 63 Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);64 60 Content.Prepared -= new EventHandler(Content_Prepared); 65 61 Content.Started -= new EventHandler(Content_Started); … … 76 72 protected override void RegisterContentEvents() { 77 73 base.RegisterContentEvents(); 78 Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);79 74 Content.Prepared += new EventHandler(Content_Prepared); 80 75 Content.Started += new EventHandler(Content_Started); … … 91 86 base.OnContentChanged(); 92 87 stopButton.Enabled = false; 88 logTextBox.Clear(); 93 89 if (Content == null) { 94 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false; 95 operatorGraphViewHost.Enabled = false; 96 scopeView.Enabled = false; 97 startButton.Enabled = resetButton.Enabled = false; 90 logTextBox.Enabled = false; 91 startButton.Enabled = false; 98 92 executionTimeTextBox.Enabled = false; 99 93 } else { 100 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true; 101 operatorGraphViewHost.Content = Content.OperatorGraph; 102 operatorGraphViewHost.Enabled = true; 103 scopeView.Content = Content.GlobalScope; 104 scopeView.Enabled = true; 94 logTextBox.Enabled = true; 105 95 startButton.Enabled = !Content.Finished; 106 resetButton.Enabled = true;107 96 UpdateExecutionTimeTextBox(); 108 97 executionTimeTextBox.Enabled = true; … … 111 100 112 101 #region Content Events 113 protected virtual void Content_OperatorGraphChanged(object sender, EventArgs e) {114 if (InvokeRequired)115 Invoke(new EventHandler(Content_OperatorGraphChanged), sender, e);116 else117 operatorGraphViewHost.Content = Content.OperatorGraph;118 }119 102 protected virtual void Content_Prepared(object sender, EventArgs e) { 120 103 if (InvokeRequired) 121 104 Invoke(new EventHandler(Content_Prepared), sender, e); 122 105 else { 123 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;124 operatorGraphViewHost.Enabled = true;125 scopeView.Enabled = true;126 106 startButton.Enabled = !Content.Finished; 127 107 stopButton.Enabled = false; 128 resetButton.Enabled = true;129 108 UpdateExecutionTimeTextBox(); 109 logTextBox.Clear(); 110 Log("Engine prepared"); 130 111 } 131 112 } … … 135 116 Invoke(new EventHandler(Content_Started), sender, e); 136 117 else { 137 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;138 operatorGraphViewHost.Enabled = false;139 scopeView.Enabled = false;140 118 startButton.Enabled = false; 141 119 stopButton.Enabled = true; 142 resetButton.Enabled = false;143 120 UpdateExecutionTimeTextBox(); 121 Log("Engine started"); 144 122 } 145 123 } … … 148 126 Invoke(new EventHandler(Content_Stopped), sender, e); 149 127 else { 150 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;151 operatorGraphViewHost.Enabled = true;152 scopeView.Enabled = true;153 128 startButton.Enabled = !Content.Finished; 154 129 stopButton.Enabled = false; 155 resetButton.Enabled = true;156 130 UpdateExecutionTimeTextBox(); 131 if (Content.Finished) Log("Engine finished"); 132 else Log("Engine stopped"); 157 133 } 158 134 } … … 168 144 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 169 145 else 170 Auxiliary.ShowErrorMessageBox(e.Value);146 Log(Auxiliary.BuildErrorMessage(e.Value)); 171 147 } 172 148 #endregion 173 149 174 150 #region Button events 175 protected void newOperatorGraphButton_Click(object sender, EventArgs e) {176 Content.OperatorGraph = new OperatorGraph();177 }178 protected void openOperatorGraphButton_Click(object sender, EventArgs e) {179 openFileDialog.Title = "Open Operator Graph";180 if (openFileDialog.ShowDialog(this) == DialogResult.OK) {181 OperatorGraph operatorGraph = null;182 try {183 operatorGraph = XmlParser.Deserialize(openFileDialog.FileName) as OperatorGraph;184 }185 catch (Exception ex) {186 Auxiliary.ShowErrorMessageBox(ex);187 }188 if (operatorGraph == null)189 MessageBox.Show(this, "Selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);190 else191 Content.OperatorGraph = operatorGraph;192 }193 }194 protected void saveOperatorGraphButton_Click(object sender, EventArgs e) {195 saveFileDialog.Title = "Save Operator Graph";196 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {197 try {198 if (saveFileDialog.FilterIndex == 1)199 XmlGenerator.Serialize(Content.OperatorGraph, saveFileDialog.FileName, 0);200 else201 XmlGenerator.Serialize(Content.OperatorGraph, saveFileDialog.FileName, 9);202 }203 catch (Exception ex) {204 Auxiliary.ShowErrorMessageBox(ex);205 }206 }207 }208 151 protected virtual void startButton_Click(object sender, EventArgs e) { 209 152 Content.Start(); … … 211 154 protected virtual void stopButton_Click(object sender, EventArgs e) { 212 155 Content.Stop(); 213 }214 protected virtual void resetButton_Click(object sender, EventArgs e) {215 Content.Prepare();216 156 } 217 157 #endregion … … 224 164 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 225 165 } 166 protected virtual void Log(string message) { 167 if (InvokeRequired) 168 Invoke(new Action<string>(Log), message); 169 else { 170 message = DateTime.Now.ToString() + "\t" + message; 171 string[] newLines = message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); 172 string[] lines = new string[logTextBox.Lines.Length + newLines.Length]; 173 logTextBox.Lines.CopyTo(lines, 0); 174 newLines.CopyTo(lines, logTextBox.Lines.Length); 175 logTextBox.Lines = lines; 176 } 177 } 226 178 #endregion 227 179 } -
trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs
r2870 r2916 92 92 93 93 protected virtual void nameTextBox_Validating(object sender, CancelEventArgs e) { 94 if ( Content.CanChangeName) {94 if ((Content != null) && (Content.CanChangeName)) { 95 95 Content.Name = nameTextBox.Text; 96 96 -
trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.Designer.cs
r2841 r2916 82 82 this.viewsLabel.Size = new System.Drawing.Size(16, 16); 83 83 this.viewsLabel.TabIndex = 0; 84 this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view. \r\nRight-click to change current view.");84 this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view." + System.Environment.NewLine + "Right-click to change current view."); 85 85 this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick); 86 86 // -
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r2851 r2916 39 39 } 40 40 41 private OperatorGraph operatorGraph;42 /// <summary>43 /// Gets or sets the current operator graph.44 /// </summary>45 [Storable]46 public OperatorGraph OperatorGraph {47 get { return operatorGraph; }48 set {49 if (value == null) throw new ArgumentNullException();50 if (value != operatorGraph) {51 if (operatorGraph != null) operatorGraph.InitialOperatorChanged -= new EventHandler(operatorGraph_InitialOperatorChanged);52 operatorGraph = value;53 if (operatorGraph != null) operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged);54 OnOperatorGraphChanged();55 Prepare();56 }57 }58 }59 60 /// <summary>61 /// Field of the current instance that represent the global scope.62 /// </summary>63 [Storable]64 private IScope globalScope;65 /// <summary>66 /// Gets the current global scope.67 /// </summary>68 public IScope GlobalScope {69 get { return globalScope; }70 }71 72 41 [Storable] 73 42 private TimeSpan executionTime; … … 134 103 /// </summary> 135 104 protected Engine() { 136 globalScope = new Scope("Global");137 105 executionStack = new Stack<IOperation>(); 138 OperatorGraph = new OperatorGraph();139 106 } 140 107 … … 148 115 public override IDeepCloneable Clone(Cloner cloner) { 149 116 Engine clone = (Engine)base.Clone(cloner); 150 clone.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);151 clone.globalScope = (Scope)cloner.Clone(globalScope);152 117 clone.executionTime = executionTime; 153 118 IOperation[] contexts = executionStack.ToArray(); … … 162 127 Canceled = false; 163 128 running = false; 164 globalScope.Clear();165 129 ExecutionTime = new TimeSpan(); 166 130 executionStack.Clear(); … … 168 132 executionStack.Push(initialOperation); 169 133 OnPrepared(); 170 }171 /// <inheritdoc/>172 /// <remarks>Sets <c>myCanceled</c> and <c>myRunning</c> to <c>false</c>. The global scope is cleared,173 /// the execution time is reset, the execution stack is cleared and a new <see cref="AtomicOperation"/>174 /// with the initial operator is added. <br/>175 /// Calls <see cref="OnPrepared"/>.</remarks>176 public void Prepare() {177 if (OperatorGraph.InitialOperator != null)178 Prepare(new ExecutionContext(null, OperatorGraph.InitialOperator, GlobalScope));179 134 } 180 135 /// <inheritdoc/> … … 229 184 protected abstract void ProcessNextOperator(); 230 185 231 private void operatorGraph_InitialOperatorChanged(object sender, EventArgs e) {232 Prepare();233 }234 235 /// <summary>236 /// Occurs when the operator graph was changed.237 /// </summary>238 public event EventHandler OperatorGraphChanged;239 /// <summary>240 /// Fires a new <c>OperatorGraphChanged</c> event.241 /// </summary>242 protected virtual void OnOperatorGraphChanged() {243 if (OperatorGraphChanged != null)244 OperatorGraphChanged(this, EventArgs.Empty);245 }246 186 /// <summary> 247 187 /// Occurs when the execution time changed. -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs
r2834 r2916 31 31 public interface IEngine : IItem { 32 32 /// <summary> 33 /// Gets the operator graph of the current instance.34 /// </summary>35 OperatorGraph OperatorGraph { get; set; }36 /// <summary>37 /// Gets the global scope of the current instance.38 /// </summary>39 IScope GlobalScope { get; }40 41 /// <summary>42 33 /// Gets the execution time of the current instance. 43 34 /// </summary> … … 53 44 bool Finished { get; } 54 45 55 /// <summary>56 /// Prepares the engine for a new run.57 /// </summary>58 void Prepare();59 46 /// <summary> 60 47 /// Prepares the engine with a given initial operation. … … 74 61 void Stop(); 75 62 76 /// <summary>77 /// Occurs when the operator graph was changed.78 /// </summary>79 event EventHandler OperatorGraphChanged;80 63 /// <summary> 81 64 /// Occurs when the execution time was changed. -
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Tests
-
Property
svn:ignore
set to
bin
obj
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ContentView.cs
r2790 r2916 53 53 if (this.content != null) this.DeregisterContentEvents(); 54 54 this.content = value; 55 if (this.content != null) this.RegisterContentEvents(); 55 56 this.OnContentChanged(); 56 if (this.content != null) this.RegisterContentEvents();57 57 } 58 58 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs
r2882 r2916 104 104 this.parametersTabPage.Name = "parametersTabPage"; 105 105 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 106 this.parametersTabPage.Size = new System.Drawing.Size( 482, 178);106 this.parametersTabPage.Size = new System.Drawing.Size(671, 307); 107 107 this.parametersTabPage.TabIndex = 0; 108 108 this.parametersTabPage.Text = "Parameters"; … … 118 118 this.parameterCollectionView.Location = new System.Drawing.Point(6, 6); 119 119 this.parameterCollectionView.Name = "parameterCollectionView"; 120 this.parameterCollectionView.Size = new System.Drawing.Size( 470, 166);120 this.parameterCollectionView.Size = new System.Drawing.Size(659, 295); 121 121 this.parameterCollectionView.TabIndex = 0; 122 122 // … … 186 186 this.resultsTabPage.Name = "resultsTabPage"; 187 187 this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3); 188 this.resultsTabPage.Size = new System.Drawing.Size( 482, 178);188 this.resultsTabPage.Size = new System.Drawing.Size(671, 307); 189 189 this.resultsTabPage.TabIndex = 2; 190 190 this.resultsTabPage.Text = "Results"; … … 200 200 this.resultsView.Location = new System.Drawing.Point(6, 6); 201 201 this.resultsView.Name = "resultsView"; 202 this.resultsView.Size = new System.Drawing.Size( 470, 166);202 this.resultsView.Size = new System.Drawing.Size(659, 295); 203 203 this.resultsView.TabIndex = 0; 204 204 // -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r2882 r2916 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; … … 55 56 : this() { 56 57 Content = content; 58 } 59 60 protected override void OnInitialized(EventArgs e) { 61 // Set order of tab pages according to z order. 62 // NOTE: This is required due to a bug in the VS designer. 63 List<Control> tabPages = new List<Control>(); 64 for (int i = 0; i < tabControl.Controls.Count; i++) { 65 tabPages.Add(tabControl.Controls[i]); 66 } 67 tabControl.Controls.Clear(); 68 foreach (Control control in tabPages) 69 tabControl.Controls.Add(control); 70 71 base.OnInitialized(e); 57 72 } 58 73 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs
r2865 r2916 33 33 protected override void Dispose(bool disposing) { 34 34 if (disposing) { 35 if (engineTypeSelectorDialog != null) engineTypeSelectorDialog.Dispose();36 35 if (components != null) components.Dispose(); 37 36 } … … 47 46 private void InitializeComponent() { 48 47 this.engineLabel = new System.Windows.Forms.Label(); 49 this.engineTextBox = new System.Windows.Forms.TextBox();50 this.setEngineButton = new System.Windows.Forms.Button();51 48 this.createUserDefinedAlgorithmButton = new System.Windows.Forms.Button(); 49 this.engineComboBox = new System.Windows.Forms.ComboBox(); 50 this.engineTabPage = new System.Windows.Forms.TabPage(); 51 this.engineViewHost = new HeuristicLab.Core.Views.ViewHost(); 52 52 this.tabControl.SuspendLayout(); 53 53 this.parametersTabPage.SuspendLayout(); 54 54 this.problemTabPage.SuspendLayout(); 55 this.resultsTabPage.SuspendLayout(); 55 56 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 57 this.engineTabPage.SuspendLayout(); 56 58 this.SuspendLayout(); 57 59 // 58 60 // tabControl 59 61 // 60 this.tabControl.Location = new System.Drawing.Point(0, 149); 61 this.tabControl.Size = new System.Drawing.Size(656, 278); 62 this.tabControl.TabIndex = 7; 62 this.tabControl.Controls.Add(this.engineTabPage); 63 this.tabControl.Size = new System.Drawing.Size(713, 400); 64 this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0); 65 this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0); 66 this.tabControl.Controls.SetChildIndex(this.problemTabPage, 0); 67 this.tabControl.Controls.SetChildIndex(this.parametersTabPage, 0); 63 68 // 64 69 // parametersTabPage 65 70 // 66 this.parametersTabPage.Size = new System.Drawing.Size( 648, 252);71 this.parametersTabPage.Size = new System.Drawing.Size(705, 374); 67 72 // 68 73 // problemTabPage 69 74 // 70 this.problemTabPage.Size = new System.Drawing.Size( 648, 252);75 this.problemTabPage.Size = new System.Drawing.Size(705, 374); 71 76 // 72 77 // parameterCollectionView 73 78 // 74 this.parameterCollectionView.Size = new System.Drawing.Size(6 36, 240);79 this.parameterCollectionView.Size = new System.Drawing.Size(693, 362); 75 80 // 76 81 // problemViewHost 77 82 // 78 this.problemViewHost.Size = new System.Drawing.Size(470, 106); 83 this.problemViewHost.Size = new System.Drawing.Size(693, 332); 84 // 85 // newProblemButton 86 // 87 this.toolTip.SetToolTip(this.newProblemButton, "New Problem"); 88 // 89 // saveProblemButton 90 // 91 this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem"); 92 // 93 // openProblemButton 94 // 95 this.toolTip.SetToolTip(this.openProblemButton, "Open Problem"); 79 96 // 80 97 // startButton 81 98 // 82 this.startButton.Location = new System.Drawing.Point(0, 433);83 this. startButton.TabIndex = 8;99 this.startButton.Location = new System.Drawing.Point(0, 525); 100 this.toolTip.SetToolTip(this.startButton, "Start Algorithm"); 84 101 // 85 102 // stopButton 86 103 // 87 this.stopButton.Location = new System.Drawing.Point(30, 433);88 this. stopButton.TabIndex = 9;104 this.stopButton.Location = new System.Drawing.Point(30, 525); 105 this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 89 106 // 90 107 // resetButton 91 108 // 92 this.resetButton.Location = new System.Drawing.Point(60, 433);93 this. resetButton.TabIndex = 10;109 this.resetButton.Location = new System.Drawing.Point(60, 525); 110 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 94 111 // 95 112 // executionTimeLabel 96 113 // 97 this.executionTimeLabel.Location = new System.Drawing.Point(4 30, 440);98 this.executionTimeLabel.TabIndex = 12;114 this.executionTimeLabel.Location = new System.Drawing.Point(487, 532); 115 this.executionTimeLabel.TabIndex = 9; 99 116 // 100 117 // executionTimeTextBox 101 118 // 102 this.executionTimeTextBox.Location = new System.Drawing.Point(519, 437); 103 this.executionTimeTextBox.TabIndex = 13; 119 this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529); 120 this.executionTimeTextBox.TabIndex = 10; 121 // 122 // resultsTabPage 123 // 124 this.resultsTabPage.Size = new System.Drawing.Size(705, 374); 125 // 126 // resultsView 127 // 128 this.resultsView.Size = new System.Drawing.Size(693, 362); 104 129 // 105 130 // nameTextBox … … 107 132 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 108 133 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 109 this.nameTextBox.Size = new System.Drawing.Size( 584, 20);134 this.nameTextBox.Size = new System.Drawing.Size(641, 20); 110 135 // 111 136 // descriptionTextBox 112 137 // 113 this.descriptionTextBox.Size = new System.Drawing.Size( 584, 87);138 this.descriptionTextBox.Size = new System.Drawing.Size(641, 87); 114 139 // 115 140 // engineLabel 116 141 // 117 142 this.engineLabel.AutoSize = true; 118 this.engineLabel.Location = new System.Drawing.Point( 3, 124);143 this.engineLabel.Location = new System.Drawing.Point(6, 9); 119 144 this.engineLabel.Name = "engineLabel"; 120 145 this.engineLabel.Size = new System.Drawing.Size(43, 13); 121 this.engineLabel.TabIndex = 4;146 this.engineLabel.TabIndex = 0; 122 147 this.engineLabel.Text = "&Engine:"; 123 148 // 124 // engineTextBox125 //126 this.engineTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)127 | System.Windows.Forms.AnchorStyles.Right)));128 this.engineTextBox.Location = new System.Drawing.Point(72, 121);129 this.engineTextBox.Name = "engineTextBox";130 this.engineTextBox.ReadOnly = true;131 this.engineTextBox.Size = new System.Drawing.Size(554, 20);132 this.engineTextBox.TabIndex = 6;133 this.engineTextBox.DoubleClick += new System.EventHandler(this.engineTextBox_DoubleClick);134 //135 // setEngineButton136 //137 this.setEngineButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));138 this.setEngineButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Add;139 this.setEngineButton.Location = new System.Drawing.Point(632, 119);140 this.setEngineButton.Name = "setEngineButton";141 this.setEngineButton.Size = new System.Drawing.Size(24, 24);142 this.setEngineButton.TabIndex = 5;143 this.toolTip.SetToolTip(this.setEngineButton, "Set Engine");144 this.setEngineButton.UseVisualStyleBackColor = true;145 this.setEngineButton.Click += new System.EventHandler(this.setEngineButton_Click);146 //147 149 // createUserDefinedAlgorithmButton 148 150 // 149 151 this.createUserDefinedAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 150 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 433);152 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 525); 151 153 this.createUserDefinedAlgorithmButton.Name = "createUserDefinedAlgorithmButton"; 152 154 this.createUserDefinedAlgorithmButton.Size = new System.Drawing.Size(254, 24); 153 this.createUserDefinedAlgorithmButton.TabIndex = 11;155 this.createUserDefinedAlgorithmButton.TabIndex = 8; 154 156 this.createUserDefinedAlgorithmButton.Text = "&Create User Defined Algorithm"; 155 157 this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm"); … … 157 159 this.createUserDefinedAlgorithmButton.Click += new System.EventHandler(this.createUserDefinedAlgorithmButton_Click); 158 160 // 161 // engineComboBox 162 // 163 this.engineComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 164 | System.Windows.Forms.AnchorStyles.Right))); 165 this.engineComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 166 this.engineComboBox.FormattingEnabled = true; 167 this.engineComboBox.Location = new System.Drawing.Point(55, 6); 168 this.engineComboBox.Name = "engineComboBox"; 169 this.engineComboBox.Size = new System.Drawing.Size(644, 21); 170 this.engineComboBox.TabIndex = 1; 171 this.engineComboBox.SelectedIndexChanged += new System.EventHandler(this.engineComboBox_SelectedIndexChanged); 172 // 173 // engineTabPage 174 // 175 this.engineTabPage.Controls.Add(this.engineViewHost); 176 this.engineTabPage.Controls.Add(this.engineComboBox); 177 this.engineTabPage.Controls.Add(this.engineLabel); 178 this.engineTabPage.Location = new System.Drawing.Point(4, 22); 179 this.engineTabPage.Name = "engineTabPage"; 180 this.engineTabPage.Padding = new System.Windows.Forms.Padding(3); 181 this.engineTabPage.Size = new System.Drawing.Size(705, 374); 182 this.engineTabPage.TabIndex = 3; 183 this.engineTabPage.Text = "Engine"; 184 this.engineTabPage.UseVisualStyleBackColor = true; 185 // 186 // engineViewHost 187 // 188 this.engineViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 189 | System.Windows.Forms.AnchorStyles.Left) 190 | System.Windows.Forms.AnchorStyles.Right))); 191 this.engineViewHost.Content = null; 192 this.engineViewHost.Location = new System.Drawing.Point(6, 33); 193 this.engineViewHost.Name = "engineViewHost"; 194 this.engineViewHost.Size = new System.Drawing.Size(693, 335); 195 this.engineViewHost.TabIndex = 2; 196 this.engineViewHost.ViewType = null; 197 // 159 198 // EngineAlgorithmView 160 199 // 161 200 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 162 201 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 163 this.Controls.Add(this.setEngineButton);164 this.Controls.Add(this.engineTextBox);165 this.Controls.Add(this.engineLabel);166 202 this.Controls.Add(this.createUserDefinedAlgorithmButton); 167 203 this.Name = "EngineAlgorithmView"; 168 this.Size = new System.Drawing.Size( 656, 457);204 this.Size = new System.Drawing.Size(713, 549); 169 205 this.Controls.SetChildIndex(this.createUserDefinedAlgorithmButton, 0); 170 this.Controls.SetChildIndex(this.engineLabel, 0);171 this.Controls.SetChildIndex(this.engineTextBox, 0);172 this.Controls.SetChildIndex(this.setEngineButton, 0);173 206 this.Controls.SetChildIndex(this.resetButton, 0); 174 207 this.Controls.SetChildIndex(this.executionTimeLabel, 0); … … 184 217 this.parametersTabPage.ResumeLayout(false); 185 218 this.problemTabPage.ResumeLayout(false); 219 this.resultsTabPage.ResumeLayout(false); 186 220 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 221 this.engineTabPage.ResumeLayout(false); 222 this.engineTabPage.PerformLayout(); 187 223 this.ResumeLayout(false); 188 224 this.PerformLayout(); … … 193 229 194 230 protected System.Windows.Forms.Label engineLabel; 195 protected System.Windows.Forms.TextBox engineTextBox;196 protected System.Windows.Forms.Button setEngineButton;197 231 protected System.Windows.Forms.Button createUserDefinedAlgorithmButton; 198 232 protected System.Windows.Forms.ComboBox engineComboBox; 233 protected System.Windows.Forms.TabPage engineTabPage; 234 protected HeuristicLab.Core.Views.ViewHost engineViewHost; 199 235 200 236 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs
r2864 r2916 21 21 22 22 using System; 23 using System.Windows.Forms; 23 using System.Collections.Generic; 24 using System.Linq; 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; 25 using HeuristicLab.Core.Views;26 27 using HeuristicLab.MainForm; 28 using HeuristicLab.PluginInfrastructure; 27 29 28 30 namespace HeuristicLab.Optimization.Views { … … 32 34 [Content(typeof(EngineAlgorithm), true)] 33 35 public partial class EngineAlgorithmView : AlgorithmView { 34 private TypeSelectorDialog engineTypeSelectorDialog;36 private List<Type> engineTypes; 35 37 36 38 public new EngineAlgorithm Content { … … 45 47 InitializeComponent(); 46 48 } 49 47 50 /// <summary> 48 51 /// Intializes a new instance of <see cref="ItemBaseView"/> with the given <paramref name="item"/>. … … 65 68 protected override void OnContentChanged() { 66 69 base.OnContentChanged(); 70 71 if (engineTypes == null) { 72 engineTypes = ApplicationManager.Manager.GetTypes(typeof(IEngine)). 73 OrderBy(x => { 74 string name = ItemAttribute.GetName(x); 75 if (name != null) return name; 76 else return x.GetPrettyName(); 77 }).ToList(); 78 foreach (Type t in engineTypes) { 79 string name = ItemAttribute.GetName(t); 80 if (name == null) name = t.GetPrettyName(); 81 engineComboBox.Items.Add(name); 82 } 83 engineTypes.Insert(0, null); 84 engineComboBox.Items.Insert(0, "-"); 85 } 86 67 87 if (Content == null) { 68 engine TextBox.Text = "-";69 engine TextBox.Enabled = false;70 setEngineButton.Enabled = false;88 engineComboBox.Enabled = false; 89 engineViewHost.Content = null; 90 engineViewHost.Enabled = false; 71 91 } else { 72 engineTextBox.Text = Content.Engine == null ? "-" : Content.Engine.ToString(); 73 engineTextBox.Enabled = true; 74 setEngineButton.Enabled = true; 92 engineComboBox.Enabled = true; 93 if (Content.Engine == null) 94 engineComboBox.SelectedIndex = engineTypes.IndexOf(null); 95 else 96 engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType()); 97 engineViewHost.Enabled = true; 98 engineViewHost.Content = Content.Engine; 75 99 } 76 100 } … … 79 103 if (InvokeRequired) 80 104 Invoke(new EventHandler(Content_EngineChanged), sender, e); 81 else 82 engineTextBox.Text = Content.Engine == null ? "-" : Content.Engine.ToString(); 83 } 84 85 protected void setEngineButton_Click(object sender, System.EventArgs e) { 86 if (engineTypeSelectorDialog == null) { 87 engineTypeSelectorDialog = new TypeSelectorDialog(); 88 engineTypeSelectorDialog.Caption = "Select Engine"; 89 engineTypeSelectorDialog.TypeSelector.Configure(typeof(IEngine), false, false); 90 } 91 if (engineTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 92 Content.Engine = (IEngine)engineTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 105 else { 106 if (Content.Engine == null) 107 engineComboBox.SelectedIndex = engineTypes.IndexOf(null); 108 else 109 engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType()); 110 engineViewHost.Content = Content.Engine; 93 111 } 94 112 } 95 113 96 protected void engineTextBox_DoubleClick(object sender, System.EventArgs e) { 97 if (Content.Engine != null) 98 MainFormManager.CreateDefaultView(Content.Engine).Show(); 114 protected void engineComboBox_SelectedIndexChanged(object sender, EventArgs e) { 115 if (Content != null) { 116 Type t = engineTypes[engineComboBox.SelectedIndex]; 117 if (t == null) 118 Content.Engine = null; 119 else 120 Content.Engine = (IEngine)Activator.CreateInstance(t); 121 } 99 122 } 100 123 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs
r2882 r2916 52 52 this.globalScopeTabPage = new System.Windows.Forms.TabPage(); 53 53 this.globalScopeView = new HeuristicLab.Core.Views.ScopeView(); 54 this.engineTabPage.SuspendLayout(); 54 55 this.tabControl.SuspendLayout(); 55 56 this.parametersTabPage.SuspendLayout(); … … 61 62 this.SuspendLayout(); 62 63 // 63 // setEngineButton64 //65 this.toolTip.SetToolTip(this.setEngineButton, "Set Engine");66 //67 64 // createUserDefinedAlgorithmButton 68 65 // … … 73 70 this.tabControl.Controls.Add(this.operatorGraphTabPage); 74 71 this.tabControl.Controls.Add(this.globalScopeTabPage); 75 this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0);76 72 this.tabControl.Controls.SetChildIndex(this.globalScopeTabPage, 0); 77 73 this.tabControl.Controls.SetChildIndex(this.operatorGraphTabPage, 0); 74 this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0); 75 this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0); 78 76 this.tabControl.Controls.SetChildIndex(this.problemTabPage, 0); 79 77 this.tabControl.Controls.SetChildIndex(this.parametersTabPage, 0); … … 102 100 // 103 101 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 104 //105 // resultsTabPage106 //107 this.resultsTabPage.Size = new System.Drawing.Size(648, 252);108 //109 // resultsView110 //111 this.resultsView.Size = new System.Drawing.Size(636, 240);112 102 // 113 103 // nameTextBox … … 124 114 this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22); 125 115 this.operatorGraphTabPage.Name = "operatorGraphTabPage"; 126 this.operatorGraphTabPage.Size = new System.Drawing.Size( 648, 252);116 this.operatorGraphTabPage.Size = new System.Drawing.Size(705, 374); 127 117 this.operatorGraphTabPage.TabIndex = 2; 128 118 this.operatorGraphTabPage.Text = "Operator Graph"; … … 170 160 this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33); 171 161 this.operatorGraphViewHost.Name = "operatorGraphViewHost"; 172 this.operatorGraphViewHost.Size = new System.Drawing.Size(6 42, 216);162 this.operatorGraphViewHost.Size = new System.Drawing.Size(699, 338); 173 163 this.operatorGraphViewHost.TabIndex = 0; 174 164 this.operatorGraphViewHost.ViewType = null; … … 179 169 this.globalScopeTabPage.Location = new System.Drawing.Point(4, 22); 180 170 this.globalScopeTabPage.Name = "globalScopeTabPage"; 181 this.globalScopeTabPage.Size = new System.Drawing.Size( 648, 252);171 this.globalScopeTabPage.Size = new System.Drawing.Size(705, 374); 182 172 this.globalScopeTabPage.TabIndex = 3; 183 173 this.globalScopeTabPage.Text = "Global Scope"; … … 193 183 this.globalScopeView.Location = new System.Drawing.Point(3, 3); 194 184 this.globalScopeView.Name = "globalScopeView"; 195 this.globalScopeView.Size = new System.Drawing.Size(6 42, 246);185 this.globalScopeView.Size = new System.Drawing.Size(699, 368); 196 186 this.globalScopeView.TabIndex = 0; 197 187 // … … 201 191 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 202 192 this.Name = "UserDefinedAlgorithmView"; 193 this.engineTabPage.ResumeLayout(false); 194 this.engineTabPage.PerformLayout(); 203 195 this.tabControl.ResumeLayout(false); 204 196 this.parametersTabPage.ResumeLayout(false); -
trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs
r2882 r2916 21 21 22 22 using System; 23 using System.Linq; 23 24 using HeuristicLab.Collections; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.PluginInfrastructure; 27 29 28 30 namespace HeuristicLab.Optimization { … … 97 99 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 98 100 OperatorGraph = new OperatorGraph(); 101 InitializeEngine(); 99 102 } 100 103 protected EngineAlgorithm(string name) … … 103 106 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 104 107 OperatorGraph = new OperatorGraph(); 108 InitializeEngine(); 105 109 } 106 110 protected EngineAlgorithm(string name, ParameterCollection parameters) … … 109 113 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 110 114 OperatorGraph = new OperatorGraph(); 115 InitializeEngine(); 111 116 } 112 117 protected EngineAlgorithm(string name, string description) … … 115 120 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 116 121 OperatorGraph = new OperatorGraph(); 122 InitializeEngine(); 117 123 } 118 124 protected EngineAlgorithm(string name, string description, ParameterCollection parameters) … … 121 127 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 122 128 OperatorGraph = new OperatorGraph(); 129 InitializeEngine(); 130 } 131 132 private void InitializeEngine() { 133 var types = ApplicationManager.Manager.GetTypes(typeof(IEngine)); 134 Type t = types.FirstOrDefault(x => x.Name.Equals("SequentialEngine")); 135 if (t == null) t = types.FirstOrDefault(); 136 if (t != null) Engine = (IEngine)Activator.CreateInstance(t); 123 137 } 124 138 -
trunk/sources/HeuristicLab.PluginInfrastructure/Main.cs
r2790 r2916 99 99 100 100 private static string BuildErrorMessage(Exception ex) { 101 string nl = Environment.NewLine; 101 102 StringBuilder sb = new StringBuilder(); 102 sb.Append("Sorry, but something went wrong! \n\n" + ex.Message + "\n\n"+ ex.StackTrace);103 sb.Append("Sorry, but something went wrong!" + nl + ex.Message + nl + ex.StackTrace); 103 104 104 105 while (ex.InnerException != null) { 105 106 ex = ex.InnerException; 106 sb.Append( "\n\n-----\n\n" + ex.Message + "\n\n"+ ex.StackTrace);107 sb.Append(nl + "-----" + nl + ex.Message + nl + ex.StackTrace); 107 108 } 108 109 return sb.ToString();
Note: See TracChangeset
for help on using the changeset viewer.