Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9569


Ignore:
Timestamp:
06/03/13 14:39:36 (11 years ago)
Author:
mkommend
Message:

#2038: Added reevaluation of elites in ES, IslandGA, IslandOSGA, OSGA, SASEGASA, and RAPGA.

Location:
trunk/sources
Files:
13 edited

Legend:

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

    r9456 r9569  
    6161      get { return (ValueLookupParameter<BoolValue>)Parameters["PlusSelection"]; }
    6262    }
     63    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     64      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     65    }
    6366    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
    6467      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
     
    121124      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    122125      Parameters.Add(new ValueLookupParameter<BoolValue>("PlusSelection", "True for plus selection (elitist population), false for comma selection (non-elitist population)."));
     126      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    123127      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    124128      Parameters.Add(new ValueLookupParameter<IOperator>("Recombinator", "The operator used to cross solutions."));
     
    162166      Placeholder analyzer2 = new Placeholder();
    163167      ConditionalBranch conditionalBranch = new ConditionalBranch();
     168      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
     169      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     170      UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
     171      Placeholder evaluator2 = new Placeholder();
     172      SubScopesCounter subScopesCounter2 = new SubScopesCounter();
     173
    164174
    165175      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class EvolutionStrategy expects this to be called Generations
     
    235245
    236246      conditionalBranch.ConditionParameter.ActualName = "Terminate";
     247
     248      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     249      reevaluateElitesBranch.Name = "Reevaluate elites ?";
     250
     251      uniformSubScopesProcessor4.Parallel.Value = true;
     252
     253      evaluator2.Name = "Evaluator (placeholder)";
     254      evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name;
     255
     256      subScopesCounter2.Name = "Increment EvaluatedSolutions";
     257      subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    237258      #endregion
    238259
     
    266287      evaluator.Successor = null;
    267288      subScopesCounter.Successor = null;
    268       plusOrCommaReplacementBranch.TrueBranch = plusReplacement;
     289
     290      plusOrCommaReplacementBranch.TrueBranch = reevaluateElitesBranch;
     291      reevaluateElitesBranch.TrueBranch = subScopesProcessor2;
     292      reevaluateElitesBranch.FalseBranch = null;
     293      subScopesProcessor2.Operators.Add(uniformSubScopesProcessor4);
     294      subScopesProcessor2.Operators.Add(new EmptyOperator());
     295      uniformSubScopesProcessor4.Operator = evaluator2;
     296      uniformSubScopesProcessor4.Successor = subScopesCounter2;
     297      subScopesCounter2.Successor = null;
     298      reevaluateElitesBranch.Successor = plusReplacement;
     299
    269300      plusOrCommaReplacementBranch.FalseBranch = commaReplacement;
    270301      plusOrCommaReplacementBranch.Successor = bestSelector;
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r9456 r9569  
    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      if (!Parameters.ContainsKey("ReevaluateElites")) {
     209        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 });
     210      }
    201211      Initialize();
    202212    }
     
    228238      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    229239      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     240      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 });
    230241      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
    231242      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
     
    301312      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    302313      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     314      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    303315      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    304316      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r9456 r9569  
    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      if (!Parameters.ContainsKey("ReevaluateElites")) {
     384        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     385      }
     386    }
     387
    371388    public override IOperation Apply() {
    372389      if (CrossoverParameter.ActualValue == null)
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r9456 r9569  
    100100      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    101101    }
     102    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     103      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     104    }
    102105    private ValueLookupParameter<DoubleValue> SuccessRatioParameter {
    103106      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
     
    192195      get { return ElitesParameter.Value; }
    193196      set { ElitesParameter.Value = value; }
     197    }
     198    public bool ReevaluteElites {
     199      get { return ReevaluateElitesParameter.Value.Value; }
     200      set { ReevaluateElitesParameter.Value.Value = value; }
    194201    }
    195202    private DoubleValue SuccessRatio {
     
    260267      if (successfulOffspringAnalyzer == null)
    261268        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     269      if (!Parameters.ContainsKey("ReevaluateElites")) {
     270        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 });
     271      }
    262272      #endregion
    263273
     
    293303      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    294304      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     305      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 });
    295306      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
    296307      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0)));
     
    355366      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    356367      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     368      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    357369      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    358370      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r9456 r9569  
    9090    public ValueLookupParameter<IntValue> ElitesParameter {
    9191      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
     92    }
     93    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     94      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
    9295    }
    9396    public ValueLookupParameter<ResultCollection> ResultsParameter {
     
    158161      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."));
    159162      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     163      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    160164      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
    161165      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
     
    248252      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    249253      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     254      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    250255      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    251256      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     
    414419    }
    415420
     421    [StorableHook(HookType.AfterDeserialization)]
     422    private void AfterDeserialization() {
     423      if (!Parameters.ContainsKey("ReevaluateElites")) {
     424        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     425      }
     426    }
     427
    416428    public override IOperation Apply() {
    417429      if (CrossoverParameter.ActualValue == null)
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r9456 r9569  
    7979      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    8080    }
     81    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     82      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     83    }
    8184    private ValueParameter<IntValue> MaximumGenerationsParameter {
    8285      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
     
    143146      get { return ElitesParameter.Value; }
    144147      set { ElitesParameter.Value = value; }
     148    }
     149    public bool ReevaluteElites {
     150      get { return ReevaluateElitesParameter.Value.Value; }
     151      set { ReevaluateElitesParameter.Value.Value = value; }
    145152    }
    146153    public IntValue MaximumGenerations {
     
    208215      if (successfulOffspringAnalyzer == null)
    209216        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     217      if (!Parameters.ContainsKey("ReevaluateElites")) {
     218        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 });
     219      }
    210220      #endregion
    211221
     
    232242      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    233243      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 });
    234245      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    235246      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
     
    274285      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    275286      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     287      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    276288      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
    277289      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r9456 r9569  
    6363      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
    6464    }
     65    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     66      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     67    }
    6568    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
    6669      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
     
    106109      : base() {
    107110      Initialize();
     111    }
     112
     113    [StorableHook(HookType.AfterDeserialization)]
     114    private void AfterDeserialization() {
     115      if (!Parameters.ContainsKey("ReevaluateElites")) {
     116        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     117      }
    108118    }
    109119
     
    120130      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."));
    121131      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     132      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    122133      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    123134      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    170181      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    171182      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     183      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    172184      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    173185      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r9456 r9569  
    6767      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
    6868    }
     69    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     70      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     71    }
    6972    public LookupParameter<DoubleValue> ComparisonFactorParameter {
    7073      get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; }
     
    98101      : base() {
    99102      Initialize();
     103    }
     104
     105    [StorableHook(HookType.AfterDeserialization)]
     106    private void AfterDeserialization() {
     107      if (!Parameters.ContainsKey("ReevaluateElites")) {
     108        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     109      }
    100110    }
    101111
     
    112122      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions."));
    113123      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     124      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    114125      Parameters.Add(new LookupParameter<DoubleValue>("ComparisonFactor", "The comparison factor is used to determine whether the offspring should be compared to the better parent, the worse parent or a quality value linearly interpolated between them. It is in the range [0;1]."));
    115126      Parameters.Add(new LookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio."));
     
    159170      LeftReducer leftReducer = new LeftReducer();
    160171      MergingReducer mergingReducer2 = new MergingReducer();
     172      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
     173      UniformSubScopesProcessor uniformSubScopesProcessor7 = new UniformSubScopesProcessor();
     174      Placeholder evaluator4 = new Placeholder();
     175      SubScopesCounter subScopesCounter4 = new SubScopesCounter();
    161176
    162177      selector.Name = "Selector (placeholder)";
     
    253268      worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name;
    254269      worstSelector.QualityParameter.ActualName = QualityParameter.Name;
     270
     271      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     272      reevaluateElitesBranch.Name = "Reevaluate elites ?";
     273
     274      uniformSubScopesProcessor7.Parallel.Value = true;
     275
     276      evaluator4.Name = "Evaluator (placeholder)";
     277      evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name;
     278
     279      subScopesCounter4.Name = "Increment EvaluatedSolutions";
     280      subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    255281      #endregion
    256282
     
    310336      subScopesProcessor3.Successor = mergingReducer2;
    311337      bestSelector.Successor = rightReducer;
    312       rightReducer.Successor = null;
     338      rightReducer.Successor = reevaluateElitesBranch;
     339      reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7;
     340      uniformSubScopesProcessor7.Operator = evaluator4;
     341      uniformSubScopesProcessor7.Successor = subScopesCounter4;
     342      subScopesCounter4.Successor = null;
     343      reevaluateElitesBranch.FalseBranch = null;
     344      reevaluateElitesBranch.Successor = null;
    313345      worstSelector.Successor = leftReducer;
    314346      leftReducer.Successor = null;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r9456 r9569  
    8585      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    8686    }
     87    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     88      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     89    }
    8790    private ValueLookupParameter<DoubleValue> SuccessRatioParameter {
    8891      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
     
    160163      get { return ElitesParameter.Value; }
    161164      set { ElitesParameter.Value = value; }
     165    }
     166    public bool ReevaluteElites {
     167      get { return ReevaluateElitesParameter.Value.Value; }
     168      set { ReevaluateElitesParameter.Value.Value = value; }
    162169    }
    163170    public DoubleValue SuccessRatio {
     
    236243      if (successfulOffspringAnalyzer == null)
    237244        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     245      if (!Parameters.ContainsKey("ReevaluateElites")) {
     246        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 });
     247      }
    238248      #endregion
    239249
     
    264274      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    265275      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     276      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 });
    266277      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
    267278      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0.3)));
     
    321332      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    322333      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     334      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    323335      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    324336      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r9456 r9569  
    7373      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
    7474    }
     75    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     76      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     77    }
    7578    public ValueLookupParameter<ResultCollection> ResultsParameter {
    7679      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     
    134137      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."));
    135138      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     139      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    136140      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
    137141      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the villages."));
     
    236240      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    237241      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     242      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    238243      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    239244      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     
    424429    }
    425430
     431    [StorableHook(HookType.AfterDeserialization)]
     432    private void AfterDeserialization() {
     433      if (!Parameters.ContainsKey("ReevaluateElites")) {
     434        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     435      }
     436    }
     437
    426438    public override IOperation Apply() {
    427439      if (CrossoverParameter.ActualValue == null)
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs

    r9456 r9569  
    9494      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    9595    }
     96    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     97      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     98    }
    9699    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
    97100      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     
    157160      get { return ElitesParameter.Value; }
    158161      set { ElitesParameter.Value = value; }
     162    }
     163    public bool ReevaluteElites {
     164      get { return ReevaluateElitesParameter.Value.Value; }
     165      set { ReevaluateElitesParameter.Value.Value = value; }
    159166    }
    160167    public MultiAnalyzer Analyzer {
     
    192199    private RAPGA(bool deserializing) : base(deserializing) { }
    193200    [StorableHook(HookType.AfterDeserialization)]
    194     private void AfterDeserialization() { Initialize(); }
     201    private void AfterDeserialization() {
     202      if (!Parameters.ContainsKey("ReevaluateElites")) {
     203        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 });
     204      }
     205      Initialize();
     206    }
    195207    private RAPGA(RAPGA original, Cloner cloner)
    196208      : base(original, cloner) {
     
    216228      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    217229      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     230      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 });
    218231      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
    219232      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
     
    248261      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    249262      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     263      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    250264      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
    251265      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGAMainLoop.cs

    r9456 r9569  
    6565      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
    6666    }
     67    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     68      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     69    }
    6770    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
    6871      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
     
    129132      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."));
    130133      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     134      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    131135      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    132136      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    190194      Assigner assigner4 = new Assigner();
    191195      Assigner assigner5 = new Assigner();
     196      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
     197      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
     198      Placeholder evaluator2 = new Placeholder();
     199      SubScopesCounter subScopesCounter4 = new SubScopesCounter();
    192200
    193201      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class RAPGA expects this to be called Generations
     
    338346      assigner5.LeftSideParameter.ActualName = "OffspringList";
    339347      assigner5.RightSideParameter.Value = new ScopeList();
     348
     349      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     350      reevaluateElitesBranch.Name = "Reevaluate elites ?";
     351
     352      uniformSubScopesProcessor2.Parallel.Value = true;
     353
     354      evaluator2.Name = "Evaluator (placeholder)";
     355      evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name;
     356
     357      subScopesCounter4.Name = "Increment EvaluatedSolutions";
     358      subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    340359      #endregion
    341360
     
    378397      subScopesProcessor2.Successor = mergingReducer;
    379398      bestSelector.Successor = rightReducer2;
    380       rightReducer2.Successor = null;
     399      rightReducer2.Successor = reevaluateElitesBranch;
     400      reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor2;
     401      uniformSubScopesProcessor2.Operator = evaluator2;
     402      uniformSubScopesProcessor2.Successor = subScopesCounter4;
     403      evaluator2.Successor = null;
     404      subScopesCounter4.Successor = null;
     405      reevaluateElitesBranch.FalseBranch = null;
     406      reevaluateElitesBranch.Successor = null;
    381407      scopeCleaner.Successor = scopeRestorer;
    382408      mergingReducer.Successor = intCounter3;
Note: See TracChangeset for help on using the changeset viewer.