Changeset 7241
- Timestamp:
- 12/28/11 02:08:34 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs
r7238 r7241 175 175 176 176 if (clearRuns) runs.Clear(); 177 178 experimentStarted = false; 179 experimentStopped = false; 177 180 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) 178 181 if (clearRuns || optimizer.ExecutionState != ExecutionState.Prepared) … … 206 209 experimentStarted = false; 207 210 experimentStopped = true; 208 foreach (IOptimizer optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) 209 optimizer.Stop(); 211 if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) { 212 foreach (IOptimizer optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) 213 optimizer.Stop(); 214 } else { 215 OnStopped(); 216 } 210 217 } 211 218 … … 326 333 } 327 334 private void optimizer_Paused(object sender, EventArgs e) { 328 if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) 329 OnPaused(); 335 if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused(); 330 336 } 331 337 private void optimizer_Prepared(object sender, EventArgs e) { 332 if ( ExecutionState == ExecutionState.Stopped)333 OnPrepared();338 if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared(); 339 else if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused(); 334 340 } 335 341 private void optimizer_Started(object sender, EventArgs e) { 336 if (ExecutionState != ExecutionState.Started) 337 OnStarted(); 342 if (ExecutionState != ExecutionState.Started) OnStarted(); 338 343 } 339 344 private void optimizer_Stopped(object sender, EventArgs e) { 340 if (!experimentStarted && Optimizers.Any(o => o.ExecutionState == ExecutionState.Prepared) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started && o.ExecutionState != ExecutionState.Paused)) OnPrepared(); 341 else if (Optimizers.All(o => o.ExecutionState == ExecutionState.Stopped)) OnStopped(); 342 else if (Optimizers.Any(o => o.ExecutionState == ExecutionState.Paused) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused(); 343 else if (experimentStarted && !experimentStopped && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) { 344 Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start(); 345 if (experimentStopped) { 346 if (Optimizers.All(x => (x.ExecutionState == ExecutionState.Stopped) || (x.ExecutionState == ExecutionState.Prepared))) OnStopped(); 347 } else { 348 if (experimentStarted && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) { 349 Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start(); 350 } else if (Optimizers.All(x => x.ExecutionState == ExecutionState.Stopped)) OnStopped(); 351 else if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused(); 345 352 } 346 353 }
Note: See TracChangeset
for help on using the changeset viewer.