Changeset 9493 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 05/14/13 14:03:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r9456 r9493 266 266 } 267 267 268 private bool startPending;269 268 public void Start() { 270 269 if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused)) 271 270 throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState)); 272 271 273 if (Algorithm != null && !startPending) { 274 startPending = true; 272 if (Algorithm != null) { 275 273 //create cloned algorithms 276 274 if (clonedAlgorithms.Count == 0) { … … 335 333 if (!pausePending) { 336 334 pausePending = true; 337 if (!startPending)PauseAllClonedAlgorithms();335 PauseAllClonedAlgorithms(); 338 336 } 339 337 } … … 352 350 if (!stopPending) { 353 351 stopPending = true; 354 if (!startPending)StopAllClonedAlgorithms();352 StopAllClonedAlgorithms(); 355 353 } 356 354 } … … 654 652 private readonly object locker = new object(); 655 653 private void ClonedAlgorithm_Started(object sender, EventArgs e) { 656 lock (locker) { 657 IAlgorithm algorithm = sender as IAlgorithm; 658 if (algorithm != null && !results.ContainsKey(algorithm.Name)) 659 results.Add(new Result(algorithm.Name, "Contains results for the specific fold.", algorithm.Results)); 660 661 if (startPending) { 662 int startedAlgorithms = clonedAlgorithms.Count(alg => alg.ExecutionState == ExecutionState.Started); 663 if (startedAlgorithms == NumberOfWorkers.Value || 664 clonedAlgorithms.All(alg => alg.ExecutionState != ExecutionState.Prepared)) 665 startPending = false; 666 667 if (pausePending) PauseAllClonedAlgorithms(); 668 if (stopPending) StopAllClonedAlgorithms(); 669 } 670 } 654 IAlgorithm algorithm = sender as IAlgorithm; 655 if (algorithm != null && !results.ContainsKey(algorithm.Name)) 656 results.Add(new Result(algorithm.Name, "Contains results for the specific fold.", algorithm.Results)); 657 671 658 } 672 659 … … 718 705 public event EventHandler Started; 719 706 private void OnStarted() { 720 startPending = false;721 707 ExecutionState = ExecutionState.Started; 722 708 EventHandler handler = Started;
Note: See TracChangeset
for help on using the changeset viewer.