Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13777


Ignore:
Timestamp:
04/21/16 13:22:21 (8 years ago)
Author:
pkuelzer
Message:

#2558 added wiring of island alps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorithm.cs

    r13723 r13777  
    366366      #region parametrize
    367367
     368      UpdateAnalyzers();
    368369      ParameterizeAnalyzers();
    369       UpdateAnalyzers();
     370
    370371      ParameterizeSelectors();
    371372      UpdateTerminators();
     
    432433    #region events
    433434
     435    protected override void RegisterProblemEvents() {
     436      base.RegisterProblemEvents();
     437      var maximizationParameter = (IValueParameter<BoolValue>)Problem.MaximizationParameter;
     438      if (maximizationParameter != null) maximizationParameter.ValueChanged += MaximizationParameter_ValueChanged;
     439    }
     440    protected override void DeregisterProblemEvents() {
     441      var maximizationParameter = (IValueParameter<BoolValue>)Problem.MaximizationParameter;
     442      if (maximizationParameter != null) maximizationParameter.ValueChanged -= MaximizationParameter_ValueChanged;
     443      base.DeregisterProblemEvents();
     444    }
     445
    434446    protected override void OnProblemChanged() {
    435447      base.OnProblemChanged();
     
    444456      ParameterizeSelectors();
    445457      ParameterizeAnalyzers();
     458      ParameterizeTerminators();
    446459      ParameterizeIterationBasedOperators();
     460
     461      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    447462
    448463      UpdateAnalyzers();
     
    454469    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
    455470      base.Problem_SolutionCreatorChanged(sender, e);
     471
    456472      ParameterizeStochasticOperator(Problem.SolutionCreator);
     473      ParameterizeStochasticOperatorForLayer(Problem.Evaluator);
     474
     475      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
     476
    457477      ParameterizeSolutionsCreator();
    458     }
    459 
     478      ParameterizeAnalyzers();
     479    }
    460480    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
    461481      base.Problem_EvaluatorChanged(sender, e);
     
    475495      UpdateTerminators();
    476496    }
    477 
    478497    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    479498      base.Problem_OperatorsChanged(sender, e);
     499      ParameterizeIterationBasedOperators();
     500      UpdateCrossovers();
     501      UpdateMutators();
    480502      UpdateAnalyzers();
    481503      UpdateTerminators();
     504    }
     505
     506    private void GroupAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     507      foreach (var analyzer in e.Items) {
     508        IParameter resultParameter;
     509        if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
     510          var lookupParameter = resultParameter as ILookupParameter;
     511          if (lookupParameter != null)
     512            lookupParameter.ActualName = "GroupResults";
     513        }
     514        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     515          parameter.Depth = 1;
     516        }
     517      }
     518    }
     519    private void IslandAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     520      foreach (var analyzer in e.Items) {
     521        IParameter resultParameter;
     522        if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
     523          var lookupParameter = resultParameter as ILookupParameter;
     524          if (lookupParameter != null)
     525            lookupParameter.ActualName = "IslandResults";
     526        }
     527        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     528          parameter.Depth = 2;
     529        }
     530      }
     531    }
     532    private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     533      foreach (var analyzer in e.Items) {
     534        IParameter resultParameter;
     535        if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
     536          var lookupParameter = resultParameter as ILookupParameter;
     537          if (lookupParameter != null)
     538            lookupParameter.ActualName = "LayerResults";
     539        }
     540        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     541          parameter.Depth = 1;
     542        }
     543      }
     544    }
     545    private void AnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     546      foreach (var analyzer in e.Items) {
     547        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     548          parameter.Depth = 3;
     549        }
     550      }
     551    }
     552
     553    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
     554      ParameterizeMainLoop();
     555      ParameterizeSelectors();
     556      ParameterizeAnalyzers();
     557    }
     558    private void MaximizationParameter_ValueChanged(object sender, EventArgs e) {
     559      ParameterizeTerminators();
     560    }
     561    private void QualityAnalyzer_CurrentBestQualityParameter_NameChanged(object sender, EventArgs e) {
     562      ParameterizeTerminators();
     563    }
     564    private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
     565      ParameterizeSelectors();
     566    }
     567
     568    private void Elites_ValueChanged(object sender, EventArgs e) {
     569      ParameterizeSelectors();
     570    }
     571
     572    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
     573      ParameterizeSelectors();
     574    }
     575
     576    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
     577      ParameterizeSelectors();
     578    }
     579
     580    private void NumberOfLayersParameter_ValueChanged(object sender, EventArgs e) {
     581      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
     582      ParameterizeAgeLimits();
     583    }
     584    private void NumberOfLayers_ValueChanged(object sender, EventArgs e) {
     585      ParameterizeAgeLimits();
     586    }
     587
     588    private void AgeGapParameter_ValueChanged(object sender, EventArgs e) {
     589      AgeGap.ValueChanged += AgeGap_ValueChanged;
     590      ParameterizeAgeLimits();
     591    }
     592
     593    private void AgeGap_ValueChanged(object sender, EventArgs e) {
     594      ParameterizeAgeLimits();
     595    }
     596
     597    private void AgingSchemeParameter_ValueChanged(object sender, EventArgs e) {
     598      AgingScheme.ValueChanged += AgingScheme_ValueChanged;
     599      ParameterizeAgeLimits();
     600    }
     601    private void AgingScheme_ValueChanged(object sender, EventArgs e) {
     602      ParameterizeAgeLimits();
     603    }
     604
     605    private void MigrationRate_ValueChanged(object sender, EventArgs e) {
     606      var migrationSize = (int)Math.Ceiling(MigrationRateParameter.Value.Value * PopulationSize.Value);
     607      foreach (var selector in EmigrantsSelectorParameter.ValidValues) {
     608        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(migrationSize);
     609      }
    482610    }
    483611
     
    593721      NumberOfLayersParameter.ValueChanged += NumberOfLayersParameter_ValueChanged;
    594722      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
    595     }
    596 
    597     private void MigrationRate_ValueChanged(object sender, EventArgs e) {
    598       var migrationSize = (int) Math.Ceiling(MigrationRateParameter.Value.Value*PopulationSize.Value);
    599       foreach (var selector in EmigrantsSelectorParameter.ValidValues) {
    600         selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(migrationSize);
    601       }
    602     }
    603 
    604     private void GroupAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
    605       foreach (var analyzer in e.Items) {
    606         IParameter resultParameter;
    607         if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
    608           var lookupParameter = resultParameter as ILookupParameter;
    609           if (lookupParameter != null)
    610             lookupParameter.ActualName = "GroupResults";
    611         }
    612         foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
    613           parameter.Depth = 1;
    614         }
    615       }
    616     }
    617 
    618     private void IslandAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
    619       foreach (var analyzer in e.Items) {
    620         IParameter resultParameter;
    621         if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
    622           var lookupParameter = resultParameter as ILookupParameter;
    623           if (lookupParameter != null)
    624             lookupParameter.ActualName = "IslandResults";
    625         }
    626         foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
    627           parameter.Depth = 2;
    628         }
    629       }
    630     }
    631 
    632     private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
    633       foreach (var analyzer in e.Items) {
    634         IParameter resultParameter;
    635         if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
    636           var lookupParameter = resultParameter as ILookupParameter;
    637           if (lookupParameter != null)
    638             lookupParameter.ActualName = "LayerResults";
    639         }
    640         foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
    641           parameter.Depth = 1;
    642         }
    643       }
    644     }
    645 
    646     private void AnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
    647       foreach (var analyzer in e.Items) {
    648         foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
    649           parameter.Depth = 3;
    650         }
    651       }
    652     }
    653 
    654     private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    655       ParameterizeMainLoop();
    656       ParameterizeSelectors();
    657       ParameterizeAnalyzers();
    658     }
    659 
    660     private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
    661       ParameterizeSelectors();
    662     }
    663 
    664     private void Elites_ValueChanged(object sender, EventArgs e) {
    665       ParameterizeSelectors();
    666     }
    667 
    668     private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
    669       ParameterizeSelectors();
    670     }
    671 
    672     private void PopulationSize_ValueChanged(object sender, EventArgs e) {
    673       ParameterizeSelectors();
    674     }
    675 
    676     private void NumberOfLayersParameter_ValueChanged(object sender, EventArgs e) {
    677       NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
    678       ParameterizeAgeLimits();
    679     }
    680 
    681     private void NumberOfLayers_ValueChanged(object sender, EventArgs e) {
    682       ParameterizeAgeLimits();
    683     }
    684 
    685     private void AgeGapParameter_ValueChanged(object sender, EventArgs e) {
    686       AgeGap.ValueChanged += AgeGap_ValueChanged;
    687       ParameterizeAgeLimits();
    688     }
    689 
    690     private void AgeGap_ValueChanged(object sender, EventArgs e) {
    691       ParameterizeAgeLimits();
    692     }
    693 
    694     private void AgingSchemeParameter_ValueChanged(object sender, EventArgs e) {
    695       AgingScheme.ValueChanged += AgingScheme_ValueChanged;
    696       ParameterizeAgeLimits();
    697     }
    698 
    699     private void AgingScheme_ValueChanged(object sender, EventArgs e) {
    700       ParameterizeAgeLimits();
    701     }
    702 
     723      qualityAnalyzer.CurrentBestQualityParameter.NameChanged += QualityAnalyzer_CurrentBestQualityParameter_NameChanged;
     724
     725    }
    703726    private void ParameterizeAgeLimits() {
    704727      var scheme = AgingScheme.Value;
Note: See TracChangeset for help on using the changeset viewer.