Changeset 6358 for branches/HeuristicLab.Hive-3.4/sources
- Timestamp:
- 06/05/11 22:43:07 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4
- Files:
-
- 1 deleted
- 1 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r6357 r6358 150 150 151 151 next = executionStack.Pop(); 152 bool isOpCollection = next is OperationCollection;153 int collCount = isOpCollection ? ((OperationCollection)next).Count : 0;154 string opName = !isOpCollection ? ((IAtomicOperation)next).Operator.Name : "OpCollection";152 //bool isOpCollection = next is OperationCollection; 153 //int collCount = isOpCollection ? ((OperationCollection)next).Count : 0; 154 //string opName = !isOpCollection ? ((IAtomicOperation)next).Operator.Name : "OpCollection"; 155 155 156 156 if (next is OperationCollection) { 157 157 coll = (OperationCollection)next; 158 158 159 bool isPMOEvaluator = coll.Count > 0 && coll.First() is HeuristicLab.Core.ExecutionContext && ((HeuristicLab.Core.ExecutionContext)coll.First()).Operator.GetType().Name == "PMOEvaluator"; 160 bool isAlgorithmEvaluator = coll.Count > 0 && coll.First() is HeuristicLab.Core.ExecutionContext && ((HeuristicLab.Core.ExecutionContext)coll.First()).Operator.GetType().Name == "AlgorithmEvaluator"; 161 162 if (coll.Parallel && isPMOEvaluator) { 163 Task[] tasks = new Task[coll.Count]; 164 Stack<IOperation>[] stacks = new Stack<IOperation>[coll.Count]; 165 for (int i = 0; i < coll.Count; i++) { 166 stacks[i] = new Stack<IOperation>(); 167 stacks[i].Push(coll[i]); 168 tasks[i] = Task.Factory.StartNew(Run, stacks[i], cancellationToken); 169 } 170 try { 171 Task.WaitAll(tasks); 172 } 173 catch (AggregateException ex) { 174 OperationCollection remaining = new OperationCollection() { Parallel = true }; 175 for (int i = 0; i < stacks.Length; i++) { 176 if (stacks[i].Count == 1) 177 remaining.Add(stacks[i].Pop()); 178 if (stacks[i].Count > 1) { 179 OperationCollection ops = new OperationCollection(); 180 while (stacks[i].Count > 0) 181 ops.Add(stacks[i].Pop()); 182 remaining.Add(ops); 183 } 184 } 185 if (remaining.Count > 0) executionStack.Push(remaining); 186 throw ex; 187 } 188 } else if (coll.Parallel) { 159 //bool isPMOEvaluator = coll.Count > 0 && coll.First() is HeuristicLab.Core.ExecutionContext && ((HeuristicLab.Core.ExecutionContext)coll.First()).Operator.GetType().Name == "PMOEvaluator"; 160 //bool isAlgorithmEvaluator = coll.Count > 0 && coll.First() is HeuristicLab.Core.ExecutionContext && ((HeuristicLab.Core.ExecutionContext)coll.First()).Operator.GetType().Name == "AlgorithmEvaluator"; 161 162 //if (coll.Parallel && isPMOEvaluator) { 163 // Task[] tasks = new Task[coll.Count]; 164 // Stack<IOperation>[] stacks = new Stack<IOperation>[coll.Count]; 165 // for (int i = 0; i < coll.Count; i++) { 166 // stacks[i] = new Stack<IOperation>(); 167 // stacks[i].Push(coll[i]); 168 // tasks[i] = Task.Factory.StartNew(Run, stacks[i], cancellationToken); 169 // } 170 // try { 171 // Task.WaitAll(tasks); 172 // } 173 // catch (AggregateException ex) { 174 // OperationCollection remaining = new OperationCollection() { Parallel = true }; 175 // for (int i = 0; i < stacks.Length; i++) { 176 // if (stacks[i].Count == 1) 177 // remaining.Add(stacks[i].Pop()); 178 // if (stacks[i].Count > 1) { 179 // OperationCollection ops = new OperationCollection(); 180 // while (stacks[i].Count > 0) 181 // ops.Add(stacks[i].Pop()); 182 // remaining.Add(ops); 183 // } 184 // } 185 // if (remaining.Count > 0) executionStack.Push(remaining); 186 // throw ex; 187 // } 188 //} else if (coll.Parallel) { 189 if(coll.Parallel) { 189 190 // clone the parent scope here and reuse it for each operation. otherwise for each job the whole scope-tree first needs to be copied and then cleaned, which causes a lot of work for the Garbage Collector 190 191 IScope parentScopeClone = (IScope)((IAtomicOperation)coll.First()).Scope.Parent.Clone(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests
- Property svn:ignore
-
old new 3 3 HeuristicLab.HiveEngine.Test.csproj.vs10x 4 4 HeuristicLab.HiveEngine.Test.csproj.user 5 HeuristicLab.HiveEngine-3.4.Tests.csproj.vs10x 6 Meta-GA - Meta Optimization Problem (Genetic Programming - Symbolic Regression 3.4 scaled)_small.hl
-
- Property svn:ignore
Note: See TracChangeset
for help on using the changeset viewer.