- Timestamp:
- 01/27/11 10:26:09 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
r5373 r5384 108 108 </ItemGroup> 109 109 <ItemGroup> 110 <Compile Include="Symbolic\Symbols\Root.cs" /> 110 111 <Compile Include="Symbolic\Symbols\Derivative.cs" /> 111 112 <Compile Include="Symbolic\Symbols\Integral.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs
r5373 r5384 54 54 var log = new Logarithm(); 55 55 var pow = new Power(); 56 pow.InitialFrequency = 0.0; 57 var root = new Root(); 58 root.InitialFrequency = 0.0; 56 59 var exp = new Exponential(); 57 60 var @if = new IfThenElse(); … … 76 79 laggedVariable.InitialFrequency = 0.0; 77 80 78 var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable };81 var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable }; 79 82 var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivative }; 80 83 81 var binaryFunctionSymbols = new List<Symbol>() { pow, gt, lt };84 var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt }; 82 85 var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or }; 83 86 var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable }; -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
r5373 r5384 67 67 68 68 public const byte Power = 22; 69 public const byte TimeLag = 23; 70 public const byte Integral = 24; 71 public const byte Derivative = 25; 69 public const byte Root = 23; 70 public const byte TimeLag = 24; 71 public const byte Integral = 25; 72 public const byte Derivative = 26; 72 73 } 73 74 … … 95 96 { typeof(Argument), OpCodes.Arg }, 96 97 { typeof(Power),OpCodes.Power}, 98 { typeof(Root),OpCodes.Root}, 97 99 { typeof(TimeLag), OpCodes.TimeLag}, 98 100 { typeof(Integral), OpCodes.Integral}, 99 { typeof(Derivative), OpCodes.Derivative},101 { typeof(Derivative), OpCodes.Derivative}, 100 102 }; 101 103 private const int ARGUMENT_STACK_SIZE = 1024; … … 196 198 case OpCodes.Power: { 197 199 double x = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 198 double y = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer);200 double y = Math.Round(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 199 201 return Math.Pow(x, y); 202 } 203 case OpCodes.Root: { 204 double x = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 205 double y = Math.Round(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 206 return Math.Pow(x, 1 / y); 200 207 } 201 208 case OpCodes.Exp: { -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Root.cs
r5378 r5384 26 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols { 27 27 [StorableClass] 28 [Item(" Power", "Symbol that represents the powerfunction.")]29 public sealed class Power: Symbol {28 [Item("Root", "Symbol that represents the n-th root function.")] 29 public sealed class Root : Symbol { 30 30 [StorableConstructor] 31 private Power(bool deserializing) : base(deserializing) { }32 private Power(Poweroriginal, Cloner cloner) : base(original, cloner) { }31 private Root(bool deserializing) : base(deserializing) { } 32 private Root(Root original, Cloner cloner) : base(original, cloner) { } 33 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Power(this, cloner);34 return new Root(this, cloner); 35 35 } 36 public Power() : base("Power", "Symbol that represents the powerfunction.") { }36 public Root() : base("Root", "Symbol that represents the n-th root function.") { } 37 37 } 38 38 }
Note: See TracChangeset
for help on using the changeset viewer.