- Timestamp:
- 11/19/15 09:57:06 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs
r13267 r13269 58 58 } 59 59 60 #region item cloning and persistence 61 // persistence 62 [StorableConstructor] 63 private EvenParityProblem(bool deserializing) : base(deserializing) { } 64 [StorableHook(HookType.AfterDeserialization)] 65 private void AfterDeserialization() { 66 RegisterEventHandlers(); 67 } 68 69 // cloning 70 private EvenParityProblem(EvenParityProblem original, Cloner cloner) 71 : base(original, cloner) { 72 RegisterEventHandlers(); 73 } 74 public override IDeepCloneable Clone(Cloner cloner) { 75 return new EvenParityProblem(this, cloner); 76 } 77 #endregion 78 60 79 public EvenParityProblem() 61 80 : base() { … … 109 128 110 129 switch (node.Symbol.Name) { 111 case "AND": 112 case "OR": 130 case "AND": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => x & y); 131 case "OR": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => x | y); 113 132 case "NAND": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => !(x & y)); 114 case "NOR": 133 case "NOR": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => !(x | y)); 115 134 default: { 116 135 byte bitPos; … … 126 145 } 127 146 128 #region item cloning and persistence129 // persistence130 [StorableConstructor]131 private EvenParityProblem(bool deserializing) : base(deserializing) { }132 133 [StorableHook(HookType.AfterDeserialization)]134 private void AfterDeserialization() {135 RegisterEventHandlers();136 }137 138 // cloning139 private EvenParityProblem(EvenParityProblem original, Cloner cloner)140 : base(original, cloner) {141 RegisterEventHandlers();142 }143 public override IDeepCloneable Clone(Cloner cloner) {144 return new EvenParityProblem(this, cloner);145 }146 #endregion147 148 147 #region events 149 148 private void RegisterEventHandlers() { -
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs
r13267 r13269 59 59 get { return true; } 60 60 } 61 62 #region item cloning and persistence 63 // persistence 64 [StorableConstructor] 65 private MultiplexerProblem(bool deserializing) : base(deserializing) { } 66 [StorableHook(HookType.AfterDeserialization)] 67 private void AfterDeserialization() { 68 RegisterEventHandlers(); 69 } 70 71 // cloning 72 private MultiplexerProblem(MultiplexerProblem original, Cloner cloner) 73 : base(original, cloner) { 74 RegisterEventHandlers(); 75 } 76 public override IDeepCloneable Clone(Cloner cloner) { 77 return new MultiplexerProblem(this, cloner); 78 } 79 #endregion 80 61 81 62 82 public MultiplexerProblem() … … 134 154 switch (node.Symbol.Name) { 135 155 case "AND": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => x & y); 136 case "OR": 156 case "OR": return binaryEval(node.GetSubtree(0), node.GetSubtree(1), (x, y) => x | y); 137 157 case "NOT": return unaryEval(node.GetSubtree(0), (x) => !x); 138 case "IF": 158 case "IF": return EvalIf(node.GetSubtree(0), node.GetSubtree(1), node.GetSubtree(2), bs, addrBits); 139 159 default: { 140 160 if (node.Symbol.Name[0] == 'a') { … … 171 191 } 172 192 173 #region item cloning and persistence174 // persistence175 [StorableConstructor]176 private MultiplexerProblem(bool deserializing) : base(deserializing) { }177 178 [StorableHook(HookType.AfterDeserialization)]179 private void AfterDeserialization() {180 RegisterEventHandlers();181 }182 183 // cloning184 private MultiplexerProblem(MultiplexerProblem original, Cloner cloner)185 : base(original, cloner) {186 RegisterEventHandlers();187 }188 public override IDeepCloneable Clone(Cloner cloner) {189 return new MultiplexerProblem(this, cloner);190 }191 #endregion192 193 193 #region events 194 194 private void RegisterEventHandlers() {
Note: See TracChangeset
for help on using the changeset viewer.