Exemplo n.º 1
0
        public MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()
            : base()
        {
            Parameters.Add(new ScopeTreeLookupParameter <ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose length should be calculated."));
            Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>(SymbolicExpressionTreeLengthParameterName, "The length of the symbolic expression tree."));
            Parameters.Add(new ValueLookupParameter <DataTable>(SymbolicExpressionTreeLengthsParameterName, "The data table to store the symbolic expression tree lengths."));
            Parameters.Add(new ValueLookupParameter <VariableCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));

            subScopesProcessor = new UniformSubScopesProcessor();
            SymbolicExpressionTreeLengthCalculator lengthCalculator = new SymbolicExpressionTreeLengthCalculator();

            valueAnalyzer = new MinAverageMaxValueAnalyzer();

            subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth;
            lengthCalculator.SymbolicExpressionTreeParameter.ActualName       = SymbolicExpressionTreeParameter.Name;
            lengthCalculator.SymbolicExpressionTreeLengthParameter.ActualName = SymbolicExpressionTreeLengthParameter.Name;
            valueAnalyzer.ValueParameter.ActualName                   = lengthCalculator.SymbolicExpressionTreeLengthParameter.Name;
            valueAnalyzer.ValueParameter.Depth                        = SymbolicExpressionTreeLengthParameter.Depth;
            valueAnalyzer.AverageValueParameter.ActualName            = AverageTreeLengthParameterName;
            valueAnalyzer.CollectAverageValueInResultsParameter.Value = new BoolValue(false);
            valueAnalyzer.MaxValueParameter.ActualName                = MaxTreeLengthParameterName;
            valueAnalyzer.CollectMaxValueInResultsParameter.Value     = new BoolValue(false);
            valueAnalyzer.MinValueParameter.ActualName                = MinTreeLengthParameterName;
            valueAnalyzer.CollectMinValueInResultsParameter.Value     = new BoolValue(false);
            valueAnalyzer.ValuesParameter.ActualName                  = SymbolicExpressionTreeLengthsParameter.Name;

            OperatorGraph.InitialOperator = subScopesProcessor;
            subScopesProcessor.Operator   = lengthCalculator;
            lengthCalculator.Successor    = null;
            subScopesProcessor.Successor  = valueAnalyzer;
            valueAnalyzer.Successor       = null;

            AfterDeserialization();
        }
 private SymbolicExpressionTreeLengthCalculator(SymbolicExpressionTreeLengthCalculator original, Cloner cloner) : base(original, cloner)
 {
 }
 private SymbolicExpressionTreeLengthCalculator(SymbolicExpressionTreeLengthCalculator original, Cloner cloner) : base(original, cloner) { }
    public MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()
      : base() {
      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose length should be calculated."));
      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(SymbolicExpressionTreeLengthParameterName, "The length of the symbolic expression tree."));
      Parameters.Add(new ValueLookupParameter<DataTable>(SymbolicExpressionTreeLengthsParameterName, "The data table to store the symbolic expression tree lengths."));
      Parameters.Add(new ValueLookupParameter<VariableCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));

      subScopesProcessor = new UniformSubScopesProcessor();
      SymbolicExpressionTreeLengthCalculator lengthCalculator = new SymbolicExpressionTreeLengthCalculator();
      valueAnalyzer = new MinAverageMaxValueAnalyzer();

      subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth;
      lengthCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
      lengthCalculator.SymbolicExpressionTreeLengthParameter.ActualName = SymbolicExpressionTreeLengthParameter.Name;
      valueAnalyzer.ValueParameter.ActualName = lengthCalculator.SymbolicExpressionTreeLengthParameter.Name;
      valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeLengthParameter.Depth;
      valueAnalyzer.AverageValueParameter.ActualName = AverageTreeLengthParameterName;
      valueAnalyzer.CollectAverageValueInResultsParameter.Value = new BoolValue(false);
      valueAnalyzer.MaxValueParameter.ActualName = MaxTreeLengthParameterName;
      valueAnalyzer.CollectMaxValueInResultsParameter.Value = new BoolValue(false);
      valueAnalyzer.MinValueParameter.ActualName = MinTreeLengthParameterName;
      valueAnalyzer.CollectMinValueInResultsParameter.Value = new BoolValue(false);
      valueAnalyzer.ValuesParameter.ActualName = SymbolicExpressionTreeLengthsParameter.Name;

      OperatorGraph.InitialOperator = subScopesProcessor;
      subScopesProcessor.Operator = lengthCalculator;
      lengthCalculator.Successor = null;
      subScopesProcessor.Successor = valueAnalyzer;
      valueAnalyzer.Successor = null;

      AfterDeserialization();
    }