Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/10 02:08:30 (15 years ago)
Author:
abeham
Message:

#893

  • fixed wiring in the algorithms
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r3671 r3689  
    136136      get { return (SimulatedAnnealingMainLoop)SolutionsCreator.Successor; }
    137137    }
    138 
    139     private List<IDiscreteDoubleValueModifier> annealingOperators;
    140     private IEnumerable<IDiscreteDoubleValueModifier> AnnealingOperators {
    141       get { return annealingOperators; }
    142     }
     138    [Storable]
    143139    private QualityAnalyzer qualityAnalyzer;
    144140    #endregion
     
    186182      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    187183
     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
    188192      Initialize();
    189193    }
     
    191195    public override IDeepCloneable Clone(Cloner cloner) {
    192196      SimulatedAnnealing clone = (SimulatedAnnealing)base.Clone(cloner);
     197      clone.qualityAnalyzer = (QualityAnalyzer)cloner.Clone(qualityAnalyzer);
    193198      clone.Initialize();
    194199      return clone;
     
    276281    [StorableHook(HookType.AfterDeserialization)]
    277282    private void Initialize() {
    278       InitializeAnalyzers();
    279       UpdateAnalyzers();
    280283      if (Problem != null) {
    281284        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     
    286289      MoveGeneratorParameter.ValueChanged += new EventHandler(MoveGeneratorParameter_ValueChanged);
    287290      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();
    301291    }
    302292    private void UpdateMoveGenerator() {
     
    383373    }
    384374    private void ParameterizeAnnealingOperators() {
    385       foreach (IDiscreteDoubleValueModifier op in annealingOperators) {
     375      foreach (IDiscreteDoubleValueModifier op in AnnealingOperatorParameter.ValidValues) {
    386376        op.IndexParameter.ActualName = "Iterations";
    387377        op.StartIndexParameter.Value = new IntValue(0);
Note: See TracChangeset for help on using the changeset viewer.