Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16083


Ignore:
Timestamp:
08/16/18 09:45:36 (6 years ago)
Author:
gkronber
Message:

#2937: added symbol for AQ and support for AQ in interpreter and AutoDiff converter

Location:
branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r15583 r16083  
    212212        if (terms.Count == 1) return 1.0 / terms[0];
    213213        else return terms.Aggregate((a, b) => new AutoDiff.Product(a, 1.0 / b));
     214      }
     215      if(node.Symbol is AnalyticalQuotient) {
     216        var x1 = ConvertToAutoDiff(node.GetSubtree(0));
     217        var x2 = ConvertToAutoDiff(node.GetSubtree(1));
     218        return x1 / (TermBuilder.Power(1 + x2 * x2, 0.5));
    214219      }
    215220      if (node.Symbol is Logarithm) {
  • branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs

    r15583 r16083  
    4848      var mul = new Multiplication();
    4949      var div = new Division();
     50      var aq = new AnalyticalQuotient();
    5051      var mean = new Average();
    5152      var sin = new Sine();
     
    123124      autoregressiveVariable.Enabled = false;
    124125
    125       var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, square, pow, sqrt, root, exp,
     126      var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, sin, cos, tan, log, square, pow, sqrt, root, exp,
    126127        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral,
    127128        @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition };
     
    130131      };
    131132
    132       var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };
     133      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition };
    133134      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor };
    134135      var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, constant, laggedVariable, autoregressiveVariable };
  • branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r15902 r16083  
    208208    <Compile Include="Symbols\BinaryFactorVariable.cs" />
    209209    <Compile Include="Symbols\BinaryFactorVariableTreeNode.cs" />
     210    <Compile Include="Symbols\AnalyticalQuotient.cs" />
    210211    <Compile Include="Symbols\FactorVariableTreeNode.cs" />
    211212    <Compile Include="Symbols\FactorVariable.cs" />
  • branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs

    r15583 r16083  
    8585    public const byte FactorVariable = 46;
    8686    public const byte BinaryFactorVariable = 47;
     87    public const byte AnalyticalQuotient = 48;
    8788
    8889
     
    113114      { typeof(Power),OpCodes.Power},
    114115      { typeof(Root),OpCodes.Root},
    115       { typeof(TimeLag), OpCodes.TimeLag}, 
     116      { typeof(TimeLag), OpCodes.TimeLag},
    116117      { typeof(Integral), OpCodes.Integral},
    117118      { typeof(Derivative), OpCodes.Derivative},
     
    135136      { typeof(Bessel), OpCodes.Bessel},
    136137      { typeof(FactorVariable), OpCodes.FactorVariable },
    137       { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable }
     138      { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable },
     139      {typeof(AnalyticalQuotient), OpCodes.AnalyticalQuotient }
    138140    };
    139141
  • branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r15583 r16083  
    215215          if (instr.nArguments == 1) p = 1.0 / p;
    216216          instr.value = p;
     217        } else if (instr.opCode == OpCodes.AnalyticalQuotient) {
     218          var x1 = code[instr.childIndex].value;
     219          var x2 = code[instr.childIndex + 1].value;
     220          instr.value = x1 / Math.Sqrt(1 + x2 * x2);
    217221        } else if (instr.opCode == OpCodes.Average) {
    218222          double s = code[instr.childIndex].value;
Note: See TracChangeset for help on using the changeset viewer.