Changeset 6430 for trunk/sources
- Timestamp:
- 06/16/11 14:12:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionsCreator.cs
r5445 r6430 43 43 get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; } 44 44 } 45 public ValueLookupParameter<BoolValue> ParallelParameter { 46 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } 47 } 45 48 private ScopeParameter CurrentScopeParameter { 46 49 get { return (ScopeParameter)Parameters["CurrentScope"]; } … … 62 65 Parameters.Add(new ValueLookupParameter<IOperator>("SolutionCreator", "The operator which is used to create new solutions.")); 63 66 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 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes.")); 67 Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true))); 68 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes.")); 69 } 70 [StorableHook(HookType.AfterDeserialization)] 71 private void AfterDeserialization() { 72 if (!Parameters.ContainsKey("Parallel")) Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true))); // backwards compatibility 65 73 } 66 74 … … 73 81 IOperator creator = SolutionCreatorParameter.ActualValue; 74 82 IOperator evaluator = EvaluatorParameter.ActualValue; 83 bool parallel = ParallelParameter.ActualValue.Value; 75 84 76 85 int current = CurrentScope.SubScopes.Count; … … 79 88 80 89 OperationCollection creation = new OperationCollection(); 81 OperationCollection evaluation = new OperationCollection() { Parallel = true};90 OperationCollection evaluation = new OperationCollection() { Parallel = parallel }; 82 91 for (int i = 0; i < count; i++) { 83 92 if (creator != null) creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
Note: See TracChangeset
for help on using the changeset viewer.