Changeset 5208 for trunk/sources/HeuristicLab.Optimization.Operators
- Timestamp:
- 01/04/11 06:17:50 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionsCreator.cs
r4722 r5208 29 29 namespace HeuristicLab.Optimization.Operators { 30 30 /// <summary> 31 /// An operator which creates new solutions. 31 /// An operator which creates new solutions. Evaluation of the new solutions is executed in parallel, if an engine is used which supports parallelization. 32 32 /// </summary> 33 [Item("SolutionsCreator", "An operator which creates new solutions. ")]33 [Item("SolutionsCreator", "An operator which creates new solutions. Evaluation of the new solutions is executed in parallel, if an engine is used which supports parallelization.")] 34 34 [StorableClass] 35 35 public sealed class SolutionsCreator : SingleSuccessorOperator { … … 61 61 Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSolutions", "The number of solutions that should be created.")); 62 62 Parameters.Add(new ValueLookupParameter<IOperator>("SolutionCreator", "The operator which is used to create new solutions.")); 63 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions. "));63 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 64 64 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes.")); 65 65 } … … 78 78 CurrentScope.SubScopes.Add(new Scope((current + i).ToString())); 79 79 80 OperationCollection creation = new OperationCollection(); 81 OperationCollection evaluation = new OperationCollection() { Parallel = true }; 82 for (int i = 0; i < count; i++) { 83 if (creator != null) creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i])); 84 if (evaluator != null) evaluation.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i])); 85 } 80 86 OperationCollection next = new OperationCollection(); 81 for (int i = 0; i < count; i++) { 82 if (creator != null) next.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i])); 83 if (evaluator != null) next.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i])); 84 } 87 next.Add(creation); 88 next.Add(evaluation); 85 89 next.Add(base.Apply()); 86 90 return next;
Note: See TracChangeset
for help on using the changeset viewer.