Changeset 11202 for branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm
- Timestamp:
- 07/18/14 12:01:13 (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.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.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r8121 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. … … 100 100 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 101 101 } 102 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter { 103 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; } 104 } 102 105 private ValueLookupParameter<DoubleValue> SuccessRatioParameter { 103 106 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } … … 129 132 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 130 133 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 134 } 135 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter { 136 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 131 137 } 132 138 #endregion … … 193 199 set { ElitesParameter.Value = value; } 194 200 } 195 private DoubleValue SuccessRatio { 201 public bool ReevaluteElites { 202 get { return ReevaluateElitesParameter.Value.Value; } 203 set { ReevaluateElitesParameter.Value.Value = value; } 204 } 205 public DoubleValue SuccessRatio { 196 206 get { return SuccessRatioParameter.Value; } 197 207 set { SuccessRatioParameter.Value = value; } 198 208 } 199 p rivateDoubleValue ComparisonFactorLowerBound {209 public DoubleValue ComparisonFactorLowerBound { 200 210 get { return ComparisonFactorLowerBoundParameter.Value; } 201 211 set { ComparisonFactorLowerBoundParameter.Value = value; } 202 212 } 203 p rivateDoubleValue ComparisonFactorUpperBound {213 public DoubleValue ComparisonFactorUpperBound { 204 214 get { return ComparisonFactorUpperBoundParameter.Value; } 205 215 set { ComparisonFactorUpperBoundParameter.Value = value; } … … 209 219 set { ComparisonFactorModifierParameter.Value = value; } 210 220 } 211 p rivateDoubleValue MaximumSelectionPressure {221 public DoubleValue MaximumSelectionPressure { 212 222 get { return MaximumSelectionPressureParameter.Value; } 213 223 set { MaximumSelectionPressureParameter.Value = value; } 214 224 } 215 p rivateBoolValue OffspringSelectionBeforeMutation {225 public BoolValue OffspringSelectionBeforeMutation { 216 226 get { return OffspringSelectionBeforeMutationParameter.Value; } 217 227 set { OffspringSelectionBeforeMutationParameter.Value = value; } … … 228 238 get { return MaximumEvaluatedSolutionsParameter.Value; } 229 239 set { MaximumEvaluatedSolutionsParameter.Value = value; } 240 } 241 public bool FillPopulationWithParents { 242 get { return FillPopulationWithParentsParameter.Value.Value; } 243 set { FillPopulationWithParentsParameter.Value.Value = value; } 230 244 } 231 245 private RandomCreator RandomCreator { … … 257 271 [StorableHook(HookType.AfterDeserialization)] 258 272 private void AfterDeserialization() { 259 #region Backwards Compatibility 273 // BackwardsCompatibility3.3 274 #region Backwards compatible code, remove with 3.4 260 275 if (successfulOffspringAnalyzer == null) 261 276 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 }); 262 282 #endregion 263 283 … … 293 313 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 294 314 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 }); 295 316 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); 296 317 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0))); … … 303 324 Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer())); 304 325 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 }); 305 327 306 328 RandomCreator randomCreator = new RandomCreator(); … … 355 377 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 356 378 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 379 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 357 380 mainLoop.MutatorParameter.ActualName = MutatorParameter.Name; 358 381 mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; … … 366 389 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 367 390 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 391 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 368 392 mainLoop.Successor = null; 369 393 -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.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. … … 91 91 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 92 92 } 93 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 94 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 95 } 93 96 public ValueLookupParameter<ResultCollection> ResultsParameter { 94 97 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } … … 126 129 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 127 130 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 131 } 132 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 133 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 128 134 } 129 135 #endregion … … 158 164 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.")); 159 165 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.)")); 160 167 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); 161 168 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); … … 170 177 Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island.")); 171 178 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.")); 172 180 #endregion 173 181 … … 248 256 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 249 257 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 258 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 250 259 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 251 260 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 260 269 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 261 270 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 271 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 262 272 263 273 islandAnalyzer2.Name = "Island Analyzer (placeholder)"; … … 414 424 } 415 425 426 [StorableHook(HookType.AfterDeserialization)] 427 private void AfterDeserialization() { 428 // BackwardsCompatibility3.3 429 #region Backwards compatible code, remove with 3.4 430 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 #endregion 436 } 437 416 438 public override IOperation Apply() { 417 439 if (CrossoverParameter.ActualValue == null) -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r8121 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. … … 79 79 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 80 80 } 81 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter { 82 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; } 83 } 81 84 private ValueParameter<IntValue> MaximumGenerationsParameter { 82 85 get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 108 111 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 109 112 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 113 } 114 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter { 115 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 110 116 } 111 117 #endregion … … 144 150 set { ElitesParameter.Value = value; } 145 151 } 152 public bool ReevaluteElites { 153 get { return ReevaluateElitesParameter.Value.Value; } 154 set { ReevaluateElitesParameter.Value.Value = value; } 155 } 146 156 public IntValue MaximumGenerations { 147 157 get { return MaximumGenerationsParameter.Value; } … … 183 193 get { return MaximumEvaluatedSolutionsParameter.Value; } 184 194 set { MaximumEvaluatedSolutionsParameter.Value = value; } 195 } 196 public bool FillPopulationWithParents { 197 get { return FillPopulationWithParentsParameter.Value.Value; } 198 set { FillPopulationWithParentsParameter.Value.Value = value; } 185 199 } 186 200 private RandomCreator RandomCreator { … … 205 219 [StorableHook(HookType.AfterDeserialization)] 206 220 private void AfterDeserialization() { 207 #region Backwards Compatibility 221 // BackwardsCompatibility3.3 222 #region Backwards compatible code, remove with 3.4 208 223 if (successfulOffspringAnalyzer == null) 209 224 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 }); 210 230 #endregion 211 231 … … 232 252 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 233 253 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 }); 234 255 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); 235 256 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); … … 242 263 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); 243 264 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 }); 244 266 245 267 RandomCreator randomCreator = new RandomCreator(); … … 274 296 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 275 297 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 298 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 276 299 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 277 300 mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; … … 284 307 mainLoop.SelectorParameter.ActualName = SelectorParameter.Name; 285 308 mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 309 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 286 310 287 311 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
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. … … 63 63 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 64 64 } 65 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 66 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 67 } 65 68 public ValueLookupParameter<IntValue> MaximumGenerationsParameter { 66 69 get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 92 95 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 93 96 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 97 } 98 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 99 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 94 100 } 95 101 #endregion … … 106 112 : base() { 107 113 Initialize(); 114 } 115 116 [StorableHook(HookType.AfterDeserialization)] 117 private void AfterDeserialization() { 118 // BackwardsCompatibility3.3 119 #region Backwards compatible code, remove with 3.4 120 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 #endregion 108 126 } 109 127 … … 120 138 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.")); 121 139 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.)")); 122 141 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.")); 123 142 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); … … 130 149 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.")); 131 150 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.")); 132 152 #endregion 133 153 … … 170 190 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 171 191 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 192 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 172 193 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 173 194 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 182 203 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 183 204 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 205 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 184 206 185 207 generationsCounter.Increment = new IntValue(1); -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.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. … … 67 67 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 68 68 } 69 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 70 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 71 } 69 72 public LookupParameter<DoubleValue> ComparisonFactorParameter { 70 73 get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; } … … 84 87 public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 85 88 get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } 89 } 90 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 91 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 86 92 } 87 93 #endregion … … 98 104 : base() { 99 105 Initialize(); 106 } 107 108 [StorableHook(HookType.AfterDeserialization)] 109 private void AfterDeserialization() { 110 // BackwardsCompatibility3.3 111 #region Backwards compatible code, remove with 3.4 112 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 #endregion 100 118 } 101 119 … … 112 130 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 113 131 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.)")); 114 133 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].")); 115 134 Parameters.Add(new LookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio.")); … … 118 137 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.")); 119 138 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.")); 120 140 #endregion 121 141 … … 159 179 LeftReducer leftReducer = new LeftReducer(); 160 180 MergingReducer mergingReducer2 = new MergingReducer(); 181 ConditionalBranch reevaluateElitesBranch = new ConditionalBranch(); 182 UniformSubScopesProcessor uniformSubScopesProcessor7 = new UniformSubScopesProcessor(); 183 Placeholder evaluator4 = new Placeholder(); 184 SubScopesCounter subScopesCounter4 = new SubScopesCounter(); 161 185 162 186 selector.Name = "Selector (placeholder)"; … … 243 267 offspringSelector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners"; 244 268 offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring"; 269 offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 245 270 246 271 bestSelector.CopySelected = new BoolValue(false); … … 253 278 worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name; 254 279 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; 255 291 #endregion 256 292 … … 310 346 subScopesProcessor3.Successor = mergingReducer2; 311 347 bestSelector.Successor = rightReducer; 312 rightReducer.Successor = null; 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; 313 355 worstSelector.Successor = leftReducer; 314 356 leftReducer.Successor = null; -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Plugin.cs.frame
r8246 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. … … 26 26 /// Plugin class for HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm plugin. 27 27 /// </summary> 28 [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3. 7.$WCREV$")]28 [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.10.$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
r8246 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. … … 31 31 [assembly: AssemblyCompany("")] 32 32 [assembly: AssemblyProduct("HeuristicLab")] 33 [assembly: AssemblyCopyright("(c) 2002-201 2HEAL")]33 [assembly: AssemblyCopyright("(c) 2002-2014 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. 7.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.10.$WCREV$")] -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
r8121 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. … … 85 85 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 86 86 } 87 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter { 88 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; } 89 } 87 90 private ValueLookupParameter<DoubleValue> SuccessRatioParameter { 88 91 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } … … 117 120 private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter { 118 121 get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; } 122 } 123 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter { 124 get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 119 125 } 120 126 #endregion … … 161 167 set { ElitesParameter.Value = value; } 162 168 } 169 public bool ReevaluteElites { 170 get { return ReevaluateElitesParameter.Value.Value; } 171 set { ReevaluateElitesParameter.Value.Value = value; } 172 } 163 173 public DoubleValue SuccessRatio { 164 174 get { return SuccessRatioParameter.Value; } … … 204 214 get { return MaximumEvaluatedSolutionsParameter.Value; } 205 215 set { MaximumEvaluatedSolutionsParameter.Value = value; } 216 } 217 public bool FillPopulationWithParents { 218 get { return FillPopulationWithParentsParameter.Value.Value; } 219 set { FillPopulationWithParentsParameter.Value.Value = value; } 206 220 } 207 221 private RandomCreator RandomCreator { … … 233 247 [StorableHook(HookType.AfterDeserialization)] 234 248 private void AfterDeserialization() { 235 #region Backwards Compatibility 249 // BackwardsCompatibility3.3 250 #region Backwards compatible code, remove with 3.4 236 251 if (successfulOffspringAnalyzer == null) 237 252 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 }); 238 258 #endregion 239 259 … … 264 284 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 265 285 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 }); 266 287 Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1))); 267 288 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0.3))); … … 275 296 Parameters.Add(new ValueParameter<MultiAnalyzer>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer())); 276 297 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 }); 277 299 278 300 RandomCreator randomCreator = new RandomCreator(); … … 321 343 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 322 344 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 345 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 323 346 mainLoop.MutatorParameter.ActualName = MutatorParameter.Name; 324 347 mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; … … 333 356 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 334 357 mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions"; 358 mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 335 359 mainLoop.Successor = null; 336 360 -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.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. … … 73 73 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 74 74 } 75 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 76 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 77 } 75 78 public ValueLookupParameter<ResultCollection> ResultsParameter { 76 79 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } … … 108 111 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 109 112 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 113 } 114 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 115 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 110 116 } 111 117 #endregion … … 134 140 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.")); 135 141 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.)")); 136 143 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); 137 144 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the villages.")); … … 146 153 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.")); 147 154 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.")); 148 156 #endregion 149 157 … … 236 244 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 237 245 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 246 mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 238 247 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 239 248 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; … … 248 257 mainOperator.SelectorParameter.ActualName = SelectorParameter.Name; 249 258 mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name; 259 mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 250 260 251 261 villageAnalyzer2.Name = "Village Analyzer (placeholder)"; … … 424 434 } 425 435 436 [StorableHook(HookType.AfterDeserialization)] 437 private void AfterDeserialization() { 438 // BackwardsCompatibility3.3 439 #region Backwards compatible code, remove with 3.4 440 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 #endregion 446 } 447 426 448 public override IOperation Apply() { 427 449 if (CrossoverParameter.ActualValue == null) -
branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.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. … … 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")); 83 86 } 84 87 … … 110 113 } 111 114 112 //create a data table containing the collected values 113 ResultCollection successfulOffspringAnalysis; 115 if (counts.Count > 0) { 116 //create a data table containing the collected values 117 ResultCollection successfulOffspringAnalysis; 114 118 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); 119 if (SuccessfulOffspringAnalysisParameter.ActualValue == null) { 120 successfulOffspringAnalysis = new ResultCollection(); 121 SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis; 154 122 } else { 155 row = successProgressAnalysis.Rows[value];123 successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue; 156 124 } 157 125 158 row.Values.Add(counts[value] / (double)successfulCount); 159 } 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 } 160 132 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); 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 } 165 170 } 166 171 }
Note: See TracChangeset
for help on using the changeset viewer.