Changeset 13269 for trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression
- Timestamp:
- 11/19/15 09:57:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs
r13267 r13269 39 39 40 40 #region parameter names 41 42 41 private const string ProblemDataParameterName = "ProblemData"; 43 44 42 #endregion 45 46 public event EventHandler ProblemDataChanged;47 43 48 44 #region Parameter Properties … … 52 48 get { return (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; } 53 49 } 54 55 50 #endregion 56 51 57 52 #region Properties 58 59 53 public IRegressionProblemData ProblemData { 60 54 get { return ProblemDataParameter.Value; } … … 62 56 } 63 57 IDataAnalysisProblemData IDataAnalysisProblem.ProblemData { get { return ProblemData; } } 58 #endregion 64 59 65 66 #endregion 60 public event EventHandler ProblemDataChanged; 67 61 68 62 public override bool Maximization { 69 63 get { return true; } 70 64 } 65 66 #region item cloning and persistence 67 // persistence 68 [StorableConstructor] 69 private Problem(bool deserializing) : base(deserializing) { } 70 [StorableHook(HookType.AfterDeserialization)] 71 private void AfterDeserialization() { 72 RegisterEventHandlers(); 73 } 74 75 // cloning 76 private Problem(Problem original, Cloner cloner) 77 : base(original, cloner) { 78 RegisterEventHandlers(); 79 } 80 public override IDeepCloneable Clone(Cloner cloner) { return new Problem(this, cloner); } 81 #endregion 71 82 72 83 public Problem() … … 102 113 return InterpretRec(tree.Root.GetSubtree(0).GetSubtree(0), dataset, rows); 103 114 } 104 115 105 116 private IEnumerable<double> InterpretRec(ISymbolicExpressionTreeNode node, IDataset dataset, IEnumerable<int> rows) { 106 117 Func<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode, Func<double, double, double>, IEnumerable<double>> binaryEval = 107 (left, right, f) => InterpretRec(left, dataset, rows).Zip(InterpretRec(right, dataset, rows), f);118 (left, right, f) => InterpretRec(left, dataset, rows).Zip(InterpretRec(right, dataset, rows), f); 108 119 109 120 switch (node.Symbol.Name) { … … 124 135 } 125 136 126 #region item cloning and persistence127 // persistence128 [StorableConstructor]129 private Problem(bool deserializing) : base(deserializing) { }130 131 [StorableHook(HookType.AfterDeserialization)]132 private void AfterDeserialization() {133 RegisterEventHandlers();134 }135 136 // cloning137 private Problem(Problem original, Cloner cloner)138 : base(original, cloner) {139 RegisterEventHandlers();140 }141 public override IDeepCloneable Clone(Cloner cloner) {142 return new Problem(this, cloner);143 }144 #endregion145 137 146 138 #region events 147 148 139 private void RegisterEventHandlers() { 149 140 ProblemDataParameter.ValueChanged += new EventHandler(ProblemDataParameter_ValueChanged); … … 188 179 Encoding.Grammar = g; 189 180 } 190 191 181 #endregion 192 182
Note: See TracChangeset
for help on using the changeset viewer.