- Timestamp:
- 01/11/11 15:03:46 (14 years ago)
- Location:
- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/ArithmeticExpressionGrammar.cs
r4341 r5275 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 30 31 [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")] 31 32 public class ArithmeticExpressionGrammar : DefaultSymbolicExpressionGrammar { 33 34 [StorableConstructor] 35 protected ArithmeticExpressionGrammar(bool deserializing) : base(deserializing) { } 36 protected ArithmeticExpressionGrammar(ArithmeticExpressionGrammar original, Cloner cloner) : base(original, cloner) { } 32 37 public ArithmeticExpressionGrammar() 33 38 : base() { 34 39 Initialize(); 35 40 } 36 37 [StorableConstructor]38 protected ArithmeticExpressionGrammar(bool deserializing) : base(deserializing) {}41 public override IDeepCloneable Clone(Cloner cloner) { 42 return new ArithmeticExpressionGrammar(this, cloner); 43 } 39 44 40 45 private void Initialize() { -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/BasicExpressionGrammar.cs
r4193 r5275 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; 28 using HeuristicLab.Common; 28 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 29 30 [StorableClass] … … 33 34 private HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable variableSymbol; 34 35 36 [StorableConstructor] 37 protected BasicExpressionGrammar(bool deserializing) : base(deserializing) { } 38 protected BasicExpressionGrammar(BasicExpressionGrammar original, Cloner cloner) 39 : base(original, cloner) { 40 foreach (var symb in Symbols) { 41 var varSym = symb as HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable; 42 if (varSym != null) this.variableSymbol = varSym; 43 break; 44 } 45 } 35 46 public BasicExpressionGrammar() 36 47 : base() { … … 38 49 } 39 50 40 [StorableConstructor] 41 protected BasicExpressionGrammar(bool deserializing) : base(deserializing) { } 51 public override IDeepCloneable Clone(Cloner cloner) { 52 return new BasicExpressionGrammar(this, cloner); 53 } 42 54 43 55 private void Initialize() { -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs
r4341 r5275 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 30 31 [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")] 31 32 public class FullFunctionalExpressionGrammar : DefaultSymbolicExpressionGrammar { 33 [StorableConstructor] 34 protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { } 35 protected FullFunctionalExpressionGrammar(FullFunctionalExpressionGrammar original, Cloner cloner) : base(original, cloner) { } 32 36 public FullFunctionalExpressionGrammar() 33 37 : base() { 34 38 Initialize(); 35 39 } 36 [StorableConstructor] 37 protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { } 40 41 public override IDeepCloneable Clone(Cloner cloner) { 42 return new FullFunctionalExpressionGrammar(this, cloner); 43 } 38 44 39 45 private void Initialize() { -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
r4193 r5275 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 32 33 [StorableClass] 33 34 [Item("SimpleArithmeticExpressionInterpreter", "Interpreter for arithmetic symbolic expression trees including function calls.")] 34 // not thread safe! 35 public class SimpleArithmeticExpressionInterpreter : NamedItem, ISymbolicExpressionTreeInterpreter { 35 public sealed class SimpleArithmeticExpressionInterpreter : NamedItem, ISymbolicExpressionTreeInterpreter { 36 36 private class OpCodes { 37 37 public const byte Add = 1; … … 65 65 public const byte Constant = 20; 66 66 public const byte Arg = 21; 67 public const byte Differential = 22;68 67 } 69 68 … … 90 89 { typeof(Constant), OpCodes.Constant }, 91 90 { typeof(Argument), OpCodes.Arg }, 92 { typeof(DifferentialVariable), OpCodes.Differential},93 91 }; 94 92 private const int ARGUMENT_STACK_SIZE = 1024; 95 93 96 private Dataset dataset;97 private int row;98 private Instruction[] code;99 private int pc;100 private double[] argumentStack = new double[ARGUMENT_STACK_SIZE];101 private int argStackPointer;102 103 94 public override bool CanChangeName { 104 95 get { return false; } … … 108 99 } 109 100 101 [StorableConstructor] 102 private SimpleArithmeticExpressionInterpreter(bool deserializing) : base(deserializing) { } 103 private SimpleArithmeticExpressionInterpreter(SimpleArithmeticExpressionInterpreter original, Cloner cloner) : base(original, cloner) { } 104 public override IDeepCloneable Clone(Cloner cloner) { 105 return new SimpleArithmeticExpressionInterpreter(this, cloner); 106 } 107 110 108 public SimpleArithmeticExpressionInterpreter() 111 109 : base() { … … 113 111 114 112 public IEnumerable<double> GetSymbolicExpressionTreeValues(SymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) { 115 this.dataset = dataset;116 113 var compiler = new SymbolicExpressionTreeCompiler(); 117 compiler.AddInstructionPostProcessingHook(PostProcessInstruction); 118 code = compiler.Compile(tree, MapSymbolToOpCode); 119 foreach (var row in rows) { 120 this.row = row; 121 pc = 0; 122 argStackPointer = 0; 123 yield return Evaluate(); 124 } 125 } 126 127 private Instruction PostProcessInstruction(Instruction instr) { 128 if (instr.opCode == OpCodes.Variable) { 129 var variableTreeNode = instr.dynamicNode as VariableTreeNode; 130 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 131 } else if (instr.opCode == OpCodes.LagVariable) { 132 var variableTreeNode = instr.dynamicNode as LaggedVariableTreeNode; 133 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 134 } else if (instr.opCode == OpCodes.Differential) { 135 var variableTreeNode = instr.dynamicNode as DifferentialVariableTreeNode; 136 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 137 } 138 return instr; 114 Instruction[] code = compiler.Compile(tree, MapSymbolToOpCode); 115 116 for (int i = 0; i < code.Length; i++) { 117 Instruction instr = code[i]; 118 if (instr.opCode == OpCodes.Variable) { 119 var variableTreeNode = instr.dynamicNode as VariableTreeNode; 120 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 121 code[i] = instr; 122 } else if (instr.opCode == OpCodes.LagVariable) { 123 var variableTreeNode = instr.dynamicNode as LaggedVariableTreeNode; 124 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 125 code[i] = instr; 126 } 127 } 128 129 double[] argumentStack = new double[ARGUMENT_STACK_SIZE]; 130 foreach (var rowEnum in rows) { 131 int row = rowEnum; 132 int pc = 0; 133 int argStackPointer = 0; 134 yield return Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 135 } 136 } 137 138 private double Evaluate(Dataset dataset, ref int row, Instruction[] code, ref int pc, double[] argumentStack, ref int argStackPointer) { 139 Instruction currentInstr = code[pc++]; 140 switch (currentInstr.opCode) { 141 case OpCodes.Add: { 142 double s = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 143 for (int i = 1; i < currentInstr.nArguments; i++) { 144 s += Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 145 } 146 return s; 147 } 148 case OpCodes.Sub: { 149 double s = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 150 for (int i = 1; i < currentInstr.nArguments; i++) { 151 s -= Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 152 } 153 if (currentInstr.nArguments == 1) s = -s; 154 return s; 155 } 156 case OpCodes.Mul: { 157 double p = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 158 for (int i = 1; i < currentInstr.nArguments; i++) { 159 p *= Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 160 } 161 return p; 162 } 163 case OpCodes.Div: { 164 double p = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 165 for (int i = 1; i < currentInstr.nArguments; i++) { 166 p /= Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 167 } 168 if (currentInstr.nArguments == 1) p = 1.0 / p; 169 return p; 170 } 171 case OpCodes.Average: { 172 double sum = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 173 for (int i = 1; i < currentInstr.nArguments; i++) { 174 sum += Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 175 } 176 return sum / currentInstr.nArguments; 177 } 178 case OpCodes.Cos: { 179 return Math.Cos(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 180 } 181 case OpCodes.Sin: { 182 return Math.Sin(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 183 } 184 case OpCodes.Tan: { 185 return Math.Tan(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 186 } 187 case OpCodes.Exp: { 188 return Math.Exp(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 189 } 190 case OpCodes.Log: { 191 return Math.Log(Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer)); 192 } 193 case OpCodes.IfThenElse: { 194 double condition = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 195 double result; 196 if (condition > 0.0) { 197 result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); SkipBakedCode(code, ref pc); 198 } else { 199 SkipBakedCode(code, ref pc); result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 200 } 201 return result; 202 } 203 case OpCodes.AND: { 204 double result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 205 for (int i = 1; i < currentInstr.nArguments; i++) { 206 if (result <= 0.0) SkipBakedCode(code, ref pc); 207 else { 208 result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 209 } 210 } 211 return result <= 0.0 ? -1.0 : 1.0; 212 } 213 case OpCodes.OR: { 214 double result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 215 for (int i = 1; i < currentInstr.nArguments; i++) { 216 if (result > 0.0) SkipBakedCode(code, ref pc); 217 else { 218 result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 219 } 220 } 221 return result > 0.0 ? 1.0 : -1.0; 222 } 223 case OpCodes.NOT: { 224 return -Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 225 } 226 case OpCodes.GT: { 227 double x = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 228 double y = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 229 if (x > y) return 1.0; 230 else return -1.0; 231 } 232 case OpCodes.LT: { 233 double x = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 234 double y = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 235 if (x < y) return 1.0; 236 else return -1.0; 237 } 238 case OpCodes.Call: { 239 // evaluate sub-trees 240 // push on argStack in reverse order 241 for (int i = 0; i < currentInstr.nArguments; i++) { 242 argumentStack[argStackPointer + currentInstr.nArguments - i] = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 243 } 244 argStackPointer += currentInstr.nArguments; 245 246 // save the pc 247 int nextPc = pc; 248 // set pc to start of function 249 pc = currentInstr.iArg0; 250 // evaluate the function 251 double v = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); 252 253 // decrease the argument stack pointer by the number of arguments pushed 254 // to set the argStackPointer back to the original location 255 argStackPointer -= currentInstr.nArguments; 256 257 // restore the pc => evaluation will continue at point after my subtrees 258 pc = nextPc; 259 return v; 260 } 261 case OpCodes.Arg: { 262 return argumentStack[argStackPointer - currentInstr.iArg0]; 263 } 264 case OpCodes.Variable: { 265 var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode; 266 return dataset[row, currentInstr.iArg0] * variableTreeNode.Weight; 267 } 268 case OpCodes.LagVariable: { 269 var laggedVariableTreeNode = currentInstr.dynamicNode as LaggedVariableTreeNode; 270 int actualRow = row + laggedVariableTreeNode.Lag; 271 if (actualRow < 0 || actualRow >= dataset.Rows) throw new ArgumentException("Out of range access to dataset row: " + row); 272 return dataset[actualRow, currentInstr.iArg0] * laggedVariableTreeNode.Weight; 273 } 274 case OpCodes.Constant: { 275 var constTreeNode = currentInstr.dynamicNode as ConstantTreeNode; 276 return constTreeNode.Value; 277 } 278 default: throw new NotSupportedException(); 279 } 139 280 } 140 281 … … 146 287 } 147 288 148 private double Evaluate() {149 Instruction currentInstr = code[pc++];150 switch (currentInstr.opCode) {151 case OpCodes.Add: {152 double s = Evaluate();153 for (int i = 1; i < currentInstr.nArguments; i++) {154 s += Evaluate();155 }156 return s;157 }158 case OpCodes.Sub: {159 double s = Evaluate();160 for (int i = 1; i < currentInstr.nArguments; i++) {161 s -= Evaluate();162 }163 if (currentInstr.nArguments == 1) s = -s;164 return s;165 }166 case OpCodes.Mul: {167 double p = Evaluate();168 for (int i = 1; i < currentInstr.nArguments; i++) {169 p *= Evaluate();170 }171 return p;172 }173 case OpCodes.Div: {174 double p = Evaluate();175 for (int i = 1; i < currentInstr.nArguments; i++) {176 p /= Evaluate();177 }178 if (currentInstr.nArguments == 1) p = 1.0 / p;179 return p;180 }181 case OpCodes.Average: {182 double sum = Evaluate();183 for (int i = 1; i < currentInstr.nArguments; i++) {184 sum += Evaluate();185 }186 return sum / currentInstr.nArguments;187 }188 case OpCodes.Cos: {189 return Math.Cos(Evaluate());190 }191 case OpCodes.Sin: {192 return Math.Sin(Evaluate());193 }194 case OpCodes.Tan: {195 return Math.Tan(Evaluate());196 }197 case OpCodes.Exp: {198 return Math.Exp(Evaluate());199 }200 case OpCodes.Log: {201 return Math.Log(Evaluate());202 }203 case OpCodes.IfThenElse: {204 double condition = Evaluate();205 double result;206 if (condition > 0.0) {207 result = Evaluate(); SkipBakedCode();208 } else {209 SkipBakedCode(); result = Evaluate();210 }211 return result;212 }213 case OpCodes.AND: {214 double result = Evaluate();215 for (int i = 1; i < currentInstr.nArguments; i++) {216 if (result <= 0.0) SkipBakedCode();217 else {218 result = Evaluate();219 }220 }221 return result <= 0.0 ? -1.0 : 1.0;222 }223 case OpCodes.OR: {224 double result = Evaluate();225 for (int i = 1; i < currentInstr.nArguments; i++) {226 if (result > 0.0) SkipBakedCode();227 else {228 result = Evaluate();229 }230 }231 return result > 0.0 ? 1.0 : -1.0;232 }233 case OpCodes.NOT: {234 return -Evaluate();235 }236 case OpCodes.GT: {237 double x = Evaluate();238 double y = Evaluate();239 if (x > y) return 1.0;240 else return -1.0;241 }242 case OpCodes.LT: {243 double x = Evaluate();244 double y = Evaluate();245 if (x < y) return 1.0;246 else return -1.0;247 }248 case OpCodes.Call: {249 // evaluate sub-trees250 // push on argStack in reverse order251 for (int i = 0; i < currentInstr.nArguments; i++) {252 argumentStack[argStackPointer + currentInstr.nArguments - i] = Evaluate();253 }254 argStackPointer += currentInstr.nArguments;255 256 // save the pc257 int nextPc = pc;258 // set pc to start of function259 pc = currentInstr.iArg0;260 // evaluate the function261 double v = Evaluate();262 263 // decrease the argument stack pointer by the number of arguments pushed264 // to set the argStackPointer back to the original location265 argStackPointer -= currentInstr.nArguments;266 267 // restore the pc => evaluation will continue at point after my subtrees268 pc = nextPc;269 return v;270 }271 case OpCodes.Arg: {272 return argumentStack[argStackPointer - currentInstr.iArg0];273 }274 case OpCodes.Variable: {275 var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode;276 return dataset[row, currentInstr.iArg0] * variableTreeNode.Weight;277 }278 case OpCodes.LagVariable: {279 var lagVariableTreeNode = currentInstr.dynamicNode as LaggedVariableTreeNode;280 int actualRow = row + lagVariableTreeNode.Lag;281 if (actualRow < 0 || actualRow >= dataset.Rows) throw new ArgumentException("Out of range access to dataset row: " + row);282 return dataset[actualRow, currentInstr.iArg0] * lagVariableTreeNode.Weight;283 }284 case OpCodes.Differential: {285 var diffTreeNode = currentInstr.dynamicNode as DifferentialVariableTreeNode;286 if (row < 2 || row >= dataset.Rows - 2) throw new ArgumentException("Out of range access to dataset row: " + row);287 return (-dataset[row + 2, currentInstr.iArg0] + 8 * dataset[row + 1, currentInstr.iArg0] - 8 * dataset[row - 1, currentInstr.iArg0] + dataset[row - 2, currentInstr.iArg0]) * (1.0/12.0) * diffTreeNode.Weight;288 }289 290 case OpCodes.Constant: {291 var constTreeNode = currentInstr.dynamicNode as ConstantTreeNode;292 return constTreeNode.Value;293 }294 default: throw new NotSupportedException();295 }296 }297 298 289 // skips a whole branch 299 pr otected void SkipBakedCode() {290 private void SkipBakedCode(Instruction[] code, ref int pc) { 300 291 int i = 1; 301 292 while (i > 0) { -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SymbolicSimplifier.cs
r4554 r5275 354 354 while (sum.SubTrees.Count > 0) sum.RemoveSubTree(0); 355 355 var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>() 356 where node.Symbol.Name == "Variable"357 356 group node by node.VariableName into g 358 357 select g; 359 var unchangedSubTrees = subtrees.Where(t => t.Symbol.Name != "Variable");358 var unchangedSubTrees = subtrees.Where(t => !(t is VariableTreeNode)); 360 359 361 360 foreach (var variableNodeGroup in groupedVarNodes) { … … 430 429 while (prod.SubTrees.Count > 0) prod.RemoveSubTree(0); 431 430 var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>() 432 where node.Symbol.Name == "Variable"433 431 group node by node.VariableName into g 434 432 orderby g.Count() 435 433 select g; 436 434 var constantProduct = (from node in subtrees.OfType<VariableTreeNode>() 437 where node.Symbol.Name == "Variable"438 435 select node.Weight) 439 436 .Concat(from node in subtrees.OfType<ConstantTreeNode>() … … 443 440 444 441 var unchangedSubTrees = from tree in subtrees 445 where !(tree is VariableTreeNode && tree.Symbol.Name == "Variable")442 where !(tree is VariableTreeNode) 446 443 where !(tree is ConstantTreeNode) 447 444 select tree; … … 485 482 } else if (IsAddition(x)) { 486 483 // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn) 487 foreach (var subTree in x.SubTrees) { 488 Negate(subTree); 489 } 484 for (int i = 0; i < x.SubTrees.Count; i++) 485 x.SubTrees[i] = Negate(x.SubTrees[i]); 490 486 } else if (IsMultiplication(x) || IsDivision(x)) { 491 487 // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn 492 Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant488 x.SubTrees[x.SubTrees.Count - 1] = Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant 493 489 } else { 494 490 // any other function -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Addition.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Addition", "Symbol that represents the + operator.")] 28 29 public sealed class Addition : Symbol { 30 [StorableConstructor] 31 private Addition(bool deserializing) : base(deserializing) { } 32 private Addition(Addition original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Addition(this, cloner); 35 } 29 36 public Addition() : base("Addition", "Symbol that represents the + operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/And.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("And", "Symbol that represents the boolean AND operator.")] 28 29 public sealed class And : Symbol { 30 [StorableConstructor] 31 private And(bool deserializing) : base(deserializing) { } 32 private And(And original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new And(this, cloner); 35 } 29 36 public And() : base("And", "Symbol that represents the boolean AND operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Average.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Average", "Symbol that represents the average (arithmetic mean) function.")] 28 29 public sealed class Average : Symbol { 30 [StorableConstructor] 31 private Average(bool deserializing) : base(deserializing) { } 32 private Average(Average original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Average(this, cloner); 35 } 29 36 public Average() : base("Average", "Symbol that represents the average (arithmetic mean) function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs
r4068 r5275 54 54 } 55 55 [Storable] 56 private double manipulator Nu;57 public double Manipulator Nu {58 get { return manipulator Nu; }56 private double manipulatorMu; 57 public double ManipulatorMu { 58 get { return manipulatorMu; } 59 59 set { 60 if (value != manipulator Nu) {61 manipulator Nu = value;60 if (value != manipulatorMu) { 61 manipulatorMu = value; 62 62 OnChanged(EventArgs.Empty); 63 63 } … … 77 77 } 78 78 #endregion 79 [StorableConstructor] 80 private Constant(bool deserializing) : base(deserializing) { } 81 private Constant(Constant original, Cloner cloner) 82 : base(original, cloner) { 83 minValue = original.minValue; 84 maxValue = original.maxValue; 85 manipulatorMu = original.manipulatorMu; 86 manipulatorSigma = original.manipulatorSigma; 87 } 79 88 public Constant() 80 89 : base("Constant", "Represents a constant value.") { 81 manipulator Nu = 0.0;90 manipulatorMu = 0.0; 82 91 manipulatorSigma = 1.0; 83 92 minValue = -20.0; … … 90 99 91 100 public override IDeepCloneable Clone(Cloner cloner) { 92 Constant clone = (Constant)base.Clone(cloner); 93 clone.minValue = minValue; 94 clone.maxValue = maxValue; 95 clone.manipulatorNu = manipulatorNu; 96 clone.manipulatorSigma = manipulatorSigma; 97 return clone; 101 return new Constant(this, cloner); 98 102 } 99 103 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 38 39 } 39 40 40 private ConstantTreeNode() : base() { } 41 [StorableConstructor] 42 private ConstantTreeNode(bool deserializing) : base(deserializing) { } 41 43 42 // copy constructor 43 private ConstantTreeNode(ConstantTreeNode original) 44 : base(original) { 44 private ConstantTreeNode(ConstantTreeNode original, Cloner cloner) 45 : base(original, cloner) { 45 46 constantValue = original.constantValue; 46 47 } 47 48 49 private ConstantTreeNode() : base() { } 48 50 public ConstantTreeNode(Constant constantSymbol) : base(constantSymbol) { } 49 51 … … 61 63 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 62 64 base.ShakeLocalParameters(random, shakingFactor); 63 double x = NormalDistributedRandom.NextDouble(random, Symbol.Manipulator Nu, Symbol.ManipulatorSigma);65 double x = NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorMu, Symbol.ManipulatorSigma); 64 66 Value = Value + x * shakingFactor; 65 67 } 66 68 67 public override object Clone() {68 return new ConstantTreeNode(this );69 public override IDeepCloneable Clone(Cloner cloner) { 70 return new ConstantTreeNode(this, cloner); 69 71 } 70 72 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Cosine.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Cosine", "Symbol that represents the cosine function.")] 28 29 public sealed class Cosine : Symbol { 30 [StorableConstructor] 31 private Cosine(bool deserializing) : base(deserializing) { } 32 private Cosine(Cosine original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Cosine(this, cloner); 35 } 29 36 public Cosine() : base("Cosine", "Symbol that represents the cosine function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/DifferentialVariable.cs
r4193 r5275 28 28 [Item("DifferentialVariable", "Represents the differential of a variable value.")] 29 29 public sealed class DifferentialVariable : Variable { 30 [StorableConstructor] 31 private DifferentialVariable(bool deserializing) : base(deserializing) { } 32 private DifferentialVariable(DifferentialVariable original, Cloner cloner) 33 : base(original, cloner) { 34 } 30 35 public DifferentialVariable() 31 36 : base("DifferentialVariable", "Represents the differential of a variable value.") { … … 35 40 return new DifferentialVariableTreeNode(this); 36 41 } 37 38 42 public override IDeepCloneable Clone(Cloner cloner) { 39 DifferentialVariable clone = (DifferentialVariable)base.Clone(cloner); 40 return clone; 43 return new DifferentialVariable(this, cloner); 41 44 } 42 45 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/DifferentialVariableTreeNode.cs
r4193 r5275 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols { 26 27 [StorableClass] … … 30 31 } 31 32 33 [StorableConstructor] 34 protected DifferentialVariableTreeNode(bool deserializing) : base(deserializing) { } 35 protected DifferentialVariableTreeNode(DifferentialVariableTreeNode original, Cloner cloner) 36 : base(original, cloner) { 37 } 32 38 private DifferentialVariableTreeNode() { } 33 34 // copy constructor35 private DifferentialVariableTreeNode(DifferentialVariableTreeNode original)36 : base(original) {37 }38 39 39 40 public DifferentialVariableTreeNode(DifferentialVariable differentialSymbol) : base(differentialSymbol) { } 40 41 41 42 42 public override object Clone() {43 return new DifferentialVariableTreeNode(this );43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new DifferentialVariableTreeNode(this, cloner); 44 45 } 45 46 46 } 47 47 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Division.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Division", "Symbol that represents the / operator.")] 28 29 public sealed class Division : Symbol { 30 [StorableConstructor] 31 private Division(bool deserializing) : base(deserializing) { } 32 private Division(Division original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Division(this, cloner); 35 } 29 36 public Division() : base("Division", "Symbol that represents the / operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Exponential.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Exponential", "Symbol that represents the exponential function.")] 28 29 public sealed class Exponential : Symbol { 30 [StorableConstructor] 31 private Exponential(bool deserializing) : base(deserializing) { } 32 private Exponential(Exponential original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Exponential(this, cloner); 35 } 29 36 public Exponential() : base("Exponential", "Symbol that represents the exponential function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/GreaterThan.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("GreaterThan", "Symbol that represents a greater than relation.")] 28 29 public sealed class GreaterThan : Symbol { 30 [StorableConstructor] 31 private GreaterThan(bool deserializing) : base(deserializing) { } 32 private GreaterThan(GreaterThan original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new GreaterThan(this, cloner); 35 } 29 36 public GreaterThan() : base("GreaterThan", "Symbol that represents a greater than relation.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/IfThenElse.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("IfThenElse", "Symbol that represents a conditional operator.")] 28 29 public sealed class IfThenElse : Symbol { 30 [StorableConstructor] 31 private IfThenElse(bool deserializing) : base(deserializing) { } 32 private IfThenElse(IfThenElse original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new IfThenElse(this, cloner); 35 } 29 36 public IfThenElse() : base("IfThenElse", "Symbol that represents a conditional operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariable.cs
r4068 r5275 40 40 set { maxLag = value; } 41 41 } 42 [StorableConstructor] 43 private LaggedVariable(bool deserializing) : base(deserializing) { } 44 private LaggedVariable(LaggedVariable original, Cloner cloner) 45 : base(original, cloner) { 46 minLag = original.minLag; 47 maxLag = original.maxLag; 48 } 42 49 public LaggedVariable() 43 50 : base("LaggedVariable", "Represents a variable value with a time offset.") { … … 50 57 51 58 public override IDeepCloneable Clone(Cloner cloner) { 52 LaggedVariable clone = (LaggedVariable)base.Clone(cloner); 53 clone.minLag = minLag; 54 clone.maxLag = maxLag; 55 return clone; 59 return new LaggedVariable(this, cloner); 56 60 } 57 61 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs
r4068 r5275 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 36 37 } 37 38 38 private LaggedVariableTreeNode() { } 39 40 // copy constructor 41 private LaggedVariableTreeNode(LaggedVariableTreeNode original) 42 : base(original) { 39 [StorableConstructor] 40 private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { } 41 private LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner) 42 : base(original, cloner) { 43 43 lag = original.lag; 44 44 } 45 private LaggedVariableTreeNode() { } 45 46 46 47 public LaggedVariableTreeNode(LaggedVariable variableSymbol) : base(variableSymbol) { } … … 62 63 } 63 64 64 65 public override object Clone() { 66 return new LaggedVariableTreeNode(this); 65 public override IDeepCloneable Clone(Cloner cloner) { 66 return new LaggedVariableTreeNode(this, cloner); 67 67 } 68 68 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LessThan.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("LessThan", "Symbol that represents a less than relation.")] 28 29 public sealed class LessThan : Symbol { 30 [StorableConstructor] 31 private LessThan(bool deserializing) : base(deserializing) { } 32 private LessThan(LessThan original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new LessThan(this, cloner); 35 } 29 36 public LessThan() : base("LessThan", "Symbol that represents a less than relation.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Logarithm.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Logarithm", "Symbol that represents the logarithm function.")] 28 29 public sealed class Logarithm : Symbol { 30 [StorableConstructor] 31 private Logarithm(bool deserializing) : base(deserializing) { } 32 private Logarithm(Logarithm original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Logarithm(this, cloner); 35 } 29 36 public Logarithm() : base("Logarithm", "Symbol that represents the logarithm function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Multiplication.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Multiplication", "Symbol that represents the * operator.")] 28 29 public sealed class Multiplication : Symbol { 30 [StorableConstructor] 31 private Multiplication(bool deserializing) : base(deserializing) { } 32 private Multiplication(Multiplication original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Multiplication(this, cloner); 35 } 29 36 public Multiplication() : base("Multiplication", "Symbol that represents the * operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Not.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Not", "Symbol that represents the boolean NOT operator.")] 28 29 public sealed class Not : Symbol { 30 [StorableConstructor] 31 private Not(bool deserializing) : base(deserializing) { } 32 private Not(Not original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Not(this, cloner); 35 } 29 36 public Not() : base("Not", "Symbol that represents the boolean NOT operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Or.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Or", "Symbol that represents the boolean OR operator.")] 28 29 public sealed class Or : Symbol { 30 [StorableConstructor] 31 private Or(bool deserializing) : base(deserializing) { } 32 private Or(Or original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Or(this, cloner); 35 } 29 36 public Or() : base("Or", "Symbol that represents the boolean OR operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Sine.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Sine", "Symbol that represents the sine function.")] 28 29 public sealed class Sine : Symbol { 30 [StorableConstructor] 31 private Sine(bool deserializing) : base(deserializing) { } 32 private Sine(Sine original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Sine(this, cloner); 35 } 29 36 public Sine() : base("Sine", "Symbol that represents the sine function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Subtraction.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Subtraction", "Symbol that represents the - operator.")] 28 29 public sealed class Subtraction : Symbol { 30 [StorableConstructor] 31 private Subtraction(bool deserializing) : base(deserializing) { } 32 private Subtraction(Subtraction original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Subtraction(this, cloner); 35 } 29 36 public Subtraction() : base("Subtraction", "Symbol that represents the - operator.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Tangent.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 27 28 [Item("Tangent", "Symbol that represents the tangent trigonometric function.")] 28 29 public sealed class Tangent : Symbol { 30 [StorableConstructor] 31 private Tangent(bool deserializing) : base(deserializing) { } 32 private Tangent(Tangent original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new Tangent(this, cloner); 35 } 29 36 public Tangent() : base("Tangent", "Symbol that represents the tangent trigonometric function.") { } 30 37 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
r4068 r5275 33 33 #region Properties 34 34 [Storable] 35 private double weight Nu;36 public double Weight Nu {37 get { return weight Nu; }35 private double weightMu; 36 public double WeightMu { 37 get { return weightMu; } 38 38 set { 39 if (value != weight Nu) {40 weight Nu = value;39 if (value != weightMu) { 40 weightMu = value; 41 41 OnChanged(EventArgs.Empty); 42 42 } … … 56 56 } 57 57 [Storable] 58 private double weightManipulator Nu;59 public double WeightManipulator Nu {60 get { return weightManipulator Nu; }58 private double weightManipulatorMu; 59 public double WeightManipulatorMu { 60 get { return weightManipulatorMu; } 61 61 set { 62 if (value != weightManipulator Nu) {63 weightManipulator Nu = value;62 if (value != weightManipulatorMu) { 63 weightManipulatorMu = value; 64 64 OnChanged(EventArgs.Empty); 65 65 } … … 90 90 } 91 91 #endregion 92 [StorableConstructor] 93 protected Variable(bool deserializing) : base(deserializing) { 94 variableNames = new List<string>(); 95 } 96 protected Variable(Variable original, Cloner cloner) 97 : base(original, cloner) { 98 weightMu = original.weightMu; 99 weightSigma = original.weightSigma; 100 variableNames = new List<string>(original.variableNames); 101 weightManipulatorMu = original.weightManipulatorMu; 102 weightManipulatorSigma = original.weightManipulatorSigma; 103 } 92 104 public Variable() : this("Variable", "Represents a variable value.") { } 93 105 public Variable(string name, string description) 94 106 : base(name, description) { 95 weight Nu = 1.0;107 weightMu = 1.0; 96 108 weightSigma = 1.0; 97 weightManipulator Nu = 0.0;109 weightManipulatorMu = 0.0; 98 110 weightManipulatorSigma = 1.0; 99 111 variableNames = new List<string>(); … … 105 117 106 118 public override IDeepCloneable Clone(Cloner cloner) { 107 Variable clone = (Variable)base.Clone(cloner); 108 clone.weightNu = weightNu; 109 clone.weightSigma = weightSigma; 110 clone.variableNames = new List<string>(variableNames); 111 clone.weightManipulatorNu = weightManipulatorNu; 112 clone.weightManipulatorSigma = weightManipulatorSigma; 113 return clone; 119 return new Variable(this, cloner); 114 120 } 115 121 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs
r4220 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Common;24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 44 44 } 45 45 46 47 protected VariableTreeNode() { } 48 49 // copy constructor 50 protected VariableTreeNode(VariableTreeNode original) 51 : base(original) { 46 [StorableConstructor] 47 protected VariableTreeNode(bool deserializing) : base(deserializing) { } 48 protected VariableTreeNode(VariableTreeNode original, Cloner cloner) 49 : base(original, cloner) { 52 50 weight = original.weight; 53 51 variableName = original.variableName; 54 52 } 55 53 protected VariableTreeNode() { } 56 54 public VariableTreeNode(Variable variableSymbol) : base(variableSymbol) { } 57 55 … … 64 62 public override void ResetLocalParameters(IRandom random) { 65 63 base.ResetLocalParameters(random); 66 weight = NormalDistributedRandom.NextDouble(random, Symbol.Weight Nu, Symbol.WeightSigma);64 weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma); 67 65 variableName = Symbol.VariableNames.SelectRandom(random); 68 66 } … … 70 68 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 71 69 base.ShakeLocalParameters(random, shakingFactor); 72 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulator Nu, Symbol.WeightManipulatorSigma);70 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 73 71 weight = weight + x * shakingFactor; 74 72 variableName = Symbol.VariableNames.SelectRandom(random); 75 73 } 76 74 77 78 public override object Clone() { 79 return new VariableTreeNode(this); 75 public override IDeepCloneable Clone(Cloner cloner) { 76 return new VariableTreeNode(this, cloner); 80 77 } 81 78 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/VariableFrequencyAnalyser.cs
r4125 r5275 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 61 62 } 62 63 #endregion 64 [StorableConstructor] 65 protected VariableFrequencyAnalyser(bool deserializing) : base(deserializing) { } 66 protected VariableFrequencyAnalyser(VariableFrequencyAnalyser original, Cloner cloner) 67 : base(original, cloner) { 68 } 63 69 public VariableFrequencyAnalyser() 64 70 : base() { … … 69 75 70 76 public override IOperation Apply() { 71 var inputVariables = DataAnalysisProblemData.InputVariables. Select(x => x.Value);77 var inputVariables = DataAnalysisProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value); 72 78 if (VariableFrequencies == null) { 73 79 VariableFrequencies = new DoubleMatrix(0, 1, inputVariables); … … 80 86 VariableFrequencies[lastRowIndex, columnIndex] = pair.Value; 81 87 } 82 return null;88 return base.Apply(); 83 89 } 84 90
Note: See TracChangeset
for help on using the changeset viewer.