Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/10/10 17:19:34 (15 years ago)
Author:
abeham
Message:

#893

  • Fixed wiring of iteration based operators like the michalewicz manipulators for real vector encoding
Location:
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3
Files:
4 edited

Legend:

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

    r3680 r3750  
    213213      ParameterizeSelectors();
    214214      ParameterizeAnalyzers();
     215      ParameterizeIterationBasedOperators();
    215216      UpdateCrossovers();
    216217      UpdateMutators();
     
    236237    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    237238      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     239      ParameterizeIterationBasedOperators();
    238240      UpdateCrossovers();
    239241      UpdateMutators();
     
    307309        qualityAnalyzer.QualityParameter.Depth = 1;
    308310        qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
     311      }
     312    }
     313    private void ParameterizeIterationBasedOperators() {
     314      if (Problem != null) {
     315        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
     316          op.IterationsParameter.ActualName = "Generations";
     317          op.MaximumIterationsParameter.ActualName = "MaximumGenerations";
     318        }
    309319      }
    310320    }
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs

    r3715 r3750  
    130130      ConditionalBranch conditionalBranch = new ConditionalBranch();
    131131
    132       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
     132      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations
    133133
    134134      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r3704 r3750  
    304304      ParameterizeSelectors();
    305305      ParameterizeAnalyzers();
     306      ParameterizeIterationBasedOperators();
    306307      UpdateCrossovers();
    307308      UpdateMutators();
     
    327328    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
    328329      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     330      ParameterizeIterationBasedOperators();
    329331      UpdateCrossovers();
    330332      UpdateMutators();
     
    431433      }
    432434    }
     435    private void ParameterizeIterationBasedOperators() {
     436      if (Problem != null) {
     437        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
     438          op.IterationsParameter.ActualName = "Generations";
     439          op.MaximumIterationsParameter.ActualName = "MaximumGenerations";
     440        }
     441      }
     442    }
    433443    private void UpdateCrossovers() {
    434444      ICrossover oldCrossover = CrossoverParameter.Value;
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r3715 r3750  
    177177      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
    178178      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
    179       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
     179      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class IslandGeneticAlgorithm expects this to be called Generations
    180180
    181181      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
Note: See TracChangeset for help on using the changeset viewer.