Changeset 17460
- Timestamp:
- 02/28/20 14:55:58 (5 years ago)
- Location:
- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 5 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/DataAnalysisGrammar.cs
r17456 r17460 35 35 protected DataAnalysisGrammar(string name, string description) : base(name, description) { } 36 36 37 public v oid ConfigureVariableSymbols(IDataAnalysisProblemData problemData) {37 public virtual void ConfigureVariableSymbols(IDataAnalysisProblemData problemData) { 38 38 var dataset = problemData.Dataset; 39 39 foreach (var varSymbol in Symbols.OfType<VariableBase>()) { -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalVectorExpressionGrammar.cs
r17456 r17460 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 28 29 29 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 [StorableType(" 44B0829C-1CB5-4BE9-9514-BBA54FAB2912")]31 [Item("FullFunctional ExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")]32 public class FullFunctional ExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {31 [StorableType("C913F5C6-AF16-4F2C-BA93-2D5AE1F8E68A")] 32 [Item("FullFunctionalVectorExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")] 33 public class FullFunctionalVectorExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 33 34 [StorableConstructor] 34 protected FullFunctional ExpressionGrammar(StorableConstructorFlag _) : base(_) { }35 protected FullFunctional ExpressionGrammar(FullFunctionalExpressionGrammar original, Cloner cloner) : base(original, cloner) { }36 public FullFunctional ExpressionGrammar()37 : base(ItemAttribute.GetName(typeof(FullFunctional ExpressionGrammar)), ItemAttribute.GetDescription(typeof(FullFunctionalExpressionGrammar))) {35 protected FullFunctionalVectorExpressionGrammar(StorableConstructorFlag _) : base(_) { } 36 protected FullFunctionalVectorExpressionGrammar(FullFunctionalVectorExpressionGrammar original, Cloner cloner) : base(original, cloner) { } 37 public FullFunctionalVectorExpressionGrammar() 38 : base(ItemAttribute.GetName(typeof(FullFunctionalVectorExpressionGrammar)), ItemAttribute.GetDescription(typeof(FullFunctionalVectorExpressionGrammar))) { 38 39 Initialize(); 39 40 } 40 41 41 42 public override IDeepCloneable Clone(Cloner cloner) { 42 return new FullFunctional ExpressionGrammar(this, cloner);43 return new FullFunctionalVectorExpressionGrammar(this, cloner); 43 44 } 44 45 … … 48 49 var mul = new Multiplication(); 49 50 var div = new Division(); 50 var aq = new AnalyticQuotient(); 51 var mean = new Average(); 51 52 52 var sin = new Sine(); 53 53 var cos = new Cosine(); 54 54 var tan = new Tangent(); 55 55 56 var log = new Logarithm(); 56 var abs = new Absolute(); 57 var tanh = new HyperbolicTangent(); 58 var pow = new Power(); 59 pow.InitialFrequency = 0.0; 60 var square = new Square(); 61 square.InitialFrequency = 0.0; 62 var cube = new Cube(); 63 cube.InitialFrequency = 0.0; 64 var root = new Root(); 65 root.InitialFrequency = 0.0; 66 var sqrt = new SquareRoot(); 67 sqrt.InitialFrequency = 0.0; 68 var cubeRoot = new CubeRoot(); 69 cubeRoot.InitialFrequency = 0.0; 70 var airyA = new AiryA(); 71 airyA.InitialFrequency = 0.0; 72 var airyB = new AiryB(); 73 airyB.InitialFrequency = 0.0; 74 var bessel = new Bessel(); 75 bessel.InitialFrequency = 0.0; 76 var cosineIntegral = new CosineIntegral(); 77 cosineIntegral.InitialFrequency = 0.0; 78 var dawson = new Dawson(); 79 dawson.InitialFrequency = 0.0; 80 var erf = new Erf(); 81 erf.InitialFrequency = 0.0; 82 var expIntegralEi = new ExponentialIntegralEi(); 83 expIntegralEi.InitialFrequency = 0.0; 84 var fresnelCosineIntegral = new FresnelCosineIntegral(); 85 fresnelCosineIntegral.InitialFrequency = 0.0; 86 var fresnelSineIntegral = new FresnelSineIntegral(); 87 fresnelSineIntegral.InitialFrequency = 0.0; 88 var gamma = new Gamma(); 89 gamma.InitialFrequency = 0.0; 90 var hypCosineIntegral = new HyperbolicCosineIntegral(); 91 hypCosineIntegral.InitialFrequency = 0.0; 92 var hypSineIntegral = new HyperbolicSineIntegral(); 93 hypSineIntegral.InitialFrequency = 0.0; 94 var norm = new Norm(); 95 norm.InitialFrequency = 0.0; 96 var psi = new Psi(); 97 psi.InitialFrequency = 0.0; 98 var sineIntegral = new SineIntegral(); 99 sineIntegral.InitialFrequency = 0.0; 57 var exp = new Exponential(); 100 58 101 var exp = new Exponential();102 var @if = new IfThenElse();103 var gt = new GreaterThan();104 var lt = new LessThan();105 var and = new And();106 var or = new Or();107 var not = new Not();108 var xor = new Xor();109 59 110 var timeLag = new TimeLag();111 timeLag.InitialFrequency = 0.0;112 var integral = new Integral();113 integral.InitialFrequency = 0.0;114 var derivative = new Derivative();115 derivative.InitialFrequency = 0.0;60 var pow = new Power { InitialFrequency = 0.0 }; 61 var root = new Root { InitialFrequency = 0.0 }; 62 var square = new Square { InitialFrequency = 0.0 }; 63 var sqrt = new SquareRoot { InitialFrequency = 0.0 }; 64 var cube = new Cube { InitialFrequency = 0.0 }; 65 var cubeRoot = new CubeRoot { InitialFrequency = 0.0 }; 116 66 117 var variableCondition = new VariableCondition(); 118 variableCondition.InitialFrequency = 0.0; 119 120 var constant = new Constant(); 121 constant.MinValue = -20; 122 constant.MaxValue = 20; 123 var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable(); 67 var constant = new Constant { MinValue = -20, MaxValue = 20 }; 68 var variable = new Variable(); 124 69 var binFactorVariable = new BinaryFactorVariable(); 125 70 var factorVariable = new FactorVariable(); 126 var laggedVariable = new LaggedVariable(); 127 laggedVariable.InitialFrequency = 0.0; 128 var autoregressiveVariable = new AutoregressiveTargetVariable(); 129 autoregressiveVariable.InitialFrequency = 0.0; 130 autoregressiveVariable.Enabled = false; 71 var vectorVariable = new Variable() { Name = "Vector Variable" }; 131 72 132 var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp, tanh, 133 airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral, 134 @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition }; 135 var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, tanh, not, timeLag, integral, derivative, 136 airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral 73 var sum = new Sum(); 74 var mean = new Average() { Name = "Mean" }; 75 76 77 var allSymbols = new List<Symbol>() { 78 add, sub, mul, div, 79 sin, cos, tan, 80 log, exp, 81 square, sqrt, cube, cubeRoot, pow, root, 82 constant, variable, binFactorVariable, factorVariable, vectorVariable, 83 sum, mean 84 }; 85 var unaryFunctionSymbols = new List<Symbol>() { 86 sin, cos, tan, 87 log, exp 137 88 }; 138 89 139 var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition }; 140 var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor }; 141 var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, constant, laggedVariable, autoregressiveVariable }; 90 var binaryFunctionSymbols = new List<Symbol>() { pow, root }; 91 var ternarySymbols = new List<Symbol>() { add, sub, mul, div }; 92 var terminalSymbols = new List<Symbol>() { variable, binFactorVariable, factorVariable, vectorVariable, constant }; 93 94 var aggregationSymbols = new List<Symbol>() { sum, mean }; 142 95 143 96 foreach (var symb in allSymbols) … … 156 109 SetSubtreeCount(terminalSymbol, 0, 0); 157 110 } 158 159 SetSubtreeCount(@if, 3, 3); 111 foreach (var aggrSymb in aggregationSymbols) { 112 SetSubtreeCount(aggrSymb, 1, 1); 113 } 160 114 161 115 … … 172 126 } 173 127 } 128 129 public override void ConfigureVariableSymbols(IDataAnalysisProblemData problemData) { 130 base.ConfigureVariableSymbols(problemData); 131 132 var dataset = problemData.Dataset; 133 foreach (var varSymbol in Symbols.OfType<VariableBase>().Where(sym => sym.Name == "Variable")) { 134 if (!varSymbol.Fixed) { 135 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<double>(x)); 136 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<double>(x)); 137 } 138 } 139 foreach (var varSymbol in Symbols.OfType<VariableBase>().Where(sym => sym.Name == "Vector Variable")) { 140 if (!varSymbol.Fixed) { 141 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<DoubleVector>(x)); 142 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<DoubleVector>(x)); 143 } 144 } 145 } 174 146 } 175 147 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r17456 r17460 42 42 private const string SpecialFunctionsName = "Special Functions"; 43 43 private const string TimeSeriesSymbolsName = "Time Series Symbols"; 44 private const string VectorSymbolsName = "Vector Symbols";45 44 46 45 [StorableConstructor] … … 250 249 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 251 250 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 252 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false;253 251 } 254 252 … … 264 262 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 265 263 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 266 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false;267 264 } 268 265 … … 275 272 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 276 273 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 277 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false;278 274 279 275 Symbols.Single(s => s.Name == "Variable").Enabled = false; -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentVectorExpressionGrammar.cs
r17456 r17460 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 29 28 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 29 [StorableType(" 36A22322-0627-4E25-A468-F2A788AF6D46")]30 [Item("TypeCoherent ExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that boolean and real-valuedexpressions are not mixed.")]31 public class TypeCoherent ExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {31 [StorableType("7EC7B4A7-0E27-4011-B983-B0E15A6944EC")] 32 [Item("TypeCoherentVectorExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that vector and scalar expressions are not mixed.")] 33 public class TypeCoherentVectorExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 32 34 private const string ArithmeticFunctionsName = "Arithmetic Functions"; 33 35 private const string TrigonometricFunctionsName = "Trigonometric Functions"; … … 42 44 private const string SpecialFunctionsName = "Special Functions"; 43 45 private const string TimeSeriesSymbolsName = "Time Series Symbols"; 44 private const string VectorSymbolsName = "Vector Symbols";45 46 46 47 [StorableConstructor] 47 protected TypeCoherent ExpressionGrammar(StorableConstructorFlag _) : base(_) { }48 protected TypeCoherent ExpressionGrammar(TypeCoherentExpressionGrammar original, Cloner cloner) : base(original, cloner) { }49 public TypeCoherent ExpressionGrammar()50 : base(ItemAttribute.GetName(typeof(TypeCoherent ExpressionGrammar)), ItemAttribute.GetDescription(typeof(TypeCoherentExpressionGrammar))) {48 protected TypeCoherentVectorExpressionGrammar(StorableConstructorFlag _) : base(_) { } 49 protected TypeCoherentVectorExpressionGrammar(TypeCoherentVectorExpressionGrammar original, Cloner cloner) : base(original, cloner) { } 50 public TypeCoherentVectorExpressionGrammar() 51 : base(ItemAttribute.GetName(typeof(TypeCoherentVectorExpressionGrammar)), ItemAttribute.GetDescription(typeof(TypeCoherentVectorExpressionGrammar))) { 51 52 Initialize(); 52 53 } 53 54 public override IDeepCloneable Clone(Cloner cloner) { 54 return new TypeCoherent ExpressionGrammar(this, cloner);55 return new TypeCoherentVectorExpressionGrammar(this, cloner); 55 56 } 56 57 … … 241 242 } 242 243 243 public void ConfigureAsDefaultRegressionGrammar() { 244 Symbols.First(s => s is Average).Enabled = false; 245 Symbols.First(s => s is Absolute).Enabled = false; 246 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 247 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 248 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 249 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 250 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 251 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 252 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 253 } 254 255 public void ConfigureAsDefaultClassificationGrammar() { 256 Symbols.First(s => s is Average).Enabled = false; 257 Symbols.First(s => s is VariableCondition).Enabled = false; 258 Symbols.First(s => s is Xor).Enabled = false; 259 Symbols.First(s => s is Absolute).Enabled = false; 260 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 261 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 262 Symbols.First(s => s.Name == ExponentialFunctionsName).Enabled = false; 263 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 264 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 265 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 266 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 267 } 268 269 public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() { 270 Symbols.First(s => s is Average).Enabled = false; 271 Symbols.First(s => s is Absolute).Enabled = false; 272 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 273 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 274 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 275 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 276 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 277 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 278 279 Symbols.Single(s => s.Name == "Variable").Enabled = false; 280 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = true; 281 Symbols.First(s => s is Derivative).Enabled = false; 282 Symbols.First(s => s is Integral).Enabled = false; 283 Symbols.First(s => s is TimeLag).Enabled = false; 244 public override void ConfigureVariableSymbols(IDataAnalysisProblemData problemData) { 245 base.ConfigureVariableSymbols(problemData); 246 247 var dataset = problemData.Dataset; 248 foreach (var varSymbol in Symbols.OfType<VariableBase>().Where(sym => sym.Name == "Variable")) { 249 if (!varSymbol.Fixed) { 250 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<double>(x)); 251 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<double>(x)); 252 } 253 } 254 foreach (var varSymbol in Symbols.OfType<VariableBase>().Where(sym => sym.Name == "Vector Variable")) { 255 if (!varSymbol.Fixed) { 256 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<DoubleVector>(x)); 257 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<DoubleVector>(x)); 258 } 259 } 284 260 } 285 261 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r17456 r17460 161 161 <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" /> 162 162 <Compile Include="Grammars\DataAnalysisGrammar.cs" /> 163 <Compile Include="Grammars\FullFunctionalVectorExpressionGrammar.cs" /> 164 <Compile Include="Grammars\TypeCoherentVectorExpressionGrammar.cs" /> 163 165 <Compile Include="Hashing\HashExtensions.cs" /> 164 166 <Compile Include="Hashing\HashUtil.cs" /> … … 229 231 <Compile Include="Symbols\And.cs" /> 230 232 <Compile Include="Symbols\AutoregressiveVariable.cs" /> 233 <Compile Include="Symbols\Sum.cs" /> 231 234 <Compile Include="Symbols\Average.cs" /> 232 235 <Compile Include="Symbols\Constant.cs" /> -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r17455 r17460 77 77 Cube = 50, 78 78 CubeRoot = 51, 79 Tanh = 52 79 Tanh = 52, 80 Sum = 53 80 81 }; 81 82 public static class OpCodes { … … 133 134 public const byte CubeRoot = (byte)OpCode.CubeRoot; 134 135 public const byte Tanh = (byte)OpCode.Tanh; 136 public const byte Sum = (byte)OpCode.Sum; 135 137 136 138 private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() { … … 187 189 { typeof(AnalyticQuotient), OpCodes.AnalyticQuotient }, 188 190 { typeof(Cube), OpCodes.Cube }, 189 { typeof(CubeRoot), OpCodes.CubeRoot } 191 { typeof(CubeRoot), OpCodes.CubeRoot }, 192 { typeof(Sum), OpCodes.Sum } 190 193 }; 191 194 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeVectorInterpreter.cs
r17455 r17460 118 118 if (instr.opCode == OpCodes.Variable) { 119 119 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 120 instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 120 if (dataset.VariableHasType<double>(variableTreeNode.VariableName)) 121 instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 122 else if (dataset.VariableHasType<DoubleVector>(variableTreeNode.VariableName)) 123 instr.data = dataset.GetReadOnlyDoubleVectorValues(variableTreeNode.VariableName); 124 else throw new NotSupportedException($"Type of variable {variableTreeNode.VariableName} is not supported."); 121 125 } else if (instr.opCode == OpCodes.FactorVariable) { 122 126 var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode; … … 186 190 throw new NotSupportedException($"Unsupported argument type ({val})"); 187 191 } 192 private static EvaluationResult AggregateApply(EvaluationResult val, 193 Func<double, double> sFunc = null, 194 Func<DoubleVector, double> vFunc = null) { 195 if (val.IsScalar && sFunc != null) return new EvaluationResult(sFunc(val.Scalar)); 196 if (val.IsVector && vFunc != null) return new EvaluationResult(vFunc(val.Vector)); 197 throw new NotSupportedException($"Unsupported argument type ({val})"); 198 } 188 199 189 200 public virtual EvaluationResult Evaluate(IDataset dataset, ref int row, InterpreterState state) { … … 312 323 v => DoubleVector.Log(v)); 313 324 } 325 case OpCodes.Sum: { 326 var cur = Evaluate(dataset, ref row, state); 327 return AggregateApply(cur, 328 s => s, 329 v => v.Sum()); 330 } 331 case OpCodes.Average: { 332 var cur = Evaluate(dataset, ref row, state); 333 return AggregateApply(cur, 334 s => s, 335 v => v.Mean()); 336 } 314 337 case OpCodes.Variable: { 315 338 if (row < 0 || row >= dataset.Rows) return EvaluationResult.NaN; -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sum.cs
r17455 r17460 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HEAL.Attic; 26 26 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 27 [StorableType(" 459E521B-A921-4A0F-B63D-B298DA2CDD11")]28 [Item(" Average", "Symbol that represents the average (arithmetic mean)function.")]29 public sealed class Average: Symbol {28 [StorableType("C6C245BF-C44A-4207-A268-55641483F27F")] 29 [Item("Sum", "Symbol that represents the Sum function.")] 30 public sealed class Sum : Symbol { 30 31 private const int minimumArity = 1; 31 32 private const int maximumArity = byte.MaxValue; … … 39 40 40 41 [StorableConstructor] 41 private Average(StorableConstructorFlag _) : base(_) { }42 private Average(Averageoriginal, Cloner cloner) : base(original, cloner) { }42 private Sum(StorableConstructorFlag _) : base(_) { } 43 private Sum(Sum original, Cloner cloner) : base(original, cloner) { } 43 44 public override IDeepCloneable Clone(Cloner cloner) { 44 return new Average(this, cloner);45 return new Sum(this, cloner); 45 46 } 46 public Average() : base("Average", "Symbol that represents the average (arithmetic mean)function.") { }47 public Sum() : base("Sum", "Symbol that represents the sum function.") { } 47 48 } 48 49 }
Note: See TracChangeset
for help on using the changeset viewer.