Changeset 3689 for trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
- Timestamp:
- 05/07/10 02:08:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r3671 r3689 136 136 get { return (SimulatedAnnealingMainLoop)SolutionsCreator.Successor; } 137 137 } 138 139 private List<IDiscreteDoubleValueModifier> annealingOperators; 140 private IEnumerable<IDiscreteDoubleValueModifier> AnnealingOperators { 141 get { return annealingOperators; } 142 } 138 [Storable] 143 139 private QualityAnalyzer qualityAnalyzer; 144 140 #endregion … … 186 182 mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 187 183 184 foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name)) 185 AnnealingOperatorParameter.ValidValues.Add(op); 186 ParameterizeAnnealingOperators(); 187 188 qualityAnalyzer = new QualityAnalyzer(); 189 ParameterizeAnalyzers(); 190 UpdateAnalyzers(); 191 188 192 Initialize(); 189 193 } … … 191 195 public override IDeepCloneable Clone(Cloner cloner) { 192 196 SimulatedAnnealing clone = (SimulatedAnnealing)base.Clone(cloner); 197 clone.qualityAnalyzer = (QualityAnalyzer)cloner.Clone(qualityAnalyzer); 193 198 clone.Initialize(); 194 199 return clone; … … 276 281 [StorableHook(HookType.AfterDeserialization)] 277 282 private void Initialize() { 278 InitializeAnalyzers();279 UpdateAnalyzers();280 283 if (Problem != null) { 281 284 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); … … 286 289 MoveGeneratorParameter.ValueChanged += new EventHandler(MoveGeneratorParameter_ValueChanged); 287 290 MoveEvaluatorParameter.ValueChanged += new EventHandler(MoveEvaluatorParameter_ValueChanged); 288 InitializeAnnealingOperators();289 }290 private void InitializeAnnealingOperators() {291 annealingOperators = new List<IDiscreteDoubleValueModifier>();292 annealingOperators.AddRange(ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name));293 ParameterizeAnnealingOperators();294 AnnealingOperatorParameter.ValidValues.Clear();295 foreach (IDiscreteDoubleValueModifier op in annealingOperators)296 AnnealingOperatorParameter.ValidValues.Add(op);297 }298 private void InitializeAnalyzers() {299 qualityAnalyzer = new QualityAnalyzer();300 ParameterizeAnalyzers();301 291 } 302 292 private void UpdateMoveGenerator() { … … 383 373 } 384 374 private void ParameterizeAnnealingOperators() { 385 foreach (IDiscreteDoubleValueModifier op in annealingOperators) {375 foreach (IDiscreteDoubleValueModifier op in AnnealingOperatorParameter.ValidValues) { 386 376 op.IndexParameter.ActualName = "Iterations"; 387 377 op.StartIndexParameter.Value = new IntValue(0);
Note: See TracChangeset
for help on using the changeset viewer.