- Timestamp:
- 06/12/13 15:02:47 (11 years ago)
- Location:
- branches/HivePerformance/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HivePerformance/sources
- Property svn:mergeinfo changed
/trunk/sources merged: 9540,9542-9544,9552-9555,9568-9569,9587,9590-9592,9600,9607-9608,9610-9611,9613
- Property svn:mergeinfo changed
-
branches/HivePerformance/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs
r9539 r9616 94 94 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 95 95 } 96 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter { 97 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; } 98 } 96 99 private ValueParameter<MultiAnalyzer> AnalyzerParameter { 97 100 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } … … 157 160 get { return ElitesParameter.Value; } 158 161 set { ElitesParameter.Value = value; } 162 } 163 public bool ReevaluteElites { 164 get { return ReevaluateElitesParameter.Value.Value; } 165 set { ReevaluateElitesParameter.Value.Value = value; } 159 166 } 160 167 public MultiAnalyzer Analyzer { … … 192 199 private RAPGA(bool deserializing) : base(deserializing) { } 193 200 [StorableHook(HookType.AfterDeserialization)] 194 private void AfterDeserialization() { Initialize(); } 201 private void AfterDeserialization() { 202 // BackwardsCompatibility3.3 203 #region Backwards compatible code, remove with 3.4 204 if (!Parameters.ContainsKey("ReevaluateElites")) { 205 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 }); 206 } 207 #endregion 208 Initialize(); 209 } 195 210 private RAPGA(RAPGA original, Cloner cloner) 196 211 : base(original, cloner) { … … 216 231 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 217 232 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 233 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 }); 218 234 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); 219 235 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); … … 248 264 mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 249 265 mainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 266 mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name; 250 267 mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; 251 268 mainLoop.MutatorParameter.ActualName = MutatorParameter.Name; -
branches/HivePerformance/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGAMainLoop.cs
r9539 r9616 65 65 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 66 66 } 67 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 68 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 69 } 67 70 public ValueLookupParameter<IntValue> MaximumGenerationsParameter { 68 71 get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 116 119 public override IDeepCloneable Clone(Cloner cloner) { 117 120 return new RAPGAMainLoop(this, cloner); 121 } 122 123 [StorableHook(HookType.AfterDeserialization)] 124 private void AfterDeserialization() { 125 // BackwardsCompatibility3.3 126 #region Backwards compatible code, remove with 3.4 127 if (!Parameters.ContainsKey("ReevaluateElites")) { 128 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)")); 129 } 130 #endregion 118 131 } 119 132 … … 129 142 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.")); 130 143 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 144 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)")); 131 145 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.")); 132 146 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); … … 190 204 Assigner assigner4 = new Assigner(); 191 205 Assigner assigner5 = new Assigner(); 206 ConditionalBranch reevaluateElitesBranch = new ConditionalBranch(); 207 UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); 208 Placeholder evaluator2 = new Placeholder(); 209 SubScopesCounter subScopesCounter4 = new SubScopesCounter(); 192 210 193 211 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class RAPGA expects this to be called Generations … … 338 356 assigner5.LeftSideParameter.ActualName = "OffspringList"; 339 357 assigner5.RightSideParameter.Value = new ScopeList(); 358 359 reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites"; 360 reevaluateElitesBranch.Name = "Reevaluate elites ?"; 361 362 uniformSubScopesProcessor2.Parallel.Value = true; 363 364 evaluator2.Name = "Evaluator (placeholder)"; 365 evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name; 366 367 subScopesCounter4.Name = "Increment EvaluatedSolutions"; 368 subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 340 369 #endregion 341 370 … … 378 407 subScopesProcessor2.Successor = mergingReducer; 379 408 bestSelector.Successor = rightReducer2; 380 rightReducer2.Successor = null; 409 rightReducer2.Successor = reevaluateElitesBranch; 410 reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor2; 411 uniformSubScopesProcessor2.Operator = evaluator2; 412 uniformSubScopesProcessor2.Successor = subScopesCounter4; 413 evaluator2.Successor = null; 414 subScopesCounter4.Successor = null; 415 reevaluateElitesBranch.FalseBranch = null; 416 reevaluateElitesBranch.Successor = null; 381 417 scopeCleaner.Successor = scopeRestorer; 382 418 mergingReducer.Successor = intCounter3;
Note: See TracChangeset
for help on using the changeset viewer.