Changeset 17434 for branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
- Timestamp:
- 02/11/20 13:36:02 (5 years ago)
- Location:
- branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r16130 r17434 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2018Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 28 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 29 using HeuristicLab.Parameters; 30 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;30 using HEAL.Attic; 31 31 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 [Storable Class]33 [StorableType("EF325166-E03A-44C4-83CE-7F07B836285E")] 34 34 [Item("SymbolicDataAnalysisExpressionTreeLinearInterpreter", "Fast linear (non-recursive) interpreter for symbolic expression trees. Does not support ADFs.")] 35 35 public sealed class SymbolicDataAnalysisExpressionTreeLinearInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter { … … 70 70 71 71 [StorableConstructor] 72 private SymbolicDataAnalysisExpressionTreeLinearInterpreter(bool deserializing) 73 : base(deserializing) { 72 private SymbolicDataAnalysisExpressionTreeLinearInterpreter(StorableConstructorFlag _) : base(_) { 74 73 interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter(); 75 74 } … … 222 221 if (instr.nArguments == 1) p = 1.0 / p; 223 222 instr.value = p; 223 } else if (instr.opCode == OpCodes.AnalyticQuotient) { 224 var x1 = code[instr.childIndex].value; 225 var x2 = code[instr.childIndex + 1].value; 226 instr.value = x1 / Math.Sqrt(1 + x2 * x2); 224 227 } else if (instr.opCode == OpCodes.Average) { 225 228 double s = code[instr.childIndex].value; … … 228 231 } 229 232 instr.value = s / instr.nArguments; 233 } else if (instr.opCode == OpCodes.Absolute) { 234 instr.value = Math.Abs(code[instr.childIndex].value); 235 } else if (instr.opCode == OpCodes.Tanh) { 236 instr.value = Math.Tanh(code[instr.childIndex].value); 230 237 } else if (instr.opCode == OpCodes.Cos) { 231 238 instr.value = Math.Cos(code[instr.childIndex].value); … … 236 243 } else if (instr.opCode == OpCodes.Square) { 237 244 instr.value = Math.Pow(code[instr.childIndex].value, 2); 245 } else if (instr.opCode == OpCodes.Cube) { 246 instr.value = Math.Pow(code[instr.childIndex].value, 3); 238 247 } else if (instr.opCode == OpCodes.Power) { 239 248 double x = code[instr.childIndex].value; … … 242 251 } else if (instr.opCode == OpCodes.SquareRoot) { 243 252 instr.value = Math.Sqrt(code[instr.childIndex].value); 253 } else if (instr.opCode == OpCodes.CubeRoot) { 254 var arg = code[instr.childIndex].value; 255 instr.value = arg < 0 ? -Math.Pow(-arg, 1.0 / 3.0) : Math.Pow(arg, 1.0 / 3.0); 244 256 } else if (instr.opCode == OpCodes.Root) { 245 257 double x = code[instr.childIndex].value;
Note: See TracChangeset
for help on using the changeset viewer.