Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/01/21 13:40:55 (3 years ago)
Author:
chaider
Message:

#3140

  • some more refactoring
  • added possibility to set value of num nodes in infix parser
  • changed displaying style of number
Location:
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs

    r18093 r18100  
    4949      var mul = new Multiplication();
    5050      var div = new Division();
    51       var constant = new Num();
    52       constant.MinValue = -20;
    53       constant.MaxValue = 20;
    54       var number = new RealConstant();
     51      var number = new Number();
    5552      number.MinValue = -20;
    5653      number.MaxValue = 20;
     54      var constant = new Constant();
    5755      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
    5856      var binFactorVariableSymbol = new BinaryFactorVariable();
    5957      var factorVariableSymbol = new FactorVariable();
    6058
    61       var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, number, variableSymbol, binFactorVariableSymbol, factorVariableSymbol };
     59      var allSymbols = new List<Symbol>() { add, sub, mul, div, number, constant, variableSymbol, binFactorVariableSymbol, factorVariableSymbol };
    6260      var functionSymbols = new List<Symbol>() { add, sub, mul, div };
    6361
     
    6866        SetSubtreeCount(funSymb, 1, 3);
    6967      }
     68      SetSubtreeCount(number, 0, 0);
    7069      SetSubtreeCount(constant, 0, 0);
    71       SetSubtreeCount(number, 0, 0);
    7270      SetSubtreeCount(variableSymbol, 0, 0);
    7371      SetSubtreeCount(binFactorVariableSymbol, 0, 0);
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs

    r18093 r18100  
    118118      variableCondition.InitialFrequency = 0.0;
    119119
    120       var constant = new Num();
    121       constant.MinValue = -20;
    122       constant.MaxValue = 20;
     120      var number = new Number();
     121      number.MinValue = -20;
     122      number.MaxValue = 20;
    123123      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
    124124      var binFactorVariable = new BinaryFactorVariable();
     
    130130      autoregressiveVariable.Enabled = false;
    131131
    132       var number = new RealConstant();
    133       number.MinValue = -20;
    134       number.MaxValue = 20;
     132      var constant = new Constant();
    135133
    136134      var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp, tanh,
    137135        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral,
    138         @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, number, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition };
     136        @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, number, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition };
    139137      var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, tanh, not, timeLag, integral, derivative,
    140138        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral
     
    143141      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition };
    144142      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor };
    145       var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, constant, number, laggedVariable, autoregressiveVariable };
     143      var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, number, constant, laggedVariable, autoregressiveVariable };
    146144
    147145      foreach (var symb in allSymbols)
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/LinearScalingGrammar.cs

    r18093 r18100  
    6666      var abs = new Absolute();
    6767      var aq = new AnalyticQuotient();
    68       var constant = new Num();
    69       constant.MinValue = -20;
    70       constant.MaxValue = 20;
    71       var number = new RealConstant();
     68      var number = new Number();
    7269      number.MinValue = -20;
    7370      number.MaxValue = 20;
     71      var constant = new Constant();
    7472      var variableSymbol = new Variable();
    7573
     
    8179      //all other symbols
    8280      var allSymbols = new List<Symbol> {
    83         add, sub, mul, div, constant, number, variableSymbol, sin, cos, tan, log, square, sqrt, cube, cbrt, exp,
     81        add, sub, mul, div, number, constant, variableSymbol, sin, cos, tan, log, square, sqrt, cube, cbrt, exp,
    8482        tanh, aq, abs
    8583      };
     
    8987      var realValueSymbols = new List<Symbol> {
    9088         add, sub, mul, div, sin, cos, tan, tanh, exp, log, aq, abs, square, cube, sqrt, cbrt,
    91          variableSymbol, constant, number
     89         variableSymbol, number, constant
    9290        };
    9391
     
    116114      //Define childs for offset
    117115      AddAllowedChildSymbol(offset, scaling, 0);
    118       AddAllowedChildSymbol(offset, constant, 1);
     116      AddAllowedChildSymbol(offset, number, 1);
    119117
    120118      //Define childs for scaling
    121119      foreach (var symb in allSymbols) AddAllowedChildSymbol(scaling, symb, 0);
    122       AddAllowedChildSymbol(scaling, constant, 1);
     120      AddAllowedChildSymbol(scaling, number, 1);
    123121
    124122      //Define childs for realvalue symbols
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r18093 r18100  
    105105      var derivative = new Derivative();
    106106
    107       var constant = new Num();
    108       constant.MinValue = -20;
    109       constant.MaxValue = 20;
    110       var number = new RealConstant();
     107      var number = new Number();
    111108      number.MinValue = -20;
    112109      number.MaxValue = 20;
     110      var constant = new Constant();
    113111      var variableSymbol = new Variable();
    114112      var binFactorVariable = new BinaryFactorVariable();
     
    124122      var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi,
    125123        fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient});
    126       var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, number, variableSymbol, binFactorVariable, factorVariable });
     124      var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { number, constant, variableSymbol, binFactorVariable, factorVariable });
    127125      var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, specialFunctions, terminalSymbols });
    128126
     
    196194      AddAllowedChildSymbol(powerSymbols, laggedVariable, 0);
    197195      AddAllowedChildSymbol(powerSymbols, autoregressiveVariable, 0);
    198       AddAllowedChildSymbol(powerSymbols, constant, 1);
     196      AddAllowedChildSymbol(powerSymbols, number, 1);
    199197
    200198      AddAllowedChildSymbol(square, realValuedSymbols, 0);
Note: See TracChangeset for help on using the changeset viewer.