- Timestamp:
- 02/17/10 00:30:46 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Selection/3.3/RandomSelector.cs
r2805 r2817 36 36 public RandomSelector() : base() { } 37 37 38 protected override void Select(ScopeList source, ScopeList target) {38 protected override ScopeList Select(ScopeList scopes) { 39 39 int count = NumberOfSelectedSubScopesParameter.ActualValue.Value; 40 40 bool copy = CopySelectedParameter.Value.Value; 41 41 IRandom random = RandomParameter.ActualValue; 42 ScopeList selected = new ScopeList(); 42 43 43 44 for (int i = 0; i < count; i++) { 44 45 if (copy) 45 target.Add((IScope)source[random.Next(source.Count)].Clone());46 selected.Add((IScope)scopes[random.Next(scopes.Count)].Clone()); 46 47 else { 47 int index = random.Next(s ource.Count);48 target.Add(source[index]);49 s ource.RemoveAt(index);48 int index = random.Next(scopes.Count); 49 selected.Add(scopes[index]); 50 scopes.RemoveAt(index); 50 51 } 51 52 } 53 return selected; 52 54 } 53 55 }
Note: See TracChangeset
for help on using the changeset viewer.