Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12266


Ignore:
Timestamp:
03/30/15 12:28:56 (10 years ago)
Author:
mkommend
Message:

#2320: Corrected event registration in SymbolicExpressionTreeEncoding.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeEncoding.cs

    r12196 r12266  
    5151        treeLengthParameter = value;
    5252        Parameters.Add(treeLengthParameter);
     53        OnLengthParameterChanged();
    5354      }
    5455    }
     
    6869        treeDepthParameter = value;
    6970        Parameters.Add(treeDepthParameter);
     71        OnDepthParameterChanged();
    7072      }
    7173    }
     
    7577    [StorableConstructor]
    7678    public SymbolicExpressionTreeEncoding(bool deserializing) : base(deserializing) { }
    77 
    78     public SymbolicExpressionTreeEncoding(Encoding<ISymbolicExpressionTreeCreator> original, Cloner cloner)
    79       : base(original, cloner) {
    80     }
    81 
    8279    public SymbolicExpressionTreeEncoding() : this("SymbolicExpressionTree") { }
    8380    public SymbolicExpressionTreeEncoding(string name) : base(name) { }
     
    8582    private SymbolicExpressionTreeEncoding(SymbolicExpressionTreeEncoding original, Cloner cloner)
    8683      : base(original, cloner) {
     84      TreeLengthParameter = cloner.Clone(original.TreeLengthParameter);
     85      TreeDepthParameter = cloner.Clone(original.TreeDepthParameter);
    8786    }
    8887
     
    9190    }
    9291
    93     public override void ConfigureOperators(IEnumerable<IOperator> operators) {
    94       ConfigureCreators(operators.OfType<ISymbolicExpressionTreeCreator>());
    95       ConfigureCrossovers(operators.OfType<ISymbolicExpressionTreeCrossover>());
    96       ConfigureManipulators(operators.OfType<ISymbolicExpressionTreeManipulator>());
    97     }
     92 
    9893
    9994    private void OnLengthParameterChanged() {
     
    105100      RegisterDepthParameterEvents();
    106101      ConfigureOperators(Operators);
     102    }
     103
     104    private void RegisterEvents() {
     105      RegisterLengthParameterEvents();
     106      RegisterLengthParameterEvents();
    107107    }
    108108
     
    119119    #region Operator discovery
    120120    private static readonly IEnumerable<Type> encodingSpecificOperatorTypes;
    121 
    122121    static SymbolicExpressionTreeEncoding() {
    123122      encodingSpecificOperatorTypes = new List<Type>
     
    143142
    144143    #region Specific operator wiring
     144
     145    public override void ConfigureOperators(IEnumerable<IOperator> operators) {
     146      ConfigureCreators(operators.OfType<ISymbolicExpressionTreeCreator>());
     147      ConfigureCrossovers(operators.OfType<ISymbolicExpressionTreeCrossover>());
     148      ConfigureManipulators(operators.OfType<ISymbolicExpressionTreeManipulator>());
     149    }
     150
    145151    private void ConfigureCreators(IEnumerable<ISymbolicExpressionTreeCreator> creators) {
    146152      foreach (var creator in creators) {
Note: See TracChangeset for help on using the changeset viewer.