Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/13 16:56:21 (11 years ago)
Author:
mkommend
Message:

#2038: Merged r9553:9555, r9569, r9591:r9592, r9618 into the stable branch.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs

    r9456 r9673  
    6363    public ValueLookupParameter<IntValue> ElitesParameter {
    6464      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
     65    }
     66    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     67      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
    6568    }
    6669    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
     
    112115      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    113116      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     117      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    114118      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    115119      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    143147      Placeholder analyzer2 = new Placeholder();
    144148      ConditionalBranch conditionalBranch = new ConditionalBranch();
     149      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
    145150
    146151      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations
     
    193198
    194199      conditionalBranch.ConditionParameter.ActualName = "Terminate";
     200
     201      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     202      reevaluateElitesBranch.Name = "Reevaluate elites ?";
    195203      #endregion
    196204
     
    221229      subScopesProcessor2.Successor = mergingReducer;
    222230      bestSelector.Successor = rightReducer;
    223       rightReducer.Successor = null;
     231      rightReducer.Successor = reevaluateElitesBranch;
     232      reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor2;
     233      reevaluateElitesBranch.FalseBranch = null;
     234      reevaluateElitesBranch.Successor = null;
    224235      mergingReducer.Successor = intCounter;
    225236      intCounter.Successor = comparator;
     
    232243    }
    233244
     245    [StorableHook(HookType.AfterDeserialization)]
     246    private void AfterDeserialization() {
     247      // BackwardsCompatibility3.3
     248      #region Backwards compatible code, remove with 3.4
     249      if (!Parameters.ContainsKey("ReevaluateElites")) {
     250        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     251      }
     252      #endregion
     253    }
     254
    234255    public override IOperation Apply() {
    235256      if (CrossoverParameter.ActualValue == null)
Note: See TracChangeset for help on using the changeset viewer.