Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 23:27:50 (15 years ago)
Author:
swagner
Message:

Worked on refactoring of algorithm analysis and tracing (#999)

  • removed specific analyzer interfaces
  • adapted MultiAnalyzer
Location:
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
4 edited

Legend:

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

    r3654 r3658  
    121121      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
    122122    }
    123     private ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>> AnalyzerParameter {
    124       get { return (ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>>)Parameters["Analyzer"]; }
    125     }
    126     private ValueParameter<MultiAnalyzer<IPopulationAnalyzer>> IslandAnalyzerParameter {
    127       get { return (ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>)Parameters["IslandAnalyzer"]; }
     123    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     124      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     125    }
     126    private ValueParameter<MultiAnalyzer> IslandAnalyzerParameter {
     127      get { return (ValueParameter<MultiAnalyzer>)Parameters["IslandAnalyzer"]; }
    128128    }
    129129    #endregion
     
    218218      set { OffspringSelectionBeforeMutationParameter.Value = value; }
    219219    }
    220     public MultiAnalyzer<IMultiPopulationAnalyzer> Analyzer {
     220    public MultiAnalyzer Analyzer {
    221221      get { return AnalyzerParameter.Value; }
    222222      set { AnalyzerParameter.Value = value; }
    223223    }
    224     public MultiAnalyzer<IPopulationAnalyzer> IslandAnalyzer {
     224    public MultiAnalyzer IslandAnalyzer {
    225225      get { return IslandAnalyzerParameter.Value; }
    226226      set { IslandAnalyzerParameter.Value = value; }
     
    276276      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
    277277      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false)));
    278       Parameters.Add(new ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer<IMultiPopulationAnalyzer>()));
    279       Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer<IPopulationAnalyzer>()));
     278      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
     279      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
    280280     
    281281      RandomCreator randomCreator = new RandomCreator();
     
    613613      //Analyzer.Operators.Add(qualityAnalyzer);
    614614      if (Problem != null) {
    615         foreach (IPopulationAnalyzer analyzer in Problem.Operators.OfType<IPopulationAnalyzer>().OrderBy(x => x.Name)) {
     615        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) {
    616616          IslandAnalyzer.Operators.Add(analyzer);
    617617        }
    618         foreach (IMultiPopulationAnalyzer analyzer in Problem.Operators.OfType<IMultiPopulationAnalyzer>().OrderBy(x => x.Name))
     618        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name))
    619619          Analyzer.Operators.Add(analyzer);
    620620      }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r3650 r3658  
    101101      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
    102102    }
    103     private ValueParameter<MultiAnalyzer<IPopulationAnalyzer>> AnalyzerParameter {
    104       get { return (ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>)Parameters["Analyzer"]; }
     103    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     104      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    105105    }
    106106    #endregion
     
    171171      set { SelectedParentsParameter.Value = value; }
    172172    }
    173     public MultiAnalyzer<IPopulationAnalyzer> Analyzer {
     173    public MultiAnalyzer Analyzer {
    174174      get { return AnalyzerParameter.Value; }
    175175      set { AnalyzerParameter.Value = value; }
     
    211211      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false)));
    212212      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "Should be about 2 * PopulationSize, for large problems use a smaller value to decrease memory footprint.", new IntValue(200)));
    213       Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer<IPopulationAnalyzer>()));
     213      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
    214214     
    215215      RandomCreator randomCreator = new RandomCreator();
     
    436436      //Analyzer.Operators.Add(qualityAnalyzer);
    437437      if (Problem != null) {
    438         foreach (IPopulationAnalyzer analyzer in Problem.Operators.OfType<IPopulationAnalyzer>().OrderBy(x => x.Name))
     438        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name))
    439439          Analyzer.Operators.Add(analyzer);
    440440      }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r3656 r3658  
    113113      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
    114114    }
    115     private ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>> AnalyzerParameter {
    116       get { return (ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>>)Parameters["Analyzer"]; }
    117     }
    118     private ValueParameter<MultiAnalyzer<IPopulationAnalyzer>> VillageAnalyzerParameter {
    119       get { return (ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>)Parameters["VillageAnalyzer"]; }
     115    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     116      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     117    }
     118    private ValueParameter<MultiAnalyzer> VillageAnalyzerParameter {
     119      get { return (ValueParameter<MultiAnalyzer>)Parameters["VillageAnalyzer"]; }
    120120    }
    121121    #endregion
     
    198198      set { SelectedParentsParameter.Value = value; }
    199199    }
    200     public MultiAnalyzer<IMultiPopulationAnalyzer> Analyzer {
     200    public MultiAnalyzer Analyzer {
    201201      get { return AnalyzerParameter.Value; }
    202202      set { AnalyzerParameter.Value = value; }
    203203    }
    204     public MultiAnalyzer<IPopulationAnalyzer> VillageAnalyzer {
     204    public MultiAnalyzer VillageAnalyzer {
    205205      get { return VillageAnalyzerParameter.Value; }
    206206      set { VillageAnalyzerParameter.Value = value; }
     
    250250      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false)));
    251251      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "Should be about 2 * PopulationSize, for large problems use a smaller value to decrease memory footprint.", new IntValue(200)));
    252       Parameters.Add(new ValueParameter<MultiAnalyzer<IMultiPopulationAnalyzer>>("Analyzer", "The operator used to analyze the villages.", new MultiAnalyzer<IMultiPopulationAnalyzer>()));
    253       Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer<IPopulationAnalyzer>()));
     252      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the villages.", new MultiAnalyzer()));
     253      Parameters.Add(new ValueParameter<MultiAnalyzer>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer()));
    254254     
    255255      RandomCreator randomCreator = new RandomCreator();
     
    523523      //Analyzer.Operators.Add(qualityAnalyzer);
    524524      if (Problem != null) {
    525         foreach (IPopulationAnalyzer analyzer in Problem.Operators.OfType<IPopulationAnalyzer>().OrderBy(x => x.Name)) {
     525        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) {
    526526          VillageAnalyzer.Operators.Add(analyzer);
    527527        }
    528         foreach (IMultiPopulationAnalyzer analyzer in Problem.Operators.OfType<IMultiPopulationAnalyzer>().OrderBy(x => x.Name))
     528        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name))
    529529          Analyzer.Operators.Add(analyzer);
    530530      }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r3656 r3658  
    364364      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    365365      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
    366       resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("ComparisonFactor", null, "ComparisonFactor"));
    367       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Terminated Villages", null, "TerminatedVillages"));
     366      resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("ComparisonFactor", null, "ComparisonFactor"));
     367      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Terminated Villages", null, "TerminatedVillages"));
    368368      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Total Active Villages", null, "VillageCount"));
    369369      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
Note: See TracChangeset for help on using the changeset viewer.