Changeset 11203 for branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm
- Timestamp:
- 07/18/14 12:35:00 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 11 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.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 100 100 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 101 101 } 102 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {103 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }104 }105 102 private ValueLookupParameter<DoubleValue> SuccessRatioParameter { 106 103 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } … … 132 129 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 133 130 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 134 }135 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {136 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }137 131 } 138 132 #endregion … … 199 193 set { ElitesParameter.Value = value; } 200 194 } 201 public bool ReevaluteElites { 202 get { return ReevaluateElitesParameter.Value.Value; } 203 set { ReevaluateElitesParameter.Value.Value = value; } 204 } 205 public DoubleValue SuccessRatio { 195 private DoubleValue SuccessRatio { 206 196 get { return SuccessRatioParameter.Value; } 207 197 set { SuccessRatioParameter.Value = value; } 208 198 } 209 p ublicDoubleValue ComparisonFactorLowerBound {199 private DoubleValue ComparisonFactorLowerBound { 210 200 get { return ComparisonFactorLowerBoundParameter.Value; } 211 201 set { ComparisonFactorLowerBoundParameter.Value = value; } 212 202 } 213 p ublicDoubleValue ComparisonFactorUpperBound {203 private DoubleValue ComparisonFactorUpperBound { 214 204 get { return ComparisonFactorUpperBoundParameter.Value; } 215 205 set { ComparisonFactorUpperBoundParameter.Value = value; } … … 219 209 set { ComparisonFactorModifierParameter.Value = value; } 220 210 } 221 p ublicDoubleValue MaximumSelectionPressure {211 private DoubleValue MaximumSelectionPressure { 222 212 get { return MaximumSelectionPressureParameter.Value; } 223 213 set { MaximumSelectionPressureParameter.Value = value; } 224 214 } 225 p ublicBoolValue OffspringSelectionBeforeMutation {215 private BoolValue OffspringSelectionBeforeMutation { 226 216 get { return OffspringSelectionBeforeMutationParameter.Value; } 227 217 set { OffspringSelectionBeforeMutationParameter.Value = value; } … … 238 228 get { return MaximumEvaluatedSolutionsParameter.Value; } 239 229 set { MaximumEvaluatedSolutionsParameter.Value = value; } 240 }241 public bool FillPopulationWithParents {242 get { return FillPopulationWithParentsParameter.Value.Value; }243 set { FillPopulationWithParentsParameter.Value.Value = value; }244 230 } 245 231 private RandomCreator RandomCreator { … … 271 257 [StorableHook(HookType.AfterDeserialization)] 272 258 private void AfterDeserialization() { 273 // BackwardsCompatibility3.3 274 #region Backwards compatible code, remove with 3.4 259 #region Backwards Compatibility 275 260 if (successfulOffspringAnalyzer == null) 276 261 successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer(); 277 if (!Parameters.ContainsKey("ReevaluateElites")) {278 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });279 }280 if (!Parameters.ContainsKey("FillPopulationWithParents"))281 Parameters.Add(new FixedValueParameter<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.", new BoolValue(false)) { Hidden = true });282 262 #endregion 283 263 … … 313 293 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 314 294 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 315 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });316 295 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); 317 296 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0))); … … 324 303 Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer())); 325 304 Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue))); 326 Parameters.Add(new FixedValueParameter<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.", new BoolValue(true)) { Hidden = true });327 305 328 306 RandomCreator randomCreator = new RandomCreator(); … … 377 355 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 378 356 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 379 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;380 357 mainLoop.MutatorParameter.ActualName = MutatorParameter.Name; 381 358 mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; … … 389 366 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 390 367 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 391 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;392 368 mainLoop.Successor = null; 393 369 -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 91 91 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 92 92 } 93 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {94 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }95 }96 93 public ValueLookupParameter<ResultCollection> ResultsParameter { 97 94 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } … … 129 126 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 130 127 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 131 }132 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {133 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }134 128 } 135 129 #endregion … … 164 158 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 165 159 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 166 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));167 160 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); 168 161 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); … … 177 170 Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island.")); 178 171 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 179 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."));180 172 #endregion 181 173 … … 256 248 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 257 249 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 258 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;259 250 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 260 251 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 269 260 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 270 261 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 271 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;272 262 273 263 islandAnalyzer2.Name = "Island Analyzer (placeholder)"; … … 424 414 } 425 415 426 [StorableHook(HookType.AfterDeserialization)]427 private void AfterDeserialization() {428 // BackwardsCompatibility3.3429 #region Backwards compatible code, remove with 3.4430 if (!Parameters.ContainsKey("ReevaluateElites")) {431 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));432 }433 if (!Parameters.ContainsKey("FillPopulationWithParents"))434 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."));435 #endregion436 }437 438 416 public override IOperation Apply() { 439 417 if (CrossoverParameter.ActualValue == null) -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 79 79 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 80 80 } 81 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {82 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }83 }84 81 private ValueParameter<IntValue> MaximumGenerationsParameter { 85 82 get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 111 108 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 112 109 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 113 }114 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {115 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }116 110 } 117 111 #endregion … … 150 144 set { ElitesParameter.Value = value; } 151 145 } 152 public bool ReevaluteElites {153 get { return ReevaluateElitesParameter.Value.Value; }154 set { ReevaluateElitesParameter.Value.Value = value; }155 }156 146 public IntValue MaximumGenerations { 157 147 get { return MaximumGenerationsParameter.Value; } … … 193 183 get { return MaximumEvaluatedSolutionsParameter.Value; } 194 184 set { MaximumEvaluatedSolutionsParameter.Value = value; } 195 }196 public bool FillPopulationWithParents {197 get { return FillPopulationWithParentsParameter.Value.Value; }198 set { FillPopulationWithParentsParameter.Value.Value = value; }199 185 } 200 186 private RandomCreator RandomCreator { … … 219 205 [StorableHook(HookType.AfterDeserialization)] 220 206 private void AfterDeserialization() { 221 // BackwardsCompatibility3.3 222 #region Backwards compatible code, remove with 3.4 207 #region Backwards Compatibility 223 208 if (successfulOffspringAnalyzer == null) 224 209 successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer(); 225 if (!Parameters.ContainsKey("ReevaluateElites")) {226 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });227 }228 if (!Parameters.ContainsKey("FillPopulationWithParents"))229 Parameters.Add(new FixedValueParameter<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.", new BoolValue(false)) { Hidden = true });230 210 #endregion 231 211 … … 252 232 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 253 233 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 254 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });255 234 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); 256 235 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); … … 263 242 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); 264 243 Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue))); 265 Parameters.Add(new FixedValueParameter<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.", new BoolValue(false)) { Hidden = true });266 244 267 245 RandomCreator randomCreator = new RandomCreator(); … … 296 274 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 297 275 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 298 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;299 276 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 300 277 mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; … … 307 284 mainLoop.SelectorParameter.ActualName = SelectorParameter.Name; 308 285 mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 309 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;310 286 311 287 foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)) -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 63 63 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 64 64 } 65 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {66 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }67 }68 65 public ValueLookupParameter<IntValue> MaximumGenerationsParameter { 69 66 get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 95 92 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 96 93 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 97 }98 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {99 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }100 94 } 101 95 #endregion … … 112 106 : base() { 113 107 Initialize(); 114 }115 116 [StorableHook(HookType.AfterDeserialization)]117 private void AfterDeserialization() {118 // BackwardsCompatibility3.3119 #region Backwards compatible code, remove with 3.4120 if (!Parameters.ContainsKey("ReevaluateElites")) {121 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));122 }123 if (!Parameters.ContainsKey("FillPopulationWithParents"))124 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."));125 #endregion126 108 } 127 109 … … 138 120 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 139 121 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 140 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));141 122 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.")); 142 123 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); … … 149 130 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); 150 131 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 151 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."));152 132 #endregion 153 133 … … 190 170 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 191 171 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 192 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;193 172 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 194 173 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 203 182 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 204 183 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 205 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;206 184 207 185 generationsCounter.Increment = new IntValue(1); -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 67 67 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 68 68 } 69 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {70 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }71 }72 69 public LookupParameter<DoubleValue> ComparisonFactorParameter { 73 70 get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; } … … 87 84 public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 88 85 get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } 89 }90 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {91 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }92 86 } 93 87 #endregion … … 104 98 : base() { 105 99 Initialize(); 106 }107 108 [StorableHook(HookType.AfterDeserialization)]109 private void AfterDeserialization() {110 // BackwardsCompatibility3.3111 #region Backwards compatible code, remove with 3.4112 if (!Parameters.ContainsKey("ReevaluateElites")) {113 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));114 }115 if (!Parameters.ContainsKey("FillPopulationWithParents"))116 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."));117 #endregion118 100 } 119 101 … … 130 112 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 131 113 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 132 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));133 114 Parameters.Add(new LookupParameter<DoubleValue>("ComparisonFactor", "The comparison factor is used to determine whether the offspring should be compared to the better parent, the worse parent or a quality value linearly interpolated between them. It is in the range [0;1].")); 134 115 Parameters.Add(new LookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio.")); … … 137 118 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.")); 138 119 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); 139 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."));140 120 #endregion 141 121 … … 179 159 LeftReducer leftReducer = new LeftReducer(); 180 160 MergingReducer mergingReducer2 = new MergingReducer(); 181 ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();182 UniformSubScopesProcessor uniformSubScopesProcessor7 = new UniformSubScopesProcessor();183 Placeholder evaluator4 = new Placeholder();184 SubScopesCounter subScopesCounter4 = new SubScopesCounter();185 161 186 162 selector.Name = "Selector (placeholder)"; … … 267 243 offspringSelector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners"; 268 244 offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring"; 269 offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;270 245 271 246 bestSelector.CopySelected = new BoolValue(false); … … 278 253 worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name; 279 254 worstSelector.QualityParameter.ActualName = QualityParameter.Name; 280 281 reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";282 reevaluateElitesBranch.Name = "Reevaluate elites ?";283 284 uniformSubScopesProcessor7.Parallel.Value = true;285 286 evaluator4.Name = "Evaluator (placeholder)";287 evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name;288 289 subScopesCounter4.Name = "Increment EvaluatedSolutions";290 subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;291 255 #endregion 292 256 … … 346 310 subScopesProcessor3.Successor = mergingReducer2; 347 311 bestSelector.Successor = rightReducer; 348 rightReducer.Successor = reevaluateElitesBranch; 349 reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7; 350 uniformSubScopesProcessor7.Operator = evaluator4; 351 uniformSubScopesProcessor7.Successor = subScopesCounter4; 352 subScopesCounter4.Successor = null; 353 reevaluateElitesBranch.FalseBranch = null; 354 reevaluateElitesBranch.Successor = null; 312 rightReducer.Successor = null; 355 313 worstSelector.Successor = leftReducer; 356 314 leftReducer.Successor = null; -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Plugin.cs.frame
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 /// Plugin class for HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm plugin. 27 27 /// </summary> 28 [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3. 10.$WCREV$")]28 [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.7.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Properties/AssemblyInfo.cs.frame
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 31 31 [assembly: AssemblyCompany("")] 32 32 [assembly: AssemblyProduct("HeuristicLab")] 33 [assembly: AssemblyCopyright("(c) 2002-201 4HEAL")]33 [assembly: AssemblyCopyright("(c) 2002-2012 HEAL")] 34 34 [assembly: AssemblyTrademark("")] 35 35 [assembly: AssemblyCulture("")] … … 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3. 10.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")] -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 85 85 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 86 86 } 87 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {88 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }89 }90 87 private ValueLookupParameter<DoubleValue> SuccessRatioParameter { 91 88 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } … … 120 117 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 121 118 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 122 }123 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {124 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }125 119 } 126 120 #endregion … … 167 161 set { ElitesParameter.Value = value; } 168 162 } 169 public bool ReevaluteElites {170 get { return ReevaluateElitesParameter.Value.Value; }171 set { ReevaluateElitesParameter.Value.Value = value; }172 }173 163 public DoubleValue SuccessRatio { 174 164 get { return SuccessRatioParameter.Value; } … … 214 204 get { return MaximumEvaluatedSolutionsParameter.Value; } 215 205 set { MaximumEvaluatedSolutionsParameter.Value = value; } 216 }217 public bool FillPopulationWithParents {218 get { return FillPopulationWithParentsParameter.Value.Value; }219 set { FillPopulationWithParentsParameter.Value.Value = value; }220 206 } 221 207 private RandomCreator RandomCreator { … … 247 233 [StorableHook(HookType.AfterDeserialization)] 248 234 private void AfterDeserialization() { 249 // BackwardsCompatibility3.3 250 #region Backwards compatible code, remove with 3.4 235 #region Backwards Compatibility 251 236 if (successfulOffspringAnalyzer == null) 252 237 successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer(); 253 if (!Parameters.ContainsKey("ReevaluateElites")) {254 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });255 }256 if (!Parameters.ContainsKey("FillPopulationWithParents"))257 Parameters.Add(new FixedValueParameter<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.", new BoolValue(false)) { Hidden = true });258 238 #endregion 259 239 … … 284 264 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 285 265 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 286 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });287 266 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); 288 267 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0.3))); … … 296 275 Parameters.Add(new ValueParameter<MultiAnalyzer>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer())); 297 276 Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue))); 298 Parameters.Add(new FixedValueParameter<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.", new BoolValue(true)) { Hidden = true });299 277 300 278 RandomCreator randomCreator = new RandomCreator(); … … 343 321 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 344 322 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 345 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;346 323 mainLoop.MutatorParameter.ActualName = MutatorParameter.Name; 347 324 mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; … … 356 333 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 357 334 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 358 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;359 335 mainLoop.Successor = null; 360 336 -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 73 73 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 74 74 } 75 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {76 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }77 }78 75 public ValueLookupParameter<ResultCollection> ResultsParameter { 79 76 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } … … 111 108 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 112 109 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 113 }114 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {115 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }116 110 } 117 111 #endregion … … 140 134 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 141 135 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 142 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));143 136 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); 144 137 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the villages.")); … … 153 146 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); 154 147 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 155 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."));156 148 #endregion 157 149 … … 244 236 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 245 237 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 246 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;247 238 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 248 239 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 257 248 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 258 249 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 259 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;260 250 261 251 villageAnalyzer2.Name = "Village Analyzer (placeholder)"; … … 434 424 } 435 425 436 [StorableHook(HookType.AfterDeserialization)]437 private void AfterDeserialization() {438 // BackwardsCompatibility3.3439 #region Backwards compatible code, remove with 3.4440 if (!Parameters.ContainsKey("ReevaluateElites")) {441 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));442 }443 if (!Parameters.ContainsKey("FillPopulationWithParents"))444 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."));445 #endregion446 }447 448 426 public override IOperation Apply() { 449 427 if (CrossoverParameter.ActualValue == null) -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 81 81 Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created.")); 82 82 Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1))); 83 84 CollectedValuesParameter.Value.Add(new StringValue("SelectedCrossoverOperator"));85 CollectedValuesParameter.Value.Add(new StringValue("SelectedManipulationOperator"));86 83 } 87 84 … … 113 110 } 114 111 115 if (counts.Count > 0) { 116 //create a data table containing the collected values 117 ResultCollection successfulOffspringAnalysis; 112 //create a data table containing the collected values 113 ResultCollection successfulOffspringAnalysis; 118 114 119 if (SuccessfulOffspringAnalysisParameter.ActualValue == null) { 120 successfulOffspringAnalysis = new ResultCollection(); 121 SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis; 115 if (SuccessfulOffspringAnalysisParameter.ActualValue == null) { 116 successfulOffspringAnalysis = new ResultCollection(); 117 SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis; 118 } else { 119 successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue; 120 } 121 122 string resultKey = "SuccessfulOffspringAnalyzer Results"; 123 if (!results.ContainsKey(resultKey)) { 124 results.Add(new Result(resultKey, successfulOffspringAnalysis)); 125 } else { 126 results[resultKey].Value = successfulOffspringAnalysis; 127 } 128 129 DataTable successProgressAnalysis; 130 if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) { 131 successProgressAnalysis = new DataTable(); 132 successProgressAnalysis.Name = collected.Value; 133 successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis)); 134 } else { 135 successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable; 136 } 137 138 int successfulCount = 0; 139 foreach (string key in counts.Keys) { 140 successfulCount += counts[key]; 141 } 142 143 foreach (String value in counts.Keys) { 144 DataRow row; 145 if (!successProgressAnalysis.Rows.ContainsKey(value)) { 146 row = new DataRow(value); 147 int iterations = GenerationsParameter.ActualValue.Value; 148 149 //fill up all values seen the first time 150 for (int i = 1; i < iterations; i++) 151 row.Values.Add(0); 152 153 successProgressAnalysis.Rows.Add(row); 122 154 } else { 123 successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;155 row = successProgressAnalysis.Rows[value]; 124 156 } 125 157 126 string resultKey = "SuccessfulOffspringAnalyzer Results"; 127 if (!results.ContainsKey(resultKey)) { 128 results.Add(new Result(resultKey, successfulOffspringAnalysis)); 129 } else { 130 results[resultKey].Value = successfulOffspringAnalysis; 131 } 158 row.Values.Add(counts[value] / (double)successfulCount); 159 } 132 160 133 DataTable successProgressAnalysis; 134 if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) { 135 successProgressAnalysis = new DataTable(); 136 successProgressAnalysis.Name = collected.Value; 137 successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis)); 138 } else { 139 successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable; 140 } 141 142 int successfulCount = 0; 143 foreach (string key in counts.Keys) { 144 successfulCount += counts[key]; 145 } 146 147 foreach (String value in counts.Keys) { 148 DataRow row; 149 if (!successProgressAnalysis.Rows.ContainsKey(value)) { 150 row = new DataRow(value); 151 int iterations = GenerationsParameter.ActualValue.Value; 152 153 //fill up all values seen the first time 154 for (int i = 1; i < iterations; i++) 155 row.Values.Add(0); 156 157 successProgressAnalysis.Rows.Add(row); 158 } else { 159 row = successProgressAnalysis.Rows[value]; 160 } 161 162 row.Values.Add(counts[value] / (double)successfulCount); 163 } 164 165 //fill up all values that are not present in the current generation 166 foreach (DataRow row in successProgressAnalysis.Rows) { 167 if (!counts.ContainsKey(row.Name)) 168 row.Values.Add(0); 169 } 161 //fill up all values that are not present in the current generation 162 foreach (DataRow row in successProgressAnalysis.Rows) { 163 if (!counts.ContainsKey(row.Name)) 164 row.Values.Add(0); 170 165 } 171 166 }
Note: See TracChangeset
for help on using the changeset viewer.