Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/10 16:35:42 (14 years ago)
Author:
abeham
Message:

Updated StochasticMultiOperator and Multicrossover/Multimutation #976

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Crossovers/MultiPermutationCrossover.cs

    r3425 r3445  
    3131  [Item("MultiPermutationCrossover", "Randomly selects and applies one of its crossovers every time it is called.")]
    3232  [StorableClass]
    33   public class MultiPermutationCrossover : StochasticMultiOperator<IPermutationCrossover>, IPermutationCrossover {
     33  public class MultiPermutationCrossover : StochasticMultiOperator<IPermutationCrossover>, IPermutationCrossover, IStochasticOperator {
    3434    public override bool CanChangeName {
    3535      get { return false; }
    3636    }
    3737    protected override bool CreateChildOperation {
    38       get { return true; }
    39     }
    40     public override bool AutomaticTypeDiscovery {
    4138      get { return true; }
    4239    }
     
    5855      Parameters.Add(new LookupParameter<Permutation>("Child", "The child permutation resulting from the crossover."));
    5956      ChildParameter.ActualName = "Permutation";
     57    }
    6058
    61       Initialize();
     59    protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IPermutationCrossover>> e) {
     60      base.Operators_ItemsReplaced(sender, e);
    6261      ParameterizeCrossovers();
    6362    }
    6463
    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);
    7666      ParameterizeCrossovers();
    7767    }
Note: See TracChangeset for help on using the changeset viewer.