Changeset 12999
- Timestamp:
- 10/13/15 11:18:46 (9 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
r12998 r12999 114 114 get { return (IValueParameter<IntValue>)Parameters["MatingPoolRange"]; } 115 115 } 116 private IValueParameter<PercentValue> MatingPoolSelectionPercentageParameter {117 get { return (IValueLookupParameter<PercentValue>)Parameters["MatingPoolSelectionPercentage"]; }118 }119 116 120 117 private IValueParameter<MultiTerminator> TerminatorParameter { … … 198 195 get { return MatingPoolRangeParameter.Value; } 199 196 set { MatingPoolRangeParameter.Value = value; } 200 }201 public PercentValue MatingPoolSelectionPercentage {202 get { return MatingPoolSelectionPercentageParameter.Value; }203 set { MatingPoolSelectionPercentageParameter.Value = value; }204 197 } 205 198 … … 303 296 304 297 Parameters.Add(new ValueParameter<IntValue>("MatingPoolRange", "The range of layers used for creating a mating pool. (1 = current + previous layer)", new IntValue(1)) { Hidden = true }); 305 Parameters.Add(new ValueParameter<PercentValue>("MatingPoolSelectionPercentage", "Percentage of the previous layers used for creating a mating pool.", new PercentValue(1.0, restrictToUnitInterval: true)) { Hidden = true });306 298 307 299 Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria which sould be checked.", new MultiTerminator())); -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs
r12045 r12999 37 37 get { return (ILookupParameter<IntValue>)Parameters["MatingPoolRange"]; } 38 38 } 39 public ILookupParameter<PercentValue> MatingPoolSelectionPercentageParameter {40 get { return (ILookupParameter<PercentValue>)Parameters["MatingPoolSelectionPercentage"]; }41 }42 39 43 40 [StorableConstructor] … … 52 49 : base() { 53 50 Parameters.Add(new LookupParameter<IntValue>("MatingPoolRange")); 54 Parameters.Add(new LookupParameter<PercentValue>("MatingPoolSelectionPercentage"));55 51 } 56 52 … … 58 54 var layers = ExecutionContext.Scope.SubScopes; 59 55 int range = MatingPoolRangeParameter.ActualValue.Value; 60 double percentage = MatingPoolSelectionPercentageParameter.ActualValue.Value;61 56 62 57 for (int layer = layers.Count - 1; layer > 0; layer--) { … … 65 60 var prevLayerScope = layers[layer - n]; 66 61 var individuals = prevLayerScope.SubScopes; 67 foreach (var individual in individuals .Take((int)(individuals.Count * percentage))) {62 foreach (var individual in individuals) { 68 63 layerScope.SubScopes.Add((IScope)individual.Clone(new Cloner())); 69 64 }
Note: See TracChangeset
for help on using the changeset viewer.