Changeset 3854
- Timestamp:
- 05/20/10 13:35:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Selection/3.3/OffspringSelector.cs
r3769 r3854 83 83 IScope offspring = scope.SubScopes[1]; 84 84 int populationSize = parents.SubScopes.Count; 85 int offspringSize = offspring.SubScopes.Count;86 85 87 86 // retrieve actual selection pressure and success ratio … … 115 114 string tname = SuccessfulOffspringParameter.TranslatedName; 116 115 double tmpSelPress = selectionPressure.Value, tmpSelPressInc = 1.0 / populationSize; 117 for (int i = 0; i < offspring Size; i++) {116 for (int i = 0; i < offspring.SubScopes.Count; i++) { 118 117 // fetch value 119 118 IVariable tmpVar; … … 124 123 // add to population 125 124 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); 127 129 successfulOffspringAdded++; 128 130 } 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); 130 135 worseOffspringNeeded--; 131 136 }
Note: See TracChangeset
for help on using the changeset viewer.