Changeset 3260
- Timestamp:
- 04/03/10 06:04:49 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs
r2917 r3260 103 103 else { 104 104 UpdateExecutionTimeTextBox(); 105 logTextBox.Clear();106 105 Log("Engine prepared"); 107 106 } … … 127 126 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) { 128 127 executionTimeCounter++; 129 if ((executionTimeCounter == 100) || !Content.Running) {128 if ((executionTimeCounter >= 100) || !Content.Running) { 130 129 executionTimeCounter = 0; 131 130 UpdateExecutionTimeTextBox(); -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameterizedItem.cs
r2834 r3260 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Collections; 23 24 … … 28 29 public interface IParameterizedItem : IItem { 29 30 IObservableKeyedCollection<string, IParameter> Parameters { get; } 31 32 void CollectParameterValues(IDictionary<string, IItem> values); 30 33 } 31 34 } -
trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs
r3017 r3260 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using System.Linq; 22 24 using HeuristicLab.Collections; 23 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 82 84 return clone; 83 85 } 86 87 public virtual void CollectParameterValues(IDictionary<string, IItem> values) { 88 foreach (IValueParameter param in parameters.OfType<IValueParameter>()) { 89 values.Add(param.Name, param.Value != null ? (IItem)param.Value.Clone() : null); 90 if (param.Value is IParameterizedItem) { 91 Dictionary<string, IItem> children = new Dictionary<string, IItem>(); 92 ((IParameterizedItem)param.Value).CollectParameterValues(children); 93 foreach (string key in children.Keys) 94 values.Add(param.Name + "." + key, children[key]); 95 } 96 } 97 } 84 98 } 85 99 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3226 r3260 174 174 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) { 175 175 executionTimeCounter++; 176 if ((executionTimeCounter == 100) || !Content.Running) {176 if ((executionTimeCounter >= 100) || !Content.Running) { 177 177 executionTimeCounter = 0; 178 178 UpdateExecutionTimeTextBox(); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs
r3246 r3260 52 52 this.newAlgorithmButton = new System.Windows.Forms.Button(); 53 53 this.algorithmViewHost = new HeuristicLab.Core.Views.ViewHost(); 54 this.r esultsTabPage = new System.Windows.Forms.TabPage();54 this.runsTabPage = new System.Windows.Forms.TabPage(); 55 55 this.startButton = new System.Windows.Forms.Button(); 56 56 this.stopButton = new System.Windows.Forms.Button(); … … 62 62 this.repetitionsLabel = new System.Windows.Forms.Label(); 63 63 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 64 this.r esultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();64 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 65 65 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 66 66 this.tabControl.SuspendLayout(); 67 67 this.algorithmTabPage.SuspendLayout(); 68 this.r esultsTabPage.SuspendLayout();68 this.runsTabPage.SuspendLayout(); 69 69 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 70 70 this.SuspendLayout(); … … 86 86 | System.Windows.Forms.AnchorStyles.Right))); 87 87 this.tabControl.Controls.Add(this.algorithmTabPage); 88 this.tabControl.Controls.Add(this.r esultsTabPage);88 this.tabControl.Controls.Add(this.runsTabPage); 89 89 this.tabControl.Location = new System.Drawing.Point(0, 78); 90 90 this.tabControl.Name = "tabControl"; … … 152 152 this.algorithmViewHost.ViewType = null; 153 153 // 154 // r esultsTabPage155 // 156 this.r esultsTabPage.Controls.Add(this.resultsView);157 this.r esultsTabPage.Location = new System.Drawing.Point(4, 22);158 this.r esultsTabPage.Name = "resultsTabPage";159 this.r esultsTabPage.Padding = new System.Windows.Forms.Padding(3);160 this.r esultsTabPage.Size = new System.Drawing.Size(671, 348);161 this.r esultsTabPage.TabIndex = 2;162 this.r esultsTabPage.Text = "Results";163 this.r esultsTabPage.UseVisualStyleBackColor = true;154 // runsTabPage 155 // 156 this.runsTabPage.Controls.Add(this.runsView); 157 this.runsTabPage.Location = new System.Drawing.Point(4, 22); 158 this.runsTabPage.Name = "runsTabPage"; 159 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 160 this.runsTabPage.Size = new System.Drawing.Size(671, 348); 161 this.runsTabPage.TabIndex = 2; 162 this.runsTabPage.Text = "Runs"; 163 this.runsTabPage.UseVisualStyleBackColor = true; 164 164 // 165 165 // startButton … … 268 268 this.repetitionsNumericUpDown.ValueChanged += new System.EventHandler(this.repetitionsNumericUpDown_ValueChanged); 269 269 // 270 // r esultsView271 // 272 this.r esultsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)270 // runsView 271 // 272 this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 273 273 | System.Windows.Forms.AnchorStyles.Left) 274 274 | System.Windows.Forms.AnchorStyles.Right))); 275 this.r esultsView.Caption = "ResultCollection";276 this.r esultsView.Content = null;277 this.r esultsView.Location = new System.Drawing.Point(6, 6);278 this.r esultsView.Name = "resultsView";279 this.r esultsView.Size = new System.Drawing.Size(659, 336);280 this.r esultsView.TabIndex = 0;275 this.runsView.Caption = "RunCollection"; 276 this.runsView.Content = null; 277 this.runsView.Location = new System.Drawing.Point(6, 6); 278 this.runsView.Name = "runsView"; 279 this.runsView.Size = new System.Drawing.Size(659, 336); 280 this.runsView.TabIndex = 0; 281 281 // 282 282 // BatchRunView … … 309 309 this.tabControl.ResumeLayout(false); 310 310 this.algorithmTabPage.ResumeLayout(false); 311 this.r esultsTabPage.ResumeLayout(false);311 this.runsTabPage.ResumeLayout(false); 312 312 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit(); 313 313 this.ResumeLayout(false); … … 331 331 private System.Windows.Forms.OpenFileDialog openFileDialog; 332 332 private System.Windows.Forms.SaveFileDialog saveFileDialog; 333 private System.Windows.Forms.TabPage r esultsTabPage;333 private System.Windows.Forms.TabPage runsTabPage; 334 334 private System.Windows.Forms.Label repetitionsLabel; 335 335 private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown; 336 private R esultCollectionView resultsView;336 private RunCollectionView runsView; 337 337 338 338 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r3226 r3260 85 85 repetitionsNumericUpDown.Enabled = false; 86 86 algorithmViewHost.Content = null; 87 r esultsView.Content = null;87 runsView.Content = null; 88 88 tabControl.Enabled = false; 89 89 startButton.Enabled = resetButton.Enabled = false; … … 96 96 algorithmViewHost.ViewType = null; 97 97 algorithmViewHost.Content = Content.Algorithm; 98 r esultsView.Content = Content.Results;98 runsView.Content = Content.Runs; 99 99 tabControl.Enabled = true; 100 100 startButton.Enabled = !Content.Finished; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r3246 r3260 98 98 <DependentUpon>BatchRunView.cs</DependentUpon> 99 99 </Compile> 100 <Compile Include="RunCollectionView.cs"> 101 <SubType>UserControl</SubType> 102 </Compile> 103 <Compile Include="RunCollectionView.Designer.cs"> 104 <DependentUpon>RunCollectionView.cs</DependentUpon> 105 </Compile> 106 <Compile Include="RunView.cs"> 107 <SubType>UserControl</SubType> 108 </Compile> 109 <Compile Include="RunView.Designer.cs"> 110 <DependentUpon>RunView.cs</DependentUpon> 111 </Compile> 100 112 <Compile Include="UserDefinedAlgorithmView.cs"> 101 113 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r3226 r3260 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 using HeuristicLab.Collections;25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; … … 120 120 } 121 121 122 public override void CollectParameterValues(IDictionary<string, IItem> values) { 123 base.CollectParameterValues(values); 124 Problem.CollectParameterValues(values); 125 } 126 public virtual void CollectResultValues(IDictionary<string, IItem> values) { 127 foreach (IResult result in Results) 128 values.Add(result.Name, result.Value != null ? (IItem)result.Value.Clone() : null); 129 } 130 122 131 #region Events 123 132 public event EventHandler ProblemChanged; -
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r3246 r3260 22 22 using System; 23 23 using System.Drawing; 24 using HeuristicLab.Collections;25 24 using HeuristicLab.Core; 26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 74 73 75 74 [Storable] 76 private R esultCollection results;77 public R esultCollection Results {78 get { return r esults; }75 private RunCollection runs; 76 public RunCollection Runs { 77 get { return runs; } 79 78 } 80 79 … … 103 102 104 103 public bool Finished { 105 get { return ((Algorithm == null) || (Algorithm.Finished && (r esults.Count >= repetitions))); }104 get { return ((Algorithm == null) || (Algorithm.Finished && (runs.Count >= repetitions))); } 106 105 } 107 106 … … 111 110 : base() { 112 111 repetitions = 10; 113 r esults = new ResultCollection();112 runs = new RunCollection(); 114 113 executionTime = TimeSpan.Zero; 115 114 } 116 115 public BatchRun(string name) : base(name) { 117 116 repetitions = 10; 118 r esults = new ResultCollection();117 runs = new RunCollection(); 119 118 executionTime = TimeSpan.Zero; 120 119 } 121 120 public BatchRun(string name, string description) : base(name, description) { 122 121 repetitions = 10; 123 r esults = new ResultCollection();122 runs = new RunCollection(); 124 123 executionTime = TimeSpan.Zero; 125 124 } … … 129 128 clone.Algorithm = (IAlgorithm)cloner.Clone(algorithm); 130 129 clone.repetitions = repetitions; 131 clone.r esults = (ResultCollection)cloner.Clone(results);130 clone.runs = (RunCollection)cloner.Clone(runs); 132 131 clone.executionTime = executionTime; 133 132 clone.running = running; … … 137 136 138 137 public void Prepare() { 139 results.Clear(); 138 executionTime = TimeSpan.Zero; 139 runs.Clear(); 140 140 if (Algorithm != null) Algorithm.Prepare(); 141 141 OnPrepared(); … … 196 196 197 197 private void DeregisterAlgorithmEvents() { 198 algorithm.Prepared -= new EventHandler(Algorithm_Prepared);199 198 algorithm.RunningChanged -= new EventHandler(Algorithm_RunningChanged); 200 199 algorithm.ExceptionOccurred -= new EventHandler<HeuristicLab.Common.EventArgs<Exception>>(Algorithm_ExceptionOccurred); … … 202 201 203 202 private void RegisterAlgorithmEvents() { 204 algorithm.Prepared += new EventHandler(Algorithm_Prepared);205 203 algorithm.RunningChanged += new EventHandler(Algorithm_RunningChanged); 206 204 algorithm.ExceptionOccurred += new EventHandler<HeuristicLab.Common.EventArgs<Exception>>(Algorithm_ExceptionOccurred); 207 205 } 208 206 209 private void Algorithm_Prepared(object sender, EventArgs e) {210 results.Add(new Result("Run " + DateTime.Now.ToString(), Algorithm.Results));211 }212 207 private void Algorithm_RunningChanged(object sender, EventArgs e) { 213 208 if (Algorithm.Running) { … … 215 210 OnStarted(); 216 211 } else { 217 if (!canceled && (results.Count < repetitions)) {212 if (!canceled) { 218 213 ExecutionTime += Algorithm.ExecutionTime; 214 runs.Add(new Run("Run " + Algorithm.ExecutionTime.ToString(), Algorithm)); 219 215 Algorithm.Prepare(); 220 Algorithm.Start(); 216 if (runs.Count < repetitions) Algorithm.Start(); 217 else OnStopped(); 221 218 } else { 222 if (Algorithm.Finished) ExecutionTime += Algorithm.ExecutionTime;223 219 OnStopped(); 224 220 } -
trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs
r3226 r3260 216 216 Engine.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Engine_ExceptionOccurred); 217 217 Engine.ExecutionTimeChanged += new EventHandler(Engine_ExecutionTimeChanged); 218 Engine. Stopped += new EventHandler(Engine_Stopped);218 Engine.RunningChanged += new EventHandler(Engine_RunningChanged); 219 219 } 220 220 private void DeregisterEngineEvents() { 221 221 Engine.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Engine_ExceptionOccurred); 222 222 Engine.ExecutionTimeChanged -= new EventHandler(Engine_ExecutionTimeChanged); 223 Engine. Stopped -= new EventHandler(Engine_Stopped);223 Engine.RunningChanged -= new EventHandler(Engine_RunningChanged); 224 224 } 225 225 … … 230 230 OnExecutionTimeChanged(); 231 231 } 232 private void Engine_ Stopped(object sender, EventArgs e) {233 OnStopped();232 private void Engine_RunningChanged(object sender, EventArgs e) { 233 if (!Engine.Running) OnStopped(); 234 234 } 235 235 } -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r3246 r3260 87 87 <Compile Include="Algorithm.cs" /> 88 88 <Compile Include="BatchRun.cs" /> 89 <Compile Include="RunCollection.cs" /> 90 <Compile Include="Run.cs" /> 89 91 <Compile Include="Interfaces\IMultiObjectiveSolutionsVisualizer.cs" /> 90 92 <Compile Include="Interfaces\IResult.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs
r3226 r3260 21 21 22 22 using System; 23 using HeuristicLab.Collections;23 using System.Collections.Generic; 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; … … 41 41 void Stop(); 42 42 43 void CollectResultValues(IDictionary<string, IItem> values); 44 43 45 event EventHandler ProblemChanged; 44 46 event EventHandler ExecutionTimeChanged;
Note: See TracChangeset
for help on using the changeset viewer.