Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12071 for branches


Ignore:
Timestamp:
02/25/15 15:05:56 (10 years ago)
Author:
pfleck
Message:

#2269

  • Added analyzers in Analyzers and LayerAnalyzers are now configured automatically (depth of scope tree parameters).
  • Renamed per layer results to LayerResults.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs

    r12048 r12071  
    2424using System.Linq;
    2525using HeuristicLab.Analysis;
     26using HeuristicLab.Collections;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
     
    6061      get { return (IValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
    6162    }
    62     private IValueParameter<MultiAnalyzer> AnalyzerParameter {
    63       get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    64     }
    65     private IValueParameter<MultiAnalyzer> LayerAnalyzerParameter {
    66       get { return (IValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; }
     63    private IFixedValueParameter<MultiAnalyzer> AnalyzerParameter {
     64      get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     65    }
     66    private IFixedValueParameter<MultiAnalyzer> LayerAnalyzerParameter {
     67      get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; }
    6768    }
    6869    private IValueParameter<IntValue> NumberOfLayersParameter {
     
    124125    public MultiAnalyzer Analyzer {
    125126      get { return AnalyzerParameter.Value; }
    126       set { AnalyzerParameter.Value = value; }
    127127    }
    128128    public MultiAnalyzer LayerAnalyzer {
    129129      get { return LayerAnalyzerParameter.Value; }
    130       set { LayerAnalyzerParameter.Value = value; }
    131130    }
    132131    public IntValue NumberOfLayers {
     
    227226      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    228227      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    229       Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
    230       Parameters.Add(new ValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
     228      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
     229      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
    231230      Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "The number of layers.", new IntValue(10)));
    232231      Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 })));
     
    407406      RecalculateAgeLimits();
    408407    }
     408    private void AnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     409      foreach (var analyzer in e.Items) {
     410        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     411          parameter.Depth = 2;
     412        }
     413      }
     414    }
     415    private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
     416      foreach (var analyzer in e.Items) {
     417        IParameter resultParameter;
     418        if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
     419          var lookupParameter = resultParameter as ILookupParameter<ResultCollection>;
     420          if (lookupParameter != null)
     421            lookupParameter.ActualName = "LayerResults";
     422        }
     423        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
     424          parameter.Depth = 1;
     425        }
     426      }
     427    }
    409428    #endregion
    410429
     
    423442      NumberOfLayersParameter.ValueChanged += NumberOfLayersParameter_ValueChanged;
    424443      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
     444      Analyzer.Operators.ItemsAdded += AnalyzerOperators_ItemsAdded;
     445      LayerAnalyzer.Operators.ItemsAdded += LayerAnalyzerOperators_ItemsAdded;
    425446    }
    426447    private void ParameterizeSolutionsCreator() {
     
    546567      if (Problem != null) {
    547568        foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) {
    548           foreach (var parameter in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
    549             parameter.Depth = 2;
    550569          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
    551570        }
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r12045 r12071  
    113113
    114114      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions"));
    115       layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results"));
     115      layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults"));
    116116      layerVariableCreator.Successor = initLayerAnalyzerPlaceholder;
    117117
     
    123123
    124124      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    125       resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "Results"));
     125      resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults"));
    126126      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
    127127      resultsCollector.CopyValue = new BoolValue(false);
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs

    r12036 r12071  
    138138      incrEvaluatedSolutionsForNewLayer.Successor = mainOperator;
    139139
    140       newResultCollectionAssigner.LeftSideParameter.ActualName = "Results";
     140      newResultCollectionAssigner.LeftSideParameter.ActualName = "LayerResults";
    141141      newResultCollectionAssigner.RightSideParameter.Value = new ResultCollection();
    142142      newResultCollectionAssigner.Successor = mainOperator;
     
    147147      incrOpenLayers.Successor = newLayerResultsCollector;
    148148
    149       newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "Results"));
     149      newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults"));
    150150      newLayerResultsCollector.CopyValue = new BoolValue(false);
    151151      newLayerResultsCollector.Successor = null;
Note: See TracChangeset for help on using the changeset viewer.