Changeset 7351
- Timestamp:
- 01/17/12 23:54:58 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs
r7259 r7351 157 157 : base(original, cloner) { 158 158 paretoFrontAnalyzer = (RankBasedParetoFrontAnalyzer)cloner.Clone(original.paretoFrontAnalyzer); 159 A ttachEventHandlers();159 AfterDeserialization(); 160 160 } 161 161 public NSGA2() { … … 229 229 UpdateAnalyzers(); 230 230 231 A ttachEventHandlers();231 AfterDeserialization(); 232 232 } 233 233 … … 310 310 #region Helpers 311 311 [StorableHook(HookType.AfterDeserialization)] 312 private void A ttachEventHandlers() {312 private void AfterDeserialization() { 313 313 PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged); 314 314 PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged); -
trunk/sources/HeuristicLab.Analysis/3.3/ValueAnalysis/MinAverageMaxValueAnalyzer.cs
r7259 r7351 94 94 : base(original, cloner) { 95 95 resultsCollector = cloner.Clone(original.resultsCollector); 96 Initialize();96 RegisterEventHandlers(); 97 97 } 98 98 public override IDeepCloneable Clone(Cloner cloner) { … … 147 147 #endregion 148 148 149 Initialize();149 RegisterEventHandlers(); 150 150 } 151 151 152 152 [StorableHook(HookType.AfterDeserialization)] 153 private void Initialize() { 153 private void AfterDeserialization() { 154 RegisterEventHandlers(); 155 } 156 157 private void RegisterEventHandlers() { 154 158 ValueParameter.DepthChanged += new EventHandler(ValueParameter_DepthChanged); 155 159 CollectMinValueInResultsParameter.ValueChanged += new EventHandler(CollectMinValueInResultsParameter_ValueChanged); -
trunk/sources/HeuristicLab.Operators/3.3/StochasticMultiBranch.cs
r7259 r7351 61 61 } 62 62 63 [StorableHook(HookType.AfterDeserialization)]64 private void AfterDeserializationHook() {65 #region Backwards Compatibility66 if (!Parameters.ContainsKey("SelectedOperator")) {67 Parameters.Add(new LookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter."));68 SelectedOperatorParameter.Hidden = false;69 }70 if (!Parameters.ContainsKey("TraceSelectedOperator")) {71 Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false)));72 }73 #endregion74 }75 76 63 [StorableConstructor] 77 64 protected StochasticMultiBranch(bool deserializing) : base(deserializing) { } … … 90 77 Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false))); 91 78 SelectedOperatorParameter.Hidden = false; 79 } 80 81 [StorableHook(HookType.AfterDeserialization)] 82 private void AfterDeserialization() { 83 // BackwardsCompatibility3.3 84 #region Backwards compatible code, remove with 3.4 85 if (!Parameters.ContainsKey("SelectedOperator")) { 86 Parameters.Add(new LookupParameter<StringValue>("SelectedOperator", "If the TraceSelectedOperator flag is set, the name of the operator is traced in this parameter.")); 87 SelectedOperatorParameter.Hidden = false; 88 } 89 if (!Parameters.ContainsKey("TraceSelectedOperator")) { 90 Parameters.Add(new ValueParameter<BoolValue>("TraceSelectedOperator", "Indicates, if the selected operator should be traced.", new BoolValue(false))); 91 } 92 #endregion 92 93 } 93 94 -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/MultiObjective/CrowdingDistanceAssignment.cs
r7259 r7351 53 53 Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The vector of quality values.")); 54 54 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("CrowdingDistance", "Sets the crowding distance in each sub-scope.")); 55 AttachEventHandlers();55 RegisterEventHandlers(); 56 56 } 57 57 58 58 [StorableHook(HookType.AfterDeserialization)] 59 private void AttachEventHandlers() { 59 private void AfterDeserialization() { 60 RegisterEventHandlers(); 61 } 62 63 private void RegisterEventHandlers() { 60 64 QualitiesParameter.DepthChanged += new EventHandler(QualitiesParameter_DepthChanged); 61 65 } -
trunk/sources/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r7259 r7351 121 121 [StorableHook(HookType.AfterDeserialization)] 122 122 private void AfterDeserialization() { 123 AttachEventHandlers();123 RegisterEventHandlers(); 124 124 } 125 125 public UserDefinedProblem() … … 132 132 Parameters.Add(new ValueParameter<ItemList<IOperator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>())); 133 133 134 AttachEventHandlers();134 RegisterEventHandlers(); 135 135 } 136 136 137 137 private UserDefinedProblem(UserDefinedProblem original, Cloner cloner) 138 138 : base(original, cloner) { 139 AttachEventHandlers();139 RegisterEventHandlers(); 140 140 } 141 141 public override IDeepCloneable Clone(Cloner cloner) { … … 194 194 195 195 #region Helpers 196 private void AttachEventHandlers() {196 private void RegisterEventHandlers() { 197 197 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 198 198 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.4/ArtificialAntProblem.cs
r7259 r7351 151 151 [StorableHook(HookType.AfterDeserialization)] 152 152 private void AfterDeserialization() { 153 AttachEventHandlers();153 RegisterEventHandlers(); 154 154 } 155 155 156 156 private ArtificialAntProblem(ArtificialAntProblem original, Cloner cloner) 157 157 : base(original, cloner) { 158 AttachEventHandlers();158 RegisterEventHandlers(); 159 159 } 160 160 public override IDeepCloneable Clone(Cloner cloner) { … … 179 179 Evaluator.QualityParameter.ActualName = "FoodEaten"; 180 180 InitializeOperators(); 181 AttachEventHandlers();181 RegisterEventHandlers(); 182 182 } 183 183 … … 212 212 213 213 #region Helpers 214 private void AttachEventHandlers() {214 private void RegisterEventHandlers() { 215 215 SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged); 216 216 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs
r7259 r7351 127 127 [StorableConstructor] 128 128 private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { } 129 [StorableHook(HookType.AfterDeserialization)]130 private void AfterDeserializationHook() {131 AttachEventHandlers();132 }133 134 129 private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) 135 130 : base(original, cloner) { 136 AttachEventHandlers();131 RegisterEventHandlers(); 137 132 } 138 133 public override IDeepCloneable Clone(Cloner cloner) { … … 154 149 155 150 InitializeOperators(); 156 AttachEventHandlers();151 RegisterEventHandlers(); 157 152 } 158 153 [StorableHook(HookType.AfterDeserialization)] … … 170 165 } 171 166 #endregion 167 RegisterEventHandlers(); 172 168 } 173 169 … … 220 216 221 217 #region Helper 222 private void AttachEventHandlers() {218 private void RegisterEventHandlers() { 223 219 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 224 220 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs
r7259 r7351 52 52 [StorableHook(HookType.AfterDeserialization)] 53 53 private void AfterDeserialization() { 54 AttachEventHandlers(); 54 // BackwardsCompatibility3.3 55 #region Backwards compatible code, remove with 3.4 56 #pragma warning disable 0612 57 if (converters != null) { 58 if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>(); 59 foreach (IItemToSolutionMessageConverter c in converters) 60 convertersList.Add(c); 61 converters.Clear(); 62 converters = null; 63 } 64 #pragma warning restore 0612 65 #endregion 66 RegisterEventHandlers(); 55 67 } 56 68 … … 58 70 : base(original, cloner) { 59 71 convertersList = cloner.Clone(original.convertersList); 60 AttachEventHandlers();72 RegisterEventHandlers(); 61 73 } 62 74 public override IDeepCloneable Clone(Cloner cloner) { … … 75 87 convertersList.Add(new TimeSpanValueConverter()); 76 88 77 AttachEventHandlers();89 RegisterEventHandlers(); 78 90 } 79 91 … … 93 105 } 94 106 95 private void AttachEventHandlers() { 96 // BackwardsCompatibility3.3 97 #region Backwards compatible code, remove with 3.4 98 #pragma warning disable 0612 99 if (converters != null) { 100 if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>(); 101 foreach (IItemToSolutionMessageConverter c in converters) 102 convertersList.Add(c); 103 converters.Clear(); 104 converters = null; 105 } 106 #pragma warning restore 0612 107 #endregion 107 private void RegisterEventHandlers() { 108 108 convertersList.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed); 109 109 convertersList.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed); -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r7259 r7351 100 100 private KnapsackProblem(KnapsackProblem original, Cloner cloner) 101 101 : base(original, cloner) { 102 AttachEventHandlers();102 RegisterEventHandlers(); 103 103 } 104 104 public override IDeepCloneable Clone(Cloner cloner) { … … 124 124 125 125 InitializeOperators(); 126 AttachEventHandlers();126 RegisterEventHandlers(); 127 127 } 128 128 … … 194 194 if (Operators.Count == 0) InitializeOperators(); 195 195 #endregion 196 AttachEventHandlers();197 } 198 199 private void AttachEventHandlers() {196 RegisterEventHandlers(); 197 } 198 199 private void RegisterEventHandlers() { 200 200 SolutionCreator.BinaryVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_BinaryVectorParameter_ActualNameChanged); 201 201 KnapsackCapacityParameter.ValueChanged += new EventHandler(KnapsackCapacityParameter_ValueChanged); -
trunk/sources/HeuristicLab.Problems.OneMax/3.3/OnemaxProblem.cs
r7259 r7351 72 72 private OneMaxProblem(OneMaxProblem original, Cloner cloner) 73 73 : base(original, cloner) { 74 AttachEventHandlers();74 RegisterEventHandlers(); 75 75 } 76 76 public OneMaxProblem() … … 88 88 89 89 InitializeOperators(); 90 AttachEventHandlers();90 RegisterEventHandlers(); 91 91 } 92 92 … … 140 140 if (Operators.Count == 0) InitializeOperators(); 141 141 #endregion 142 AttachEventHandlers();142 RegisterEventHandlers(); 143 143 } 144 144 145 private void AttachEventHandlers() {145 private void RegisterEventHandlers() { 146 146 SolutionCreator.BinaryVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_BinaryVectorParameter_ActualNameChanged); 147 147 LengthParameter.ValueChanged += new EventHandler(LengthParameter_ValueChanged); -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r7259 r7351 109 109 private QuadraticAssignmentProblem(QuadraticAssignmentProblem original, Cloner cloner) 110 110 : base(original, cloner) { 111 AttachEventHandlers();111 RegisterEventHandlers(); 112 112 } 113 113 public QuadraticAssignmentProblem() … … 142 142 143 143 InitializeOperators(); 144 AttachEventHandlers();144 RegisterEventHandlers(); 145 145 } 146 146 … … 165 165 Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distance matrix which can either be specified directly without the coordinates, or can be calculated automatically from the coordinates.", d)); 166 166 } 167 AttachEventHandlers();167 RegisterEventHandlers(); 168 168 #endregion 169 169 } … … 254 254 255 255 #region Helpers 256 private void AttachEventHandlers() {256 private void RegisterEventHandlers() { 257 257 SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged); 258 258 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r7259 r7351 92 92 strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover); 93 93 strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator); 94 AttachEventHandlers();94 RegisterEventHandlers(); 95 95 } 96 96 public SingleObjectiveTestFunctionProblem() … … 115 115 116 116 InitializeOperators(); 117 AttachEventHandlers();117 RegisterEventHandlers(); 118 118 UpdateStrategyVectorBounds(); 119 119 } … … 232 232 if (Operators.Count == 0) InitializeOperators(); 233 233 #endregion 234 AttachEventHandlers();235 } 236 237 private void AttachEventHandlers() {234 RegisterEventHandlers(); 235 } 236 237 private void RegisterEventHandlers() { 238 238 ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged); 239 239 ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged); -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r7259 r7351 100 100 private TravelingSalesmanProblem(TravelingSalesmanProblem original, Cloner cloner) 101 101 : base(original, cloner) { 102 AttachEventHandlers();102 RegisterEventHandlers(); 103 103 } 104 104 public override IDeepCloneable Clone(Cloner cloner) { … … 130 130 131 131 InitializeOperators(); 132 AttachEventHandlers();132 RegisterEventHandlers(); 133 133 } 134 134 … … 197 197 if (Operators.Count == 0) InitializeOperators(); 198 198 #endregion 199 AttachEventHandlers();200 } 201 202 private void AttachEventHandlers() {199 RegisterEventHandlers(); 200 } 201 202 private void RegisterEventHandlers() { 203 203 CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged); 204 204 Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPSolutionAnalyzer.cs
r7259 r7351 125 125 126 126 [StorableHook(HookType.AfterDeserialization)] 127 private void AfterDeserializationHook() { 128 #region Backwards Compatibility 127 private void AfterDeserialization() { 128 // BackwardsCompatibility3.3 129 #region Backwards compatible code, remove with 3.4 129 130 if (!Parameters.ContainsKey("BestKnownQuality")) { 130 131 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance.")); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r7259 r7351 155 155 private VehicleRoutingProblem(VehicleRoutingProblem original, Cloner cloner) 156 156 : base(original, cloner) { 157 AttachEventHandlers();157 RegisterEventHandlers(); 158 158 } 159 159 public VehicleRoutingProblem() … … 187 187 188 188 InitializeOperators(); 189 AttachEventHandlers();189 RegisterEventHandlers(); 190 190 } 191 191 … … 355 355 #region Helpers 356 356 [StorableHook(HookType.AfterDeserialization)] 357 private void AfterDeserializationHook() { 358 #region Backwards Compatibility 357 private void AfterDeserialization() { 358 // BackwardsCompatibility3.3 359 #region Backwards compatible code, remove with 3.4 359 360 if (!Parameters.ContainsKey("BestKnownSolution")) { 360 361 Parameters.Add(new OptionalValueParameter<IVRPEncoding>("BestKnownSolution", "The best known solution of this TSP instance.")); … … 362 363 #endregion 363 364 364 AttachEventHandlers();365 } 366 367 private void AttachEventHandlers() {365 RegisterEventHandlers(); 366 } 367 368 private void RegisterEventHandlers() { 368 369 CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged); 369 370 Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
Note: See TracChangeset
for help on using the changeset viewer.