Changeset 8086 for branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
- Timestamp:
- 06/22/12 11:11:38 (12 years ago)
- Location:
- branches/ScatterSearch (trunk integration)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r7517 r8086 144 144 [Storable] 145 145 private QualityAnalyzer qualityAnalyzer; 146 [Storable] 147 private SingleValueAnalyzer temperatureAnalyzer; 146 148 #endregion 147 149 … … 150 152 [StorableHook(HookType.AfterDeserialization)] 151 153 private void AfterDeserialization() { 154 if (temperatureAnalyzer == null) { 155 temperatureAnalyzer = new SingleValueAnalyzer(); 156 temperatureAnalyzer.Name = "TemperatureAnalyzer"; 157 temperatureAnalyzer.ResultsParameter.ActualName = "Results"; 158 temperatureAnalyzer.ValueParameter.ActualName = "Temperature"; 159 temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart"; 160 Analyzer.Operators.Add(temperatureAnalyzer); 161 } 152 162 Initialize(); 153 163 } … … 155 165 : base(original, cloner) { 156 166 qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); 167 temperatureAnalyzer = cloner.Clone(original.temperatureAnalyzer); 157 168 Initialize(); 158 169 } … … 205 216 mainLoop.AnnealingOperatorParameter.ActualName = AnnealingOperatorParameter.Name; 206 217 mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; 218 mainLoop.TemperatureParameter.ActualName = "Temperature"; 207 219 mainLoop.StartTemperatureParameter.ActualName = StartTemperatureParameter.Name; 208 220 mainLoop.EndTemperatureParameter.ActualName = EndTemperatureParameter.Name; … … 218 230 219 231 qualityAnalyzer = new QualityAnalyzer(); 232 temperatureAnalyzer = new SingleValueAnalyzer(); 233 temperatureAnalyzer.Name = "TemperatureAnalyzer"; 220 234 ParameterizeAnalyzers(); 221 235 UpdateAnalyzers(); … … 233 247 ParameterizeStochasticOperator(Problem.SolutionCreator); 234 248 ParameterizeStochasticOperator(Problem.Evaluator); 235 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);249 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 236 250 foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) { 237 251 op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged); … … 266 280 } 267 281 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 268 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);282 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 269 283 // This may seem pointless, but some operators already have the eventhandler registered, others don't 270 284 // FIXME: Is there another way to solve this problem? … … 348 362 qualityAnalyzer.QualityParameter.Hidden = false; 349 363 qualityAnalyzer.BestKnownQualityParameter.Hidden = false; 364 temperatureAnalyzer.ResultsParameter.ActualName = "Results"; 365 temperatureAnalyzer.ValueParameter.ActualName = "Temperature"; 366 temperatureAnalyzer.ValuesParameter.ActualName = "Temperature Chart"; 350 367 } 351 368 } … … 470 487 } 471 488 Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault); 489 Analyzer.Operators.Add(temperatureAnalyzer, temperatureAnalyzer.EnabledByDefault); 472 490 } 473 491 private SimulatedAnnealingMainLoop FindMainLoop(IOperator start) {
Note: See TracChangeset
for help on using the changeset viewer.