Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3856 for tags


Ignore:
Timestamp:
05/20/10 16:31:09 (15 years ago)
Author:
abeham
Message:

#1018

  • Added OS fix to 3.3.0.0 tag
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/3.3.0/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r3769 r3856  
    8383      IScope offspring = scope.SubScopes[1];
    8484      int populationSize = parents.SubScopes.Count;
    85       int offspringSize = offspring.SubScopes.Count;
    8685
    8786      // retrieve actual selection pressure and success ratio
     
    115114      string tname = SuccessfulOffspringParameter.TranslatedName;
    116115      double tmpSelPress = selectionPressure.Value, tmpSelPressInc = 1.0 / populationSize;
    117       for (int i = 0; i < offspringSize; i++) {
     116      for (int i = 0; i < offspring.SubScopes.Count; i++) {
    118117        // fetch value
    119118        IVariable tmpVar;
     
    124123        // add to population
    125124        if (tmp.Value) {
    126           population.Add(offspring.SubScopes[i]);
     125          IScope currentOffspring = offspring.SubScopes[i];
     126          offspring.SubScopes.Remove(currentOffspring);
     127          i--;
     128          population.Add(currentOffspring);
    127129          successfulOffspringAdded++;
    128130        } else if (worseOffspringNeeded > 0 || tmpSelPress >= maxSelPress) {
    129           population.Add(offspring.SubScopes[i]);
     131          IScope currentOffspring = offspring.SubScopes[i];
     132          offspring.SubScopes.Remove(currentOffspring);
     133          i--;
     134          population.Add(currentOffspring);
    130135          worseOffspringNeeded--;
    131136        }
Note: See TracChangeset for help on using the changeset viewer.