Changeset 3193 for trunk/sources/HeuristicLab.Operators
- Timestamp:
- 03/23/10 01:31:17 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators/3.3
- Files:
-
- 2 deleted
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj ¶
r2900 r3193 94 94 <Compile Include="MultipleCallsOperator.cs" /> 95 95 <Compile Include="Operator.cs" /> 96 <Compile Include="ParallelSubScopesProcessor.cs" />97 96 <Compile Include="Placeholder.cs" /> 98 97 <Compile Include="IntCounter.cs" /> 99 98 <Compile Include="ScopeCleaner.cs" /> 100 <Compile Include="SequentialSubScopesProcessor.cs" />101 99 <Compile Include="StochasticBranch.cs" /> 102 100 <Compile Include="SubScopesCreator.cs" /> 101 <Compile Include="SubScopesProcessor.cs" /> 103 102 <Compile Include="SubScopesRemover.cs" /> 104 103 <Compile Include="SubScopesSorter.cs" /> 105 104 <Compile Include="DoubleCounter.cs" /> 106 <Compile Include="UniformParallelSubScopesProcessor.cs" />107 <Compile Include="UniformSequentialSubScopesProcessor.cs" />108 105 <Compile Include="EmptyOperator.cs"> 109 106 <SubType>Code</SubType> … … 112 109 <Compile Include="Properties\AssemblyInfo.cs" /> 113 110 <Compile Include="SingleSuccessorOperator.cs" /> 111 <Compile Include="UniformSubScopesProcessor.cs" /> 114 112 <Compile Include="ValuesCollector.cs" /> 115 113 <Compile Include="VariableCreator.cs" /> -
TabularUnified trunk/sources/HeuristicLab.Operators/3.3/SubScopesProcessor.cs ¶
r3186 r3193 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 24 using HeuristicLab.Parameters; 23 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 26 25 27 namespace HeuristicLab.Operators { 26 28 /// <summary> 27 /// An operator which contains multiple operators of which each is applied sequentiallyon one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.29 /// An operator which contains multiple operators of which each is applied on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on. 28 30 /// </summary> 29 [Item("S equentialSubScopesProcessor", "An operator which contains multiple operators of which each is applied sequentiallyon one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.")]31 [Item("SubScopesProcessor", "An operator which contains multiple operators of which each is applied on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.")] 30 32 [StorableClass] 31 public sealed class SequentialSubScopesProcessor : MultipleCallsOperator { 32 public SequentialSubScopesProcessor() 33 public sealed class SubScopesProcessor : MultipleCallsOperator { 34 public ValueLookupParameter<BoolValue> ParallelParameter { 35 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } 36 } 37 38 public BoolValue Parallel { 39 get { return ParallelParameter.Value; } 40 set { ParallelParameter.Value = value; } 41 } 42 43 public SubScopesProcessor() 33 44 : base() { 45 Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operators should be applied in parallel on the sub-scopes, otherwise false.", new BoolValue(false))); 34 46 } 35 47 36 48 public override IOperation Apply() { 49 BoolValue parallel = ParallelParameter.ActualValue; 37 50 OperationCollection next = new OperationCollection(base.Apply()); 38 51 if (Operators.Count > 0) { 39 52 OperationCollection inner = new OperationCollection(); 53 inner.Parallel = parallel == null ? false : parallel.Value; 40 54 for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++) 41 55 if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i])); -
TabularUnified trunk/sources/HeuristicLab.Operators/3.3/UniformSubScopesProcessor.cs ¶
r3186 r3193 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 23 24 using HeuristicLab.Parameters; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 26 27 namespace HeuristicLab.Operators { 27 28 /// <summary> 28 /// An operator which applies a specified operator sequentiallyon all sub-scopes of the current scope.29 /// An operator which applies a specified operator on all sub-scopes of the current scope. 29 30 /// </summary> 30 [Item("UniformS equentialSubScopesProcessor", "An operator which applies a specified operator sequentiallyon all sub-scopes of the current scope.")]31 [Item("UniformSubScopesProcessor", "An operator which applies a specified operator on all sub-scopes of the current scope.")] 31 32 [StorableClass] 32 public sealed class UniformS equentialSubScopesProcessor : SingleSuccessorOperator {33 public sealed class UniformSubScopesProcessor : SingleSuccessorOperator { 33 34 private OperatorParameter OperatorParameter { 34 35 get { return (OperatorParameter)Parameters["Operator"]; } 35 36 } 37 public ValueLookupParameter<BoolValue> ParallelParameter { 38 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } 39 } 40 36 41 public IOperator Operator { 37 42 get { return OperatorParameter.Value; } 38 43 set { OperatorParameter.Value = value; } 39 44 } 45 public BoolValue Parallel { 46 get { return ParallelParameter.Value; } 47 set { ParallelParameter.Value = value; } 48 } 40 49 41 public UniformS equentialSubScopesProcessor()50 public UniformSubScopesProcessor() 42 51 : base() { 43 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied sequentially on all sub-scopes of the current scope.")); 52 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope.")); 53 Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false))); 44 54 } 45 55 46 56 public override IOperation Apply() { 57 BoolValue parallel = ParallelParameter.ActualValue; 47 58 OperationCollection next = new OperationCollection(base.Apply()); 48 59 if (Operator != null) { 49 60 OperationCollection inner = new OperationCollection(); 61 inner.Parallel = parallel == null ? false : parallel.Value; 50 62 for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++) 51 63 inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
Note: See TracChangeset
for help on using the changeset viewer.