Changeset 8738 for trunk/sources
- Timestamp:
- 10/04/12 15:42:21 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r8528 r8738 44 44 45 45 executionState = ExecutionState.Stopped; 46 runs = new RunCollection ();46 runs = new RunCollection { AlgorithmName = name }; 47 47 runsCounter = 0; 48 48 … … 246 246 #endregion 247 247 248 protected override void OnNameChanged() { 249 base.OnNameChanged(); 250 Runs.AlgorithmName = Name; 251 } 252 248 253 public void Prepare() { 249 254 if (ExecutionState == ExecutionState.Started) -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs
r7469 r8738 75 75 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 76 76 Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged); 77 Content.AlgorithmNameChanged += new EventHandler(Content_AlgorithmNameChanged); 77 78 RegisterRunEvents(Content); 78 79 } … … 85 86 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 86 87 Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged); 88 Content.AlgorithmNameChanged -= new EventHandler(Content_AlgorithmNameChanged); 87 89 DeregisterRunEvents(Content); 88 90 } … … 139 141 } 140 142 } 143 144 private void Content_AlgorithmNameChanged(object sender, EventArgs e) { 145 if (InvokeRequired) 146 Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e); 147 else UpdateCaption(); 148 } 141 149 #endregion 142 150 … … 147 155 UpdateComboBoxes(); 148 156 UpdateDataPoints(); 157 UpdateCaption(); 158 } 159 160 private void UpdateCaption() { 161 Caption = Content != null ? Content.AlgorithmName + "Box Plots" : ViewAttribute.GetViewName(GetType()); 149 162 } 150 163 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r7469 r8738 93 93 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 94 94 Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged); 95 Content.AlgorithmNameChanged += new EventHandler(Content_AlgorithmNameChanged); 95 96 RegisterRunEvents(Content); 96 97 } … … 103 104 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 104 105 Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged); 106 Content.AlgorithmNameChanged -= new EventHandler(Content_AlgorithmNameChanged); 105 107 DeregisterRunEvents(Content); 106 108 } … … 163 165 UpdateComboBoxes(); 164 166 UpdateDataPoints(); 167 UpdateCaption(); 165 168 } 166 169 private void Content_ColumnNamesChanged(object sender, EventArgs e) { … … 169 172 else 170 173 UpdateComboBoxes(); 174 } 175 176 private void UpdateCaption() { 177 Caption = Content != null ? Content.AlgorithmName + "Bubble Chart" : ViewAttribute.GetViewName(GetType()); 171 178 } 172 179 … … 215 222 if (!suppressUpdates) UpdateDataPoints(); 216 223 } 224 } 225 226 private void Content_AlgorithmNameChanged(object sender, EventArgs e) { 227 if (InvokeRequired) 228 Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e); 229 else UpdateCaption(); 217 230 } 218 231 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs
r8108 r8738 63 63 Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 64 64 Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged); 65 Content.AlgorithmNameChanged += new EventHandler(Content_AlgorithmNameChanged); 65 66 } 66 67 protected override void DeregisterContentEvents() { … … 69 70 Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 70 71 Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged); 72 Content.AlgorithmNameChanged -= new EventHandler(Content_AlgorithmNameChanged); 71 73 base.DeregisterContentEvents(); 72 74 } … … 93 95 RemoveRuns(e.OldItems); 94 96 AddRuns(e.Items); 97 } 98 private void Content_AlgorithmNameChanged(object sender, EventArgs e) { 99 if (InvokeRequired) 100 Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e); 101 else UpdateCaption(); 95 102 } 96 103 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { … … 123 130 runMapping.Clear(); 124 131 132 UpdateCaption(); 125 133 if (Content != null) { 126 134 UpdateDataTableComboBox(); … … 195 203 } 196 204 205 private void UpdateCaption() { 206 Caption = Content != null ? Content.AlgorithmName + "Data Table" : ViewAttribute.GetViewName(GetType()); 207 } 208 197 209 private void UpdateDataRowComboBox() { 198 210 dataRowComboBox.Items.Clear(); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTabularView.cs
r8139 r8738 55 55 UpdateRowAttributes(); 56 56 } 57 UpdateCaption(); 57 58 } 58 59 … … 64 65 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 65 66 Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged); 67 Content.AlgorithmNameChanged += new EventHandler(Content_AlgorithmNameChanged); 66 68 RegisterRunEvents(Content); 67 69 } … … 76 78 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 77 79 Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged); 80 Content.AlgorithmNameChanged -= new EventHandler(Content_AlgorithmNameChanged); 78 81 DeregisterRunEvents(Content); 79 82 } … … 91 94 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 92 95 RegisterRunEvents(e.Items); 96 } 97 private void Content_AlgorithmNameChanged(object sender, EventArgs e) { 98 if (InvokeRequired) 99 Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e); 100 else UpdateCaption(); 93 101 } 94 102 private void run_Changed(object sender, EventArgs e) { … … 101 109 } 102 110 #endregion 111 112 private void UpdateCaption() { 113 Caption = Content != null ? Content.AlgorithmName + "Tabular View" : ViewAttribute.GetViewName(GetType()); 114 } 103 115 104 116 protected override void UpdateColumnHeaders() { -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r8212 r8738 134 134 storeAlgorithmInEachRun = false; 135 135 runsCounter = 0; 136 Runs = new RunCollection ();136 Runs = new RunCollection { AlgorithmName = Name }; 137 137 } 138 138 protected Algorithm(string name) … … 142 142 storeAlgorithmInEachRun = false; 143 143 runsCounter = 0; 144 Runs = new RunCollection ();144 Runs = new RunCollection { AlgorithmName = Name }; 145 145 } 146 146 protected Algorithm(string name, ParameterCollection parameters) … … 150 150 storeAlgorithmInEachRun = false; 151 151 runsCounter = 0; 152 Runs = new RunCollection ();152 Runs = new RunCollection { AlgorithmName = Name }; 153 153 } 154 154 protected Algorithm(string name, string description) … … 158 158 storeAlgorithmInEachRun = false; 159 159 runsCounter = 0; 160 Runs = new RunCollection ();160 Runs = new RunCollection { AlgorithmName = Name }; 161 161 } 162 162 protected Algorithm(string name, string description, ParameterCollection parameters) … … 166 166 storeAlgorithmInEachRun = false; 167 167 runsCounter = 0; 168 Runs = new RunCollection ();168 Runs = new RunCollection { AlgorithmName = Name }; 169 169 } 170 170 [StorableConstructor] … … 250 250 251 251 #region Events 252 protected override void OnNameChanged() { 253 base.OnNameChanged(); 254 Runs.AlgorithmName = Name; 255 } 256 252 257 public event EventHandler ExecutionStateChanged; 253 258 protected virtual void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r8668 r8738 175 175 repetitions = 10; 176 176 repetitionsCounter = 0; 177 Runs = new RunCollection ();177 Runs = new RunCollection { AlgorithmName = Name }; 178 178 } 179 179 public BatchRun(string name) … … 185 185 repetitions = 10; 186 186 repetitionsCounter = 0; 187 Runs = new RunCollection ();187 Runs = new RunCollection { AlgorithmName = Name }; 188 188 } 189 189 public BatchRun(string name, string description) … … 194 194 repetitions = 10; 195 195 repetitionsCounter = 0; 196 Runs = new RunCollection ();196 Runs = new RunCollection { AlgorithmName = Name }; 197 197 } 198 198 [StorableConstructor] … … 278 278 279 279 #region Events 280 protected override void OnNameChanged() { 281 base.OnNameChanged(); 282 runs.AlgorithmName = Name; 283 } 284 280 285 public event EventHandler ExecutionStateChanged; 281 286 private void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs
r8194 r8738 117 117 executionTime = TimeSpan.Zero; 118 118 optimizers = new OptimizerList(); 119 Runs = new RunCollection ();119 Runs = new RunCollection { AlgorithmName = Name }; 120 120 Initialize(); 121 121 } … … 126 126 executionTime = TimeSpan.Zero; 127 127 optimizers = new OptimizerList(); 128 Runs = new RunCollection ();128 Runs = new RunCollection { AlgorithmName = Name }; 129 129 Initialize(); 130 130 } … … 134 134 executionTime = TimeSpan.Zero; 135 135 optimizers = new OptimizerList(); 136 Runs = new RunCollection ();136 Runs = new RunCollection { AlgorithmName = Name }; 137 137 Initialize(); 138 138 } … … 180 180 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) { 181 181 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 182 try { optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { } 182 try { optimizer.Prepare(clearRuns); } 183 catch (InvalidOperationException) { } 183 184 } 184 185 } … … 193 194 if (optimizer != null) { 194 195 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 195 try { optimizer.Start(); } catch (InvalidOperationException) { } 196 try { optimizer.Start(); } 197 catch (InvalidOperationException) { } 196 198 } 197 199 } … … 205 207 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) { 206 208 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 207 try { optimizer.Pause(); } catch (InvalidOperationException) { } 209 try { optimizer.Pause(); } 210 catch (InvalidOperationException) { } 208 211 } 209 212 } … … 218 221 foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) { 219 222 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 220 try { optimizer.Stop(); } catch (InvalidOperationException) { } 223 try { optimizer.Stop(); } 224 catch (InvalidOperationException) { } 221 225 } 222 226 } else { … … 226 230 227 231 #region Events 232 protected override void OnNameChanged() { 233 base.OnNameChanged(); 234 Runs.AlgorithmName = Name; 235 } 236 228 237 public event EventHandler ExecutionStateChanged; 229 238 private void OnExecutionStateChanged() { -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r7798 r8738 44 44 : base(original, cloner) { 45 45 updateOfRunsInProgress = false; 46 algorithmName = original.algorithmName; 47 46 48 resultNames = new List<string>(original.resultNames); 47 49 parameterNames = new List<string>(original.parameterNames); … … 104 106 } 105 107 108 private string algorithmName = string.Empty; 109 [Storable] 110 public string AlgorithmName { 111 get { return algorithmName; } 112 set { 113 if (value != algorithmName && !string.IsNullOrEmpty(value)) { 114 algorithmName = value; 115 OnAlgorithmNameChanged(); 116 } 117 } 118 } 119 106 120 [StorableHook(HookType.AfterDeserialization)] 107 121 private void AfterDeserialization() { … … 120 134 protected virtual void OnUpdateOfRunsInProgressChanged() { 121 135 var handler = UpdateOfRunsInProgressChanged; 136 if (handler != null) handler(this, EventArgs.Empty); 137 } 138 139 public event EventHandler AlgorithmNameChanged; 140 protected virtual void OnAlgorithmNameChanged() { 141 var handler = AlgorithmNameChanged; 122 142 if (handler != null) handler(this, EventArgs.Empty); 123 143 }
Note: See TracChangeset
for help on using the changeset viewer.