Changeset 5975 for trunk/sources/HeuristicLab.Selection
- Timestamp:
- 04/07/11 10:31:48 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Selection/3.3/NoSameMatesSelector.cs
r5957 r5975 1 1 using System; 2 using System.Collections.Generic; 2 3 using System.Linq; 3 using System.Collections.Generic;4 4 using System.Threading; 5 5 using HeuristicLab.Common; … … 55 55 [StorableConstructor] 56 56 protected NoSameMatesSelector(bool deserializing) : base(deserializing) { } 57 protected NoSameMatesSelector(NoSameMatesSelector original, Cloner cloner) : base(original, cloner) { 57 protected NoSameMatesSelector(NoSameMatesSelector original, Cloner cloner) 58 : base(original, cloner) { 58 59 RegisterParameterEventHandlers(); 59 60 } … … 62 63 } 63 64 64 public NoSameMatesSelector() : base() { 65 public NoSameMatesSelector() 66 : base() { 65 67 #region Create parameters 66 68 Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", new TournamentSelector())); … … 85 87 Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", selector)); 86 88 } 87 } 89 } 88 90 // FixedValueParameter for quality difference percentage, max attempts, use range 89 91 if (Parameters.ContainsKey(QualityDifferencePercentageParameterName)) { … … 153 155 ScopeList parents = CurrentScope.SubScopes[1].SubScopes; 154 156 155 for (int indexParent1 = 0, indexParent2 = 1; 156 indexParent1 < parents.Count - 1 && selectedParents < parentsToSelect - 1; 157 for (int indexParent1 = 0, indexParent2 = 1; 158 indexParent1 < parents.Count - 1 && selectedParents < parentsToSelect - 1; 157 159 indexParent1 += 2, indexParent2 += 2) { 158 160 double qualityParent1 = ((DoubleValue)parents[indexParent1].Variables[qualityName].Value).Value; … … 168 170 } 169 171 170 if (parentsDifferent) { 172 if (parentsDifferent) { 171 173 // inner selector already copied scopes, no cloning necessary here 172 174 selected[selectedParents++] = parents[indexParent1]; … … 204 206 if (CopySelected.Value != true) { 205 207 CopySelected.Value = true; 206 throw new ArgumentException(Name + ": CopySelected must always be true."); 207 } 208 } 209 #endregion 210 211 #region Helpers 208 } 209 } 210 #endregion 211 212 #region Helpers 212 213 private void ParameterizeSelector(ISingleObjectiveSelector selector) { 213 214 selector.CopySelected = new BoolValue(true); // must always be true
Note: See TracChangeset
for help on using the changeset viewer.