Changeset 3445 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding
- Timestamp:
- 04/20/10 16:35:42 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Crossovers/MultiPermutationCrossover.cs
r3425 r3445 31 31 [Item("MultiPermutationCrossover", "Randomly selects and applies one of its crossovers every time it is called.")] 32 32 [StorableClass] 33 public class MultiPermutationCrossover : StochasticMultiOperator<IPermutationCrossover>, IPermutationCrossover {33 public class MultiPermutationCrossover : StochasticMultiOperator<IPermutationCrossover>, IPermutationCrossover, IStochasticOperator { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 37 protected override bool CreateChildOperation { 38 get { return true; }39 }40 public override bool AutomaticTypeDiscovery {41 38 get { return true; } 42 39 } … … 58 55 Parameters.Add(new LookupParameter<Permutation>("Child", "The child permutation resulting from the crossover.")); 59 56 ChildParameter.ActualName = "Permutation"; 57 } 60 58 61 Initialize(); 59 protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationCrossover>> e) { 60 base.Operators_ItemsReplaced(sender, e); 62 61 ParameterizeCrossovers(); 63 62 } 64 63 65 [StorableHook(HookType.AfterDeserialization)] 66 private void Initialize() { 67 Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IPermutationCrossover>>(Operators_ItemsAdded); 68 Operators.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IPermutationCrossover>>(Operators_ItemsReplaced); 69 } 70 71 private void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationCrossover>> e) { 72 ParameterizeCrossovers(); 73 } 74 75 private void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationCrossover>> e) { 64 protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationCrossover>> e) { 65 base.Operators_ItemsAdded(sender, e); 76 66 ParameterizeCrossovers(); 77 67 } -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/MultiPermutationManipulator.cs
r3425 r3445 31 31 [Item("MultiPermutationManipulator", "Randomly selects and applies one of its manipulators every time it is called.")] 32 32 [StorableClass] 33 public class MultiPermutationManipulator : StochasticMultiOperator<IPermutationManipulator>, IPermutationManipulator {33 public class MultiPermutationManipulator : StochasticMultiOperator<IPermutationManipulator>, IPermutationManipulator, IStochasticOperator { 34 34 public override bool CanChangeName { 35 35 get { return false; } 36 36 } 37 37 protected override bool CreateChildOperation { 38 get { return true; }39 }40 public override bool AutomaticTypeDiscovery {41 38 get { return true; } 42 39 } … … 51 48 : base() { 52 49 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation that is being manipulating.")); 50 } 53 51 54 Initialize(); 52 protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationManipulator>> e) { 53 base.Operators_ItemsReplaced(sender, e); 55 54 ParameterizeManipulators(); 56 55 } 57 56 58 [StorableHook(HookType.AfterDeserialization)] 59 private void Initialize() { 60 Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IPermutationManipulator>>(Operators_ItemsAdded); 61 Operators.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IPermutationManipulator>>(Operators_ItemsReplaced); 62 } 63 64 private void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationManipulator>> e) { 65 ParameterizeManipulators(); 66 } 67 68 private void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationManipulator>> e) { 57 protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationManipulator>> e) { 58 base.Operators_ItemsAdded(sender, e); 69 59 ParameterizeManipulators(); 70 60 }
Note: See TracChangeset
for help on using the changeset viewer.