Changeset 4098 for trunk/sources/HeuristicLab.Problems.TestFunctions
- Timestamp:
- 07/25/10 01:04:14 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.TestFunctions/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs
r4086 r4098 90 90 [StorableHook(HookType.AfterDeserialization)] 91 91 private void CompatibilityMethod() { 92 // BackwardsCompatibility3.3 92 93 // Bounds are introduced in 3.3.0.3894 93 94 if (!Parameters.ContainsKey("Bounds")) -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r4068 r4098 119 119 set { BestKnownQualityParameter.Value = value; } 120 120 } 121 private List<IOperator> operators;122 121 public IEnumerable<IOperator> Operators { 123 122 get { return operators; } … … 127 126 } 128 127 #endregion 128 129 [Storable] 130 private List<IOperator> operators; 129 131 130 132 [StorableConstructor] … … 154 156 ParameterizeEvaluator(); 155 157 156 Initialize(); 158 InitializeOperators(); 159 AttachEventHandlers(); 157 160 UpdateStrategyVectorBounds(); 158 161 } … … 160 163 public override IDeepCloneable Clone(Cloner cloner) { 161 164 SingleObjectiveTestFunctionProblem clone = (SingleObjectiveTestFunctionProblem)base.Clone(cloner); 165 clone.operators = operators.Where(x => IsNotFieldReferenced(x)).Select(x => (IOperator)cloner.Clone(x)).ToList(); 162 166 clone.strategyVectorCreator = (StdDevStrategyVectorCreator)cloner.Clone(strategyVectorCreator); 167 clone.operators.Add(clone.strategyVectorCreator); 163 168 clone.strategyVectorCrossover = (StdDevStrategyVectorCrossover)cloner.Clone(strategyVectorCrossover); 169 clone.operators.Add(strategyVectorCrossover); 164 170 clone.strategyVectorManipulator = (StdDevStrategyVectorManipulator)cloner.Clone(strategyVectorManipulator); 165 clone.Initialize(); 171 clone.operators.Add(strategyVectorManipulator); 172 clone.AttachEventHandlers(); 166 173 return clone; 174 } 175 176 private bool IsNotFieldReferenced(IOperator x) { 177 return !(x == strategyVectorCreator 178 || x == strategyVectorCrossover 179 || x == strategyVectorManipulator); 167 180 } 168 181 … … 284 297 #region Helpers 285 298 [StorableHook(HookType.AfterDeserialization)] 286 private void Initialize() { 287 InitializeOperators(); 299 private void AttachEventHandlers() { 300 // Start BackwardsCompatibility3.3 (remove with 3.4) 301 if (operators == null) InitializeOperators(); 302 // End BackwardsCompatibility3.3 288 303 ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged); 289 304 ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged);
Note: See TracChangeset
for help on using the changeset viewer.