Free cookie consent management tool by TermsFeed Policy Generator

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

Updated StochasticMultiOperator and Multicrossover/Multimutation #976

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r3425 r3445  
    3131  [Item("MultiIntegerVectorCrossover", "Randomly selects and applies one of its crossovers every time it is called.")]
    3232  [StorableClass]
    33   public class MultiIntegerVectorCrossover : StochasticMultiOperator<IIntegerVectorCrossover>, IIntegerVectorCrossover {
     33  public class MultiIntegerVectorCrossover : StochasticMultiOperator<IIntegerVectorCrossover>, IIntegerVectorCrossover, 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<IntegerVector>("Child", "The child integer vector resulting from the crossover."));
    5956      ChildParameter.ActualName = "IntegerVector";
     57    }
    6058
    61       Initialize();
     59    protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IIntegerVectorCrossover>> 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<IIntegerVectorCrossover>>(Operators_ItemsAdded);
    68       Operators.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IIntegerVectorCrossover>>(Operators_ItemsReplaced);
    69     }
    70 
    71     private void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IIntegerVectorCrossover>> e) {
    72       ParameterizeCrossovers();
    73     }
    74 
    75     private void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IIntegerVectorCrossover>> e) {
     64    protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IIntegerVectorCrossover>> e) {
     65      base.Operators_ItemsAdded(sender, e);
    7666      ParameterizeCrossovers();
    7767    }
Note: See TracChangeset for help on using the changeset viewer.