Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4489


Ignore:
Timestamp:
09/24/10 15:26:27 (14 years ago)
Author:
gkronber
Message:

Removed code fragments from class Scope which updated the SubScopes list when setting the parent property of a scope. ##1207

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r4477 r4489  
    4242      set {
    4343        if (parent != value) {
    44           IScope oldParent = parent;
    45           parent = null;
    46           if (oldParent != null) oldParent.SubScopes.Remove(this);
    4744          parent = value;
    48           if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
    4945        }
    5046      }
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/SASEGASAReunificator.cs

    r4477 r4489  
    6969
    7070      // reduce number of villages by 1 and partition the population again
    71       scope.SubScopes.Remove(scope.SubScopes[scope.SubScopes.Count - 1]);
     71      scope.SubScopes.RemoveAt(scope.SubScopes.Count - 1);
    7272      villageCount--;
    7373      int populationPerVillage = population.Count / villageCount;
  • trunk/sources/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r4068 r4489  
    148148        scope.SubScopes.Remove(parents);
    149149        scope.SubScopes.Remove(offspring);
    150         while (parents.SubScopes.Count > 0)
    151           scope.SubScopes.Add(parents.SubScopes[0]);
     150        while (parents.SubScopes.Count > 0) {
     151          IScope parent = parents.SubScopes[0];
     152          parents.SubScopes.RemoveAt(0);
     153          scope.SubScopes.Add(parent);
     154        }
    152155
    153156        IOperator moreOffspring = OffspringCreatorParameter.ActualValue as IOperator;
  • trunk/sources/HeuristicLab.Selection/3.3/RightChildReducer.cs

    r4477 r4489  
    5555
    5656        // merge right children
    57         while (leftRightChild.SubScopes.Count > 0)
    58           rightChild.SubScopes.Add(leftRightChild.SubScopes[0]);
     57        while (leftRightChild.SubScopes.Count > 0) {
     58          IScope leftRightChildChild = leftRightChild.SubScopes[0];
     59          leftRightChild.SubScopes.RemoveAt(0);
     60          rightChild.SubScopes.Add(leftRightChildChild);
     61        }
    5962
    6063        leftChild = leftChild.SubScopes[0];
Note: See TracChangeset for help on using the changeset viewer.