Changeset 10128
- Timestamp:
- 11/12/13 13:03:29 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching.Views/3.3/RunCollectionModifierExecutableView.cs
r10121 r10128 113 113 Invoke(new EventHandler(Content_Paused), sender, e); 114 114 else { 115 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(Content, false); 115 116 nameTextBox.Enabled = infoLabel.Enabled = true; 116 117 ReadOnly = Locked = false; … … 123 124 Invoke(new EventHandler(Content_Stopped), sender, e); 124 125 else { 126 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(Content, false); 125 127 nameTextBox.Enabled = infoLabel.Enabled = true; 126 128 ReadOnly = Locked = false; … … 138 140 if (InvokeRequired) 139 141 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 140 else 142 else { 141 143 ErrorHandling.ShowErrorDialog(this, e.Value); 144 } 142 145 } 143 146 #endregion -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierExecutable.cs
r10121 r10128 113 113 return new RunCollectionModifierExecutable(this, cloner); 114 114 } 115 116 //special cloning which ignores the RunCollection and the execution stack 117 public RunCollectionModifierExecutable CloneWithoutRuns() { 118 var clone = new RunCollectionModifierExecutable(); 119 clone.executionTime = executionTime; 120 clone.executionState = executionState; 121 clone.log = (ILog)log.Clone(new Cloner()); 122 clone.RunCollectionModifiersParameter.Value = (ItemList<IRunCollectionModifier>)RunCollectionModifiers.Clone(new Cloner()); 123 return clone; 124 } 115 125 #endregion 116 126 … … 198 208 executionStack.Push(next); 199 209 if (ex is OperationCanceledException) throw ex; 200 else throw new Exception("IRunCollectionModifier " + next + " threw an exception.", ex);210 else throw new Exception("IRunCollectionModifier " + next + " threw an exception.", ex); 201 211 } 202 212 finally { -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierHiveTask.cs
r10121 r10128 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Clients.Hive; 26 25 using HeuristicLab.Common; 27 using HeuristicLab.Optimization;28 26 29 27 namespace HeuristicLab.Analysis.SolutionCaching { … … 50 48 51 49 public override void IntegrateChild(ItemTask task, Guid childTaskId) { 52 var optimizerTask = (RunCollectionModifierTask)task;53 syncTasksWithOptimizers = false; // don't sync with optimizers during this method50 var rcmTask = (RunCollectionModifierTask)task; 51 syncTasksWithOptimizers = false; 54 52 55 if ( this.ItemTask != null && this.ItemTask.Item != null) {53 if (ItemTask != null && ItemTask.Item != null) { 56 54 itemTaskLock.EnterWriteLock(); 57 55 try { 58 this.ItemTask.Item.RunCollection.AddRange(((RunCollectionModifierExecutable)task.Item).RunCollection);56 ItemTask.Item.RunCollection.AddRange(rcmTask.Item.RunCollection); 59 57 } 60 58 finally { … … 63 61 } 64 62 65 IEnumerable<HiveTask> childs = this.ChildHiveTasks.Where(j => j.Task.Id == childTaskId); 66 //TODO: in very rare cases childs is empty. This shouldn't be the case and should be further investigated. 67 if (childs.Count() > 0) { 68 RunCollectionModifierHiveTask child = childs.First() as RunCollectionModifierHiveTask; 69 if (child != null && !optimizerTask.ComputeInParallel) { 70 child.ItemTask = optimizerTask; 71 } 63 RunCollectionModifierHiveTask child = ChildHiveTasks.Single(j => j.Task.Id == childTaskId) as RunCollectionModifierHiveTask; 64 if (!rcmTask.ComputeInParallel) { 65 child.ItemTask = rcmTask; 72 66 } 73 67 syncTasksWithOptimizers = true; … … 81 75 if (childHiveTasks.Any()) { 82 76 var exec = (RunCollectionModifierExecutable)ItemTask.Item; 83 //compute in parallel was deactivated, copy runs back 77 //compute in parallel was deactivated, copy runs back to parent 84 78 foreach (var childHiveTask in childHiveTasks) { 85 79 exec.RunCollection.AddRange(((RunCollectionModifierExecutable)childHiveTask.ItemTask.Item).RunCollection); 86 80 } 81 childHiveTasks.Clear(); 87 82 } 88 childHiveTasks.Clear();89 83 } else { 90 84 var runs = ItemTask.Item.RunCollection; 91 85 foreach (var run in runs) { 92 var exec = (RunCollectionModifierExecutable)ItemTask.Item.Clone(new Cloner()); 93 //TODO: this could be more efficient, create new RCME instead of cloning 94 exec.RunCollection.Clear(); 86 var exec = ItemTask.Item.CloneWithoutRuns(); 95 87 exec.RunCollection.Add(run); 88 exec.Prepare(); 96 89 97 90 var rcmHiveTask = new RunCollectionModifierHiveTask(exec);
Note: See TracChangeset
for help on using the changeset viewer.