Ejemplo n.º 1
0
 private void ShapeInfos_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs <IShapeInfo> e)
 {
     foreach (IShapeInfo shapeInfo in e.Items)
     {
         this.RemoveShapeInfo(shapeInfo);
     }
 }
Ejemplo n.º 2
0
 private void Operators_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs <IOperator> e)
 {
     foreach (IOperator op in e.Items)
     {
         this.RemoveOperator(op);
     }
 }
 protected override void Operators_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs <IndexedItem <T> > e)
 {
     base.Operators_ItemsAdded(sender, e);
     if (Probabilities != null && Probabilities.Length < Operators.Count)
     {
         double avg = (Probabilities.Where(x => x > 0).Count() > 0) ? (Probabilities.Where(x => x > 0).Average()) : (1);
         // add the average of all probabilities in the respective places (the new operators)
         var         added       = e.Items.OrderBy(x => x.Index).ToList();
         int         insertCount = 0;
         DoubleArray probs       = new DoubleArray(Operators.Count);
         for (int i = 0; i < Operators.Count; i++)
         {
             if (insertCount < added.Count && i == added[insertCount].Index)
             {
                 probs[i] = avg;
                 insertCount++;
             }
             else if (i - insertCount < Probabilities.Length)
             {
                 probs[i] = Probabilities[i - insertCount];
             }
             else
             {
                 probs[i] = avg;
             }
         }
         Probabilities = probs;
     }
 }
 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs <IRun> e)
 {
     RegisterRunEvents(e.Items);
 }
 private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs <IRun> e)
 {
     DeregisterRunEvents(e.OldItems);
     RegisterRunEvents(e.Items);
 }