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:
5 edited

Legend:

Unmodified
Added
Removed
  • stable

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

    r9456 r9673  
    7979      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    8080    }
     81    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     82      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     83    }
    8184    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
    8285      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     
    119122      get { return ElitesParameter.Value; }
    120123      set { ElitesParameter.Value = value; }
     124    }
     125    public bool ReevaluteElites {
     126      get { return ReevaluateElitesParameter.Value.Value; }
     127      set { ReevaluateElitesParameter.Value.Value = value; }
    121128    }
    122129    public MultiAnalyzer Analyzer {
     
    151158      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    152159      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     160      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
    153161      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
    154162      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
     
    182190      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    183191      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     192      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    184193      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
    185194      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
     
    207216    [StorableHook(HookType.AfterDeserialization)]
    208217    private void AfterDeserialization() {
     218      // BackwardsCompatibility3.3
     219      #region Backwards compatible code, remove with 3.4
     220      if (!Parameters.ContainsKey("ReevaluateElites")) {
     221        Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });
     222      }
     223      #endregion
     224
    209225      Initialize();
    210226    }
     227
     228
    211229
    212230    private GeneticAlgorithm(GeneticAlgorithm original, Cloner cloner)
  • 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)
  • stable/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r9456 r9673  
    100100      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    101101    }
     102    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     103      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     104    }
    102105    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
    103106      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     
    168171      get { return ElitesParameter.Value; }
    169172      set { ElitesParameter.Value = value; }
     173    }
     174    public bool ReevaluteElites {
     175      get { return ReevaluateElitesParameter.Value.Value; }
     176      set { ReevaluateElitesParameter.Value.Value = value; }
    170177    }
    171178    public MultiAnalyzer Analyzer {
     
    199206    [StorableHook(HookType.AfterDeserialization)]
    200207    private void AfterDeserialization() {
     208      // BackwardsCompatibility3.3
     209      #region Backwards compatible code, remove with 3.4
     210      if (!Parameters.ContainsKey("ReevaluateElites")) {
     211        Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });
     212      }
     213      #endregion
     214
    201215      Initialize();
    202216    }
     
    228242      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    229243      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     244      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
    230245      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
    231246      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
     
    301316      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    302317      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     318      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    303319      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    304320      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
  • stable/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r9456 r9673  
    9191    public ValueLookupParameter<IntValue> ElitesParameter {
    9292      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
     93    }
     94    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     95      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
    9396    }
    9497    public ValueLookupParameter<ResultCollection> ResultsParameter {
     
    144147      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
    145148      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     149      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    146150      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
    147151      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the islands."));
     
    194198      Placeholder analyzer2 = new Placeholder();
    195199      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
     200      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
    196201
    197202
     
    305310      generationsTerminationCondition.Name = "Terminate?";
    306311      generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";
     312
     313      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     314      reevaluateElitesBranch.Name = "Reevaluate elites ?";
    307315      #endregion
    308316
     
    345353      evaluator.Successor = null;
    346354      subScopesCounter.Successor = null;
    347       subScopesCounter.Successor = null;
    348355      subScopesProcessor2.Operators.Add(bestSelector);
    349356      subScopesProcessor2.Operators.Add(new EmptyOperator());
     
    351358      mergingReducer.Successor = islandAnalyzer2;
    352359      bestSelector.Successor = rightReducer;
    353       rightReducer.Successor = null;
     360      rightReducer.Successor = reevaluateElitesBranch;
     361      reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor3;
     362      reevaluateElitesBranch.FalseBranch = null;
     363      reevaluateElitesBranch.Successor = null;
    354364      islandAnalyzer2.Successor = islandGenerationsCounter;
    355365      islandGenerationsCounter.Successor = checkIslandGenerationsReachedMaximum;
     
    369379    }
    370380
     381    [StorableHook(HookType.AfterDeserialization)]
     382    private void AfterDeserialization() {
     383      // BackwardsCompatibility3.3
     384      #region Backwards compatible code, remove with 3.4
     385      if (!Parameters.ContainsKey("ReevaluateElites")) {
     386        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     387      }
     388      #endregion
     389    }
     390
    371391    public override IOperation Apply() {
    372392      if (CrossoverParameter.ActualValue == null)
Note: See TracChangeset for help on using the changeset viewer.