Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/10 01:31:17 (14 years ago)
Author:
swagner
Message:

Unified *SequentialSubScopesProcessor and *ParallelSubScopesProcessor (#943).

Location:
trunk/sources/HeuristicLab.Operators/3.3
Files:
2 deleted
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r2900 r3193  
    9494    <Compile Include="MultipleCallsOperator.cs" />
    9595    <Compile Include="Operator.cs" />
    96     <Compile Include="ParallelSubScopesProcessor.cs" />
    9796    <Compile Include="Placeholder.cs" />
    9897    <Compile Include="IntCounter.cs" />
    9998    <Compile Include="ScopeCleaner.cs" />
    100     <Compile Include="SequentialSubScopesProcessor.cs" />
    10199    <Compile Include="StochasticBranch.cs" />
    102100    <Compile Include="SubScopesCreator.cs" />
     101    <Compile Include="SubScopesProcessor.cs" />
    103102    <Compile Include="SubScopesRemover.cs" />
    104103    <Compile Include="SubScopesSorter.cs" />
    105104    <Compile Include="DoubleCounter.cs" />
    106     <Compile Include="UniformParallelSubScopesProcessor.cs" />
    107     <Compile Include="UniformSequentialSubScopesProcessor.cs" />
    108105    <Compile Include="EmptyOperator.cs">
    109106      <SubType>Code</SubType>
     
    112109    <Compile Include="Properties\AssemblyInfo.cs" />
    113110    <Compile Include="SingleSuccessorOperator.cs" />
     111    <Compile Include="UniformSubScopesProcessor.cs" />
    114112    <Compile Include="ValuesCollector.cs" />
    115113    <Compile Include="VariableCreator.cs" />
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesProcessor.cs

    r3186 r3193  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Data;
     24using HeuristicLab.Parameters;
    2325using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2426
    2527namespace HeuristicLab.Operators {
    2628  /// <summary>
    27   /// An operator which contains multiple operators of which each is applied sequentially 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.
     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.
    2830  /// </summary>
    29   [Item("SequentialSubScopesProcessor", "An operator which contains multiple operators of which each is applied sequentially 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.")]
     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.")]
    3032  [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()
    3344      : 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)));
    3446    }
    3547
    3648    public override IOperation Apply() {
     49      BoolValue parallel = ParallelParameter.ActualValue;
    3750      OperationCollection next = new OperationCollection(base.Apply());
    3851      if (Operators.Count > 0) {
    3952        OperationCollection inner = new OperationCollection();
     53        inner.Parallel = parallel == null ? false : parallel.Value;
    4054        for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++)
    4155          if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i]));
  • trunk/sources/HeuristicLab.Operators/3.3/UniformSubScopesProcessor.cs

    r3186 r3193  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Data;
    2324using HeuristicLab.Parameters;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2627namespace HeuristicLab.Operators {
    2728  /// <summary>
    28   /// An operator which applies a specified operator sequentially on all sub-scopes of the current scope.
     29  /// An operator which applies a specified operator on all sub-scopes of the current scope.
    2930  /// </summary>
    30   [Item("UniformSequentialSubScopesProcessor", "An operator which applies a specified operator sequentially on 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.")]
    3132  [StorableClass]
    32   public sealed class UniformSequentialSubScopesProcessor : SingleSuccessorOperator {
     33  public sealed class UniformSubScopesProcessor : SingleSuccessorOperator {
    3334    private OperatorParameter OperatorParameter {
    3435      get { return (OperatorParameter)Parameters["Operator"]; }
    3536    }
     37    public ValueLookupParameter<BoolValue> ParallelParameter {
     38      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
     39    }
     40
    3641    public IOperator Operator {
    3742      get { return OperatorParameter.Value; }
    3843      set { OperatorParameter.Value = value; }
    3944    }
     45    public BoolValue Parallel {
     46      get { return ParallelParameter.Value; }
     47      set { ParallelParameter.Value = value; }
     48    }
    4049
    41     public UniformSequentialSubScopesProcessor()
     50    public UniformSubScopesProcessor()
    4251      : 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)));
    4454    }
    4555
    4656    public override IOperation Apply() {
     57      BoolValue parallel = ParallelParameter.ActualValue;
    4758      OperationCollection next = new OperationCollection(base.Apply());
    4859      if (Operator != null) {
    4960        OperationCollection inner = new OperationCollection();
     61        inner.Parallel = parallel == null ? false : parallel.Value;
    5062        for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++)
    5163          inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
Note: See TracChangeset for help on using the changeset viewer.