Changeset 9525
- Timestamp:
- 05/24/13 14:31:11 (12 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 9493,9504,9517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis (added) merged: 9493,9504,9517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r9456 r9525 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 } … … 389 387 390 388 private void AggregateResultValues(IDictionary<string, IItem> results) { 391 Dictionary<string, List<double>> resultValues = new Dictionary<string, List<double>>();392 389 IEnumerable<IRun> runs = clonedAlgorithms.Select(alg => alg.Runs.FirstOrDefault()).Where(run => run != null); 393 390 IEnumerable<KeyValuePair<string, IItem>> resultCollections = runs.Where(x => x != null).SelectMany(x => x.Results).ToList(); … … 552 549 } 553 550 if (problem != null) problem.Reset -= new EventHandler(Problem_Reset); 554 if (Problem != null) Problem.Reset += new EventHandler(Problem_Reset);555 551 problem = (IDataAnalysisProblem)algorithm.Problem; 552 if (problem != null) problem.Reset += new EventHandler(Problem_Reset); 556 553 OnProblemChanged(); 557 554 } … … 653 650 654 651 private readonly object locker = new object(); 652 private readonly object resultLocker = new object(); 655 653 private void ClonedAlgorithm_Started(object sender, EventArgs e) { 656 lock (locker) {657 IAlgorithm algorithm = sender as IAlgorithm;654 IAlgorithm algorithm = sender as IAlgorithm; 655 lock (resultLocker) { 658 656 if (algorithm != null && !results.ContainsKey(algorithm.Name)) 659 657 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 658 } 671 659 } … … 718 706 public event EventHandler Started; 719 707 private void OnStarted() { 720 startPending = false;721 708 ExecutionState = ExecutionState.Started; 722 709 EventHandler handler = Started;
Note: See TracChangeset
for help on using the changeset viewer.