Changeset 12080


Ignore:
Timestamp:
02/26/15 12:44:13 (4 years ago)
Author:
pfleck
Message:

#2269

  • LayerUniformSubScopesProcessor does not longer derives from UniformSubScopesProcessor.
  • Reverted changes of UniformSubScopesProcessor.
Location:
branches/ALPS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUniformSubScopesProcessor.cs

    r12039 r12080  
    3434  [Item("LayerUniformSubScopesProcessor", "")]
    3535  [StorableClass]
    36   public class LayerUniformSubScopesProcessor : UniformSubScopesProcessor {
     36  public class LayerUniformSubScopesProcessor : SingleSuccessorOperator {
     37    private OperatorParameter OperatorParameter {
     38      get { return (OperatorParameter)Parameters["Operator"]; }
     39    }
     40    public ValueLookupParameter<BoolValue> ParallelParameter {
     41      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
     42    }
    3743
    3844    private ILookupParameter<IntArray> PopulationSizeParameter {
    3945      get { return (ILookupParameter<IntArray>)Parameters["PopulationSize"]; }
     46    }
     47
     48    public IOperator Operator {
     49      get { return OperatorParameter.Value; }
     50      set { OperatorParameter.Value = value; }
     51    }
     52    public BoolValue Parallel {
     53      get { return ParallelParameter.Value; }
     54      set { ParallelParameter.Value = value; }
    4055    }
    4156
     
    4762    public LayerUniformSubScopesProcessor()
    4863      : base() {
     64      Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope."));
     65      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false)));
     66
    4967      Parameters.Add(new LookupParameter<IntArray>("PopulationSize"));
    5068    }
     
    5573
    5674    public override IOperation Apply() {
    57       OperationCollection next = new OperationCollection(Successor != null ? ExecutionContext.CreateOperation(Successor) : null); // base.base.Apply not possible
     75      var next = new OperationCollection(Successor != null ? ExecutionContext.CreateOperation(Successor) : null);
    5876      if (Operator != null) {
    59         List<IScope> scopes = GetScopesOnLevel(ExecutionContext.Scope, Depth.Value).ToList();
    60         OperationCollection inner = new OperationCollection();
    61         inner.Parallel = Parallel == null ? false : Parallel.Value;
     77        var scopes = ExecutionContext.Scope.SubScopes;
     78        var inner = new OperationCollection() {
     79          Parallel = Parallel == null ? false : Parallel.Value
     80        };
    6281        for (int i = 0; i < scopes.Count; i++) {
    6382          var layerParameters = new LayerIntermediateParameter {
  • branches/ALPS/HeuristicLab.Operators/3.3/UniformSubScopesProcessor.cs

    r12035 r12080  
    3434  [Item("UniformSubScopesProcessor", "An operator which applies a specified operator on all sub-scopes at the given depth of the current scope.")]
    3535  [StorableClass]
    36   public class UniformSubScopesProcessor : SingleSuccessorOperator {
     36  public sealed class UniformSubScopesProcessor : SingleSuccessorOperator {
    3737    private OperatorParameter OperatorParameter {
    3838      get { return (OperatorParameter)Parameters["Operator"]; }
     
    5959
    6060    [StorableConstructor]
    61     protected UniformSubScopesProcessor(bool deserializing) : base(deserializing) { }
    62     protected UniformSubScopesProcessor(UniformSubScopesProcessor original, Cloner cloner)
     61    private UniformSubScopesProcessor(bool deserializing) : base(deserializing) { }
     62    private UniformSubScopesProcessor(UniformSubScopesProcessor original, Cloner cloner)
    6363      : base(original, cloner) {
    6464    }
     
    8888    }
    8989
    90     protected IEnumerable<IScope> GetScopesOnLevel(IScope scope, int d) {
     90    private IEnumerable<IScope> GetScopesOnLevel(IScope scope, int d) {
    9191      if (d == 0) yield return scope;
    9292      else {
Note: See TracChangeset for help on using the changeset viewer.