Changeset 16083 for branches/2937_SymReg_AnalyticalQuotient
- Timestamp:
- 08/16/18 09:45:36 (6 years ago)
- 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 212 212 if (terms.Count == 1) return 1.0 / terms[0]; 213 213 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)); 214 219 } 215 220 if (node.Symbol is Logarithm) { -
branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
r15583 r16083 48 48 var mul = new Multiplication(); 49 49 var div = new Division(); 50 var aq = new AnalyticalQuotient(); 50 51 var mean = new Average(); 51 52 var sin = new Sine(); … … 123 124 autoregressiveVariable.Enabled = false; 124 125 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, 126 127 airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral, 127 128 @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition }; … … 130 131 }; 131 132 132 var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };133 var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition }; 133 134 var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor }; 134 135 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 208 208 <Compile Include="Symbols\BinaryFactorVariable.cs" /> 209 209 <Compile Include="Symbols\BinaryFactorVariableTreeNode.cs" /> 210 <Compile Include="Symbols\AnalyticalQuotient.cs" /> 210 211 <Compile Include="Symbols\FactorVariableTreeNode.cs" /> 211 212 <Compile Include="Symbols\FactorVariable.cs" /> -
branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r15583 r16083 85 85 public const byte FactorVariable = 46; 86 86 public const byte BinaryFactorVariable = 47; 87 public const byte AnalyticalQuotient = 48; 87 88 88 89 … … 113 114 { typeof(Power),OpCodes.Power}, 114 115 { typeof(Root),OpCodes.Root}, 115 { typeof(TimeLag), OpCodes.TimeLag}, 116 { typeof(TimeLag), OpCodes.TimeLag}, 116 117 { typeof(Integral), OpCodes.Integral}, 117 118 { typeof(Derivative), OpCodes.Derivative}, … … 135 136 { typeof(Bessel), OpCodes.Bessel}, 136 137 { typeof(FactorVariable), OpCodes.FactorVariable }, 137 { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable } 138 { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable }, 139 {typeof(AnalyticalQuotient), OpCodes.AnalyticalQuotient } 138 140 }; 139 141 -
branches/2937_SymReg_AnalyticalQuotient/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r15583 r16083 215 215 if (instr.nArguments == 1) p = 1.0 / p; 216 216 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); 217 221 } else if (instr.opCode == OpCodes.Average) { 218 222 double s = code[instr.childIndex].value;
Note: See TracChangeset
for help on using the changeset viewer.