Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7392


Ignore:
Timestamp:
01/22/12 22:02:38 (13 years ago)
Author:
ascheibe
Message:

#1745 implemented reviewing comments for the data reducer and the local random generator

Location:
branches/HiveHiveEngine
Files:
2 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r7391 r7392  
    297297      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
    298298
    299       foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)) {
    300         var stochasticOperator = selector as IStochasticOperator;
    301         if (stochasticOperator != null)
    302           stochasticOperator.RandomParameter.ActualName = "Global Random";
     299      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
    303300        EmigrantsSelectorParameter.ValidValues.Add(selector);
    304       }
    305301
    306302      foreach (IReplacer replacer in ApplicationManager.Manager.GetInstances<IReplacer>().OrderBy(x => x.Name))
  • branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithm.cs

    r7322 r7392  
    242242      OperatorGraph.InitialOperator = randomCreator;
    243243
    244       randomCreator.RandomParameter.ActualName = "Random";
     244      randomCreator.RandomParameter.ActualName = "GlobalRandom";
    245245      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
    246246      randomCreator.SeedParameter.Value = null;
     
    418418      }
    419419    }
     420    private void ParameterizeStochasticOperatorForIsland(IOperator op) {
     421      IStochasticOperator stochasticOp = op as IStochasticOperator;
     422      if (stochasticOp != null) {
     423        stochasticOp.RandomParameter.ActualName = "LocalRandom";
     424        stochasticOp.RandomParameter.Hidden = true;
     425      }
     426    }
    420427    private void ParameterizeSelectors() {
    421428      foreach (ISelector selector in SelectorParameter.ValidValues) {
     
    423430        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize.Value - Elites.Value));
    424431        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
    425         ParameterizeStochasticOperator(selector);
     432        ParameterizeStochasticOperatorForIsland(selector);
    426433      }
    427434      foreach (ISelector selector in EmigrantsSelectorParameter.ValidValues) {
     
    491498      ICrossover oldCrossover = CrossoverParameter.Value;
    492499      CrossoverParameter.ValidValues.Clear();
    493       foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
     500      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name)) {
     501        ParameterizeStochasticOperatorForIsland(crossover);
    494502        CrossoverParameter.ValidValues.Add(crossover);
     503      }
    495504      if (oldCrossover != null) {
    496505        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
     
    501510      IManipulator oldMutator = MutatorParameter.Value;
    502511      MutatorParameter.ValidValues.Clear();
    503       foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
     512      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name)) {
     513        ParameterizeStochasticOperatorForIsland(mutator);
    504514        MutatorParameter.ValidValues.Add(mutator);
     515      }
    505516      if (oldMutator != null) {
    506517        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
  • branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithmMainLoop.cs

    r7391 r7392  
    158158      VariableCreator islandVariableCreator = new VariableCreator();
    159159      Placeholder islandAnalyzer1 = new Placeholder();
    160       SubScopesRandomCreator subScopesRandomCreator = new SubScopesRandomCreator();
     160      LocalRandomGenerator localRandomGenerator = new LocalRandomGenerator();
    161161      Placeholder analyzer1 = new Placeholder();
    162162      ResultsCollector resultsCollector1 = new ResultsCollector();
     
    182182      Comparator checkIslandGenerationsReachedMaximum = new Comparator();
    183183      ConditionalBranch checkContinueEvolution = new ConditionalBranch();
    184       IntDataReducer generationsReducer = new IntDataReducer();
    185       IntDataReducer evaluatedSolutionsReducer = new IntDataReducer();
     184      DataReducer generationsReducer = new DataReducer();
     185      DataReducer evaluatedSolutionsReducer = new DataReducer();
    186186      Placeholder islandAnalyzer2 = new Placeholder();
    187187      UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor();
     
    234234
    235235      stochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
    236       stochasticBranch.RandomParameter.ActualName = RandomParameter.Name;
     236      //set it to the random number generator of the island
     237      stochasticBranch.RandomParameter.ActualName = "LocalRandom";
    237238
    238239      mutator.Name = "Mutator (placeholder)";
     
    312313      uniformSubScopesProcessor0.Successor = analyzer1;
    313314      islandVariableCreator.Successor = islandAnalyzer1;
    314       islandAnalyzer1.Successor = subScopesRandomCreator;
    315       subScopesRandomCreator.Successor = null;
     315      islandAnalyzer1.Successor = localRandomGenerator;
     316      localRandomGenerator.Successor = null;
    316317      analyzer1.Successor = resultsCollector1;
    317318      resultsCollector1.Successor = uniformSubScopesProcessor1;
  • branches/HiveHiveEngine/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r7391 r7392  
    118118    <Compile Include="Assigner.cs" />
    119119    <Compile Include="AlgorithmOperator.cs" />
    120     <Compile Include="SubScopesRandomCreator.cs" />
    121     <Compile Include="IntDataReducer.cs" />
     120    <Compile Include="LocalRandomGenerator.cs" />
     121    <Compile Include="DataReducer.cs" />
    122122    <Compile Include="ReductionOperation.cs" />
    123123    <Compile Include="ReductionOperations.cs" />
Note: See TracChangeset for help on using the changeset viewer.