- Timestamp:
- 07/18/14 12:01:13 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Selection/3.3/OffspringSelector.cs
r7259 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 57 57 } 58 58 59 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 60 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 61 } 62 59 63 public IOperator OffspringCreator { 60 64 get { return OffspringCreatorParameter.Value; } … … 64 68 [StorableConstructor] 65 69 protected OffspringSelector(bool deserializing) : base(deserializing) { } 70 [StorableHook(HookType.AfterDeserialization)] 71 private void AfterDeserialization() { 72 // BackwardsCompatibility3.3 73 #region Backwards compatible code, remove with 3.4 74 if (Parameters.ContainsKey("FillPopulationWithParents") && Parameters["FillPopulationWithParents"] is FixedValueParameter<BoolValue>) 75 Parameters.Remove("FillPopulationWithParents"); 76 if (!Parameters.ContainsKey("FillPopulationWithParents")) 77 Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individuals instead of lucky losers.")); 78 #endregion 79 } 80 66 81 protected OffspringSelector(OffspringSelector original, Cloner cloner) : base(original, cloner) { } 67 82 public override IDeepCloneable Clone(Cloner cloner) { … … 78 93 Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("SuccessfulOffspring", "True if the offspring was more successful than its parents.", 2)); 79 94 Parameters.Add(new OperatorParameter("OffspringCreator", "The operator used to create new offspring.")); 95 Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.")); 80 96 } 81 97 … … 83 99 double maxSelPress = MaximumSelectionPressureParameter.ActualValue.Value; 84 100 double successRatio = SuccessRatioParameter.ActualValue.Value; 101 bool fillPopulationWithParents = false; 102 if (FillPopulationWithParentsParameter.ActualValue != null) 103 fillPopulationWithParents = FillPopulationWithParentsParameter.ActualValue.Value; 85 104 IScope scope = ExecutionContext.Scope; 86 105 IScope parents = scope.SubScopes[0]; … … 133 152 successfulOffspringAdded++; 134 153 } else if (worseOffspringNeeded > 0 || tmpSelPress >= maxSelPress) { 135 IScope currentOffspring = offspring.SubScopes[i]; 136 offspring.SubScopes.Remove(currentOffspring); 137 i--; 154 IScope currentOffspring; 155 if (!fillPopulationWithParents || worseOffspringNeeded > 0) { 156 currentOffspring = offspring.SubScopes[i]; 157 offspring.SubScopes.Remove(currentOffspring); 158 i--; 159 worseOffspringNeeded--; 160 } else { 161 currentOffspring = parents.SubScopes[i]; 162 } 138 163 population.Add(currentOffspring); 139 worseOffspringNeeded--;140 164 } 141 165 tmpSelPress += tmpSelPressInc;
Note: See TracChangeset
for help on using the changeset viewer.