Changeset 8668 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 09/18/12 12:56:25 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.