Changeset 8668 for trunk/sources
- Timestamp:
- 09/18/12 12:56:25 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs
r7275 r8668 110 110 } else if (batchRun != null) { 111 111 batchRun.OptimizerChanged += new EventHandler(batchRun_OptimizerChanged); 112 batchRun.RepetetionsCounterChanged += new EventHandler(batchRun_RepetitionsCounterChanged); 113 batchRun.RepetitionsChanged += new EventHandler(batchRun_RepetitionsChanged); 112 114 } else if (experiment != null) { 113 115 experiment.Optimizers.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded); … … 132 134 } else if (batchRun != null) { 133 135 batchRun.OptimizerChanged -= new EventHandler(batchRun_OptimizerChanged); 136 batchRun.RepetetionsCounterChanged -= new EventHandler(batchRun_RepetitionsCounterChanged); 137 batchRun.RepetitionsChanged += new EventHandler(batchRun_RepetitionsChanged); 134 138 } else if (experiment != null) { 135 139 experiment.Optimizers.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded); … … 225 229 } 226 230 231 private void batchRun_RepetitionsCounterChanged(object sender, EventArgs e) { 232 namedItem_ToStringChanged(sender, e); 233 } 234 private void batchRun_RepetitionsChanged(object sender, EventArgs e) { 235 namedItem_ToStringChanged(sender, e); 236 } 237 227 238 private void Optimizers_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { 228 239 if (InvokeRequired) { … … 362 373 } 363 374 var namedItem = (INamedItem)sender; 364 foreach (TreeNode node in treeNodeTagMapping[namedItem]) 375 foreach (TreeNode node in treeNodeTagMapping[namedItem]) { 365 376 node.Text = namedItem.ToString(); 377 var batchRun = namedItem as BatchRun; 378 if (batchRun != null) 379 node.Text += string.Format(" {0}/{1}", batchRun.RepetitionsCounter, batchRun.Repetitions); 380 } 366 381 } 367 382 … … 811 826 node.Nodes.Add(childNode); 812 827 } 828 var batchRun = optimizer as BatchRun; 829 if (batchRun != null) { 830 node.Text += string.Format(" {0}/{1}", batchRun.RepetitionsCounter, batchRun.Repetitions); 831 } 813 832 814 833 List<TreeNode> nodes; -
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r8194 r8668 130 130 [Storable] 131 131 private int repetitionsCounter; 132 public int RepetitionsCounter { 133 get { return repetitionsCounter; } 134 private set { 135 if (value != repetitionsCounter) { 136 repetitionsCounter = value; 137 OnRepetitionsCounterChanged(); 138 } 139 } 140 } 132 141 133 142 [Storable] … … 224 233 if (Optimizer != null) { 225 234 ExecutionTime = TimeSpan.Zero; 226 repetitionsCounter = 0;235 RepetitionsCounter = 0; 227 236 if (clearRuns) runs.Clear(); 228 237 batchRunAction = BatchRunAction.Prepare; 229 238 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 230 try { Optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { } 239 try { Optimizer.Prepare(clearRuns); } 240 catch (InvalidOperationException) { } 231 241 } else { 232 242 ExecutionState = ExecutionState.Stopped; … … 240 250 if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare(); 241 251 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 242 try { Optimizer.Start(); } catch (InvalidOperationException) { } 252 try { Optimizer.Start(); } 253 catch (InvalidOperationException) { } 243 254 } 244 255 public void Pause() { … … 249 260 if (Optimizer.ExecutionState != ExecutionState.Started) return; 250 261 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 251 try { Optimizer.Pause(); } catch (InvalidOperationException) { } 262 try { Optimizer.Pause(); } 263 catch (InvalidOperationException) { } 252 264 } 253 265 public void Stop() { … … 261 273 } 262 274 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 263 try { Optimizer.Stop(); } catch (InvalidOperationException) { } 275 try { Optimizer.Stop(); } 276 catch (InvalidOperationException) { } 264 277 } 265 278 … … 283 296 private void OnRepetitionsChanged() { 284 297 EventHandler handler = RepetitionsChanged; 298 if (handler != null) handler(this, EventArgs.Empty); 299 } 300 public event EventHandler RepetetionsCounterChanged; 301 private void OnRepetitionsCounterChanged() { 302 EventHandler handler = RepetetionsCounterChanged; 285 303 if (handler != null) handler(this, EventArgs.Empty); 286 304 } … … 356 374 ExecutionTime = TimeSpan.Zero; 357 375 runsExecutionTime = TimeSpan.Zero; 358 repetitionsCounter = 0;376 RepetitionsCounter = 0; 359 377 OnPrepared(); 360 378 } … … 365 383 } 366 384 private void Optimizer_Stopped(object sender, EventArgs e) { 367 repetitionsCounter++;385 RepetitionsCounter++; 368 386 ExecutionTime += runsExecutionTime; 369 387 runsExecutionTime = TimeSpan.Zero;
Note: See TracChangeset
for help on using the changeset viewer.