Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/14 12:01:13 (10 years ago)
Author:
ascheibe
Message:

merged trunk into hive statistics branch

Location:
branches/HiveStatistics/sources
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources

  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r8121 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    129132    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
    130133      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     134    }
     135    private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
     136      get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    131137    }
    132138    #endregion
     
    193199      set { ElitesParameter.Value = value; }
    194200    }
    195     private DoubleValue SuccessRatio {
     201    public bool ReevaluteElites {
     202      get { return ReevaluateElitesParameter.Value.Value; }
     203      set { ReevaluateElitesParameter.Value.Value = value; }
     204    }
     205    public DoubleValue SuccessRatio {
    196206      get { return SuccessRatioParameter.Value; }
    197207      set { SuccessRatioParameter.Value = value; }
    198208    }
    199     private DoubleValue ComparisonFactorLowerBound {
     209    public DoubleValue ComparisonFactorLowerBound {
    200210      get { return ComparisonFactorLowerBoundParameter.Value; }
    201211      set { ComparisonFactorLowerBoundParameter.Value = value; }
    202212    }
    203     private DoubleValue ComparisonFactorUpperBound {
     213    public DoubleValue ComparisonFactorUpperBound {
    204214      get { return ComparisonFactorUpperBoundParameter.Value; }
    205215      set { ComparisonFactorUpperBoundParameter.Value = value; }
     
    209219      set { ComparisonFactorModifierParameter.Value = value; }
    210220    }
    211     private DoubleValue MaximumSelectionPressure {
     221    public DoubleValue MaximumSelectionPressure {
    212222      get { return MaximumSelectionPressureParameter.Value; }
    213223      set { MaximumSelectionPressureParameter.Value = value; }
    214224    }
    215     private BoolValue OffspringSelectionBeforeMutation {
     225    public BoolValue OffspringSelectionBeforeMutation {
    216226      get { return OffspringSelectionBeforeMutationParameter.Value; }
    217227      set { OffspringSelectionBeforeMutationParameter.Value = value; }
     
    228238      get { return MaximumEvaluatedSolutionsParameter.Value; }
    229239      set { MaximumEvaluatedSolutionsParameter.Value = value; }
     240    }
     241    public bool FillPopulationWithParents {
     242      get { return FillPopulationWithParentsParameter.Value.Value; }
     243      set { FillPopulationWithParentsParameter.Value.Value = value; }
    230244    }
    231245    private RandomCreator RandomCreator {
     
    257271    [StorableHook(HookType.AfterDeserialization)]
    258272    private void AfterDeserialization() {
    259       #region Backwards Compatibility
     273      // BackwardsCompatibility3.3
     274      #region Backwards compatible code, remove with 3.4
    260275      if (successfulOffspringAnalyzer == null)
    261276        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     277      if (!Parameters.ContainsKey("ReevaluateElites")) {
     278        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 });
     279      }
     280      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     281        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
    262282      #endregion
    263283
     
    293313      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    294314      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     315      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 });
    295316      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
    296317      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0)));
     
    303324      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
    304325      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     326      Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(true)) { Hidden = true });
    305327
    306328      RandomCreator randomCreator = new RandomCreator();
     
    355377      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    356378      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     379      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    357380      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    358381      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     
    366389      mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
    367390      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
     391      mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    368392      mainLoop.Successor = null;
    369393
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r7259 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    9191      get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; }
    9292    }
     93    public IValueLookupParameter<BoolValue> ReevaluateElitesParameter {
     94      get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     95    }
    9396    public ValueLookupParameter<ResultCollection> ResultsParameter {
    9497      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     
    126129    public LookupParameter<IntValue> EvaluatedSolutionsParameter {
    127130      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
     131    }
     132    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
     133      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    128134    }
    129135    #endregion
     
    158164      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."));
    159165      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     166      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    160167      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
    161168      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
     
    170177      Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
    171178      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
     179      Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
    172180      #endregion
    173181
     
    248256      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    249257      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     258      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    250259      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    251260      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     
    260269      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
    261270      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
     271      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    262272
    263273      islandAnalyzer2.Name = "Island Analyzer (placeholder)";
     
    414424    }
    415425
     426    [StorableHook(HookType.AfterDeserialization)]
     427    private void AfterDeserialization() {
     428      // BackwardsCompatibility3.3
     429      #region Backwards compatible code, remove with 3.4
     430      if (!Parameters.ContainsKey("ReevaluateElites")) {
     431        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     432      }
     433      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     434        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
     435      #endregion
     436    }
     437
    416438    public override IOperation Apply() {
    417439      if (CrossoverParameter.ActualValue == null)
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r8121 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    108111    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
    109112      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     113    }
     114    private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
     115      get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    110116    }
    111117    #endregion
     
    144150      set { ElitesParameter.Value = value; }
    145151    }
     152    public bool ReevaluteElites {
     153      get { return ReevaluateElitesParameter.Value.Value; }
     154      set { ReevaluateElitesParameter.Value.Value = value; }
     155    }
    146156    public IntValue MaximumGenerations {
    147157      get { return MaximumGenerationsParameter.Value; }
     
    183193      get { return MaximumEvaluatedSolutionsParameter.Value; }
    184194      set { MaximumEvaluatedSolutionsParameter.Value = value; }
     195    }
     196    public bool FillPopulationWithParents {
     197      get { return FillPopulationWithParentsParameter.Value.Value; }
     198      set { FillPopulationWithParentsParameter.Value.Value = value; }
    185199    }
    186200    private RandomCreator RandomCreator {
     
    205219    [StorableHook(HookType.AfterDeserialization)]
    206220    private void AfterDeserialization() {
    207       #region Backwards Compatibility
     221      // BackwardsCompatibility3.3
     222      #region Backwards compatible code, remove with 3.4
    208223      if (successfulOffspringAnalyzer == null)
    209224        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     225      if (!Parameters.ContainsKey("ReevaluateElites")) {
     226        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 });
     227      }
     228      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     229        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
    210230      #endregion
    211231
     
    232252      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    233253      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     254      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 });
    234255      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    235256      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
     
    242263      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
    243264      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     265      Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
    244266
    245267      RandomCreator randomCreator = new RandomCreator();
     
    274296      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    275297      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     298      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    276299      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
    277300      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
     
    284307      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
    285308      mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
     309      mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    286310
    287311      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r7259 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    9295    public LookupParameter<IntValue> EvaluatedSolutionsParameter {
    9396      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
     97    }
     98    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
     99      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    94100    }
    95101    #endregion
     
    106112      : base() {
    107113      Initialize();
     114    }
     115
     116    [StorableHook(HookType.AfterDeserialization)]
     117    private void AfterDeserialization() {
     118      // BackwardsCompatibility3.3
     119      #region Backwards compatible code, remove with 3.4
     120      if (!Parameters.ContainsKey("ReevaluateElites")) {
     121        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     122      }
     123      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     124        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
     125      #endregion
    108126    }
    109127
     
    120138      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."));
    121139      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     140      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    122141      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    123142      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    130149      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation."));
    131150      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
     151      Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
    132152      #endregion
    133153
     
    170190      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    171191      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     192      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    172193      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    173194      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     
    182203      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
    183204      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
     205      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    184206
    185207      generationsCounter.Increment = new IntValue(1);
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r7259 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    8487    public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
    8588      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
     89    }
     90    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
     91      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    8692    }
    8793    #endregion
     
    98104      : base() {
    99105      Initialize();
     106    }
     107
     108    [StorableHook(HookType.AfterDeserialization)]
     109    private void AfterDeserialization() {
     110      // BackwardsCompatibility3.3
     111      #region Backwards compatible code, remove with 3.4
     112      if (!Parameters.ContainsKey("ReevaluateElites")) {
     113        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     114      }
     115      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     116        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
     117      #endregion
    100118    }
    101119
     
    112130      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions."));
    113131      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.)"));
    114133      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]."));
    115134      Parameters.Add(new LookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio."));
     
    118137      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
    119138      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation."));
     139      Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
    120140      #endregion
    121141
     
    159179      LeftReducer leftReducer = new LeftReducer();
    160180      MergingReducer mergingReducer2 = new MergingReducer();
     181      ConditionalBranch reevaluateElitesBranch = new ConditionalBranch();
     182      UniformSubScopesProcessor uniformSubScopesProcessor7 = new UniformSubScopesProcessor();
     183      Placeholder evaluator4 = new Placeholder();
     184      SubScopesCounter subScopesCounter4 = new SubScopesCounter();
    161185
    162186      selector.Name = "Selector (placeholder)";
     
    243267      offspringSelector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners";
    244268      offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring";
     269      offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    245270
    246271      bestSelector.CopySelected = new BoolValue(false);
     
    253278      worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name;
    254279      worstSelector.QualityParameter.ActualName = QualityParameter.Name;
     280
     281      reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";
     282      reevaluateElitesBranch.Name = "Reevaluate elites ?";
     283
     284      uniformSubScopesProcessor7.Parallel.Value = true;
     285
     286      evaluator4.Name = "Evaluator (placeholder)";
     287      evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name;
     288
     289      subScopesCounter4.Name = "Increment EvaluatedSolutions";
     290      subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    255291      #endregion
    256292
     
    310346      subScopesProcessor3.Successor = mergingReducer2;
    311347      bestSelector.Successor = rightReducer;
    312       rightReducer.Successor = null;
     348      rightReducer.Successor = reevaluateElitesBranch;
     349      reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7;
     350      uniformSubScopesProcessor7.Operator = evaluator4;
     351      uniformSubScopesProcessor7.Successor = subScopesCounter4;
     352      subScopesCounter4.Successor = null;
     353      reevaluateElitesBranch.FalseBranch = null;
     354      reevaluateElitesBranch.Successor = null;
    313355      worstSelector.Successor = leftReducer;
    314356      leftReducer.Successor = null;
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Plugin.cs.frame

    r8246 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626  /// Plugin class for HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.7.$WCREV$")]
     28  [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.10.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Properties/AssemblyInfo.cs.frame

    r8246 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3131[assembly: AssemblyCompany("")]
    3232[assembly: AssemblyProduct("HeuristicLab")]
    33 [assembly: AssemblyCopyright("(c) 2002-2012 HEAL")]
     33[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
    3434[assembly: AssemblyTrademark("")]
    3535[assembly: AssemblyCulture("")]
     
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.3.0.0")]
    55 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
     55[assembly: AssemblyFileVersion("3.3.10.$WCREV$")]
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r8121 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    117120    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
    118121      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     122    }
     123    private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
     124      get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    119125    }
    120126    #endregion
     
    161167      set { ElitesParameter.Value = value; }
    162168    }
     169    public bool ReevaluteElites {
     170      get { return ReevaluateElitesParameter.Value.Value; }
     171      set { ReevaluateElitesParameter.Value.Value = value; }
     172    }
    163173    public DoubleValue SuccessRatio {
    164174      get { return SuccessRatioParameter.Value; }
     
    204214      get { return MaximumEvaluatedSolutionsParameter.Value; }
    205215      set { MaximumEvaluatedSolutionsParameter.Value = value; }
     216    }
     217    public bool FillPopulationWithParents {
     218      get { return FillPopulationWithParentsParameter.Value.Value; }
     219      set { FillPopulationWithParentsParameter.Value.Value = value; }
    206220    }
    207221    private RandomCreator RandomCreator {
     
    233247    [StorableHook(HookType.AfterDeserialization)]
    234248    private void AfterDeserialization() {
    235       #region Backwards Compatibility
     249      // BackwardsCompatibility3.3
     250      #region Backwards compatible code, remove with 3.4
    236251      if (successfulOffspringAnalyzer == null)
    237252        successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
     253      if (!Parameters.ContainsKey("ReevaluateElites")) {
     254        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 });
     255      }
     256      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     257        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
    238258      #endregion
    239259
     
    264284      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    265285      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
     286      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 });
    266287      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
    267288      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0.3)));
     
    275296      Parameters.Add(new ValueParameter<MultiAnalyzer>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer()));
    276297      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     298      Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(true)) { Hidden = true });
    277299
    278300      RandomCreator randomCreator = new RandomCreator();
     
    321343      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    322344      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     345      mainLoop.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    323346      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    324347      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     
    333356      mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
    334357      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
     358      mainLoop.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    335359      mainLoop.Successor = null;
    336360
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r7259 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    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"]; }
     
    108111    public LookupParameter<IntValue> EvaluatedSolutionsParameter {
    109112      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
     113    }
     114    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
     115      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    110116    }
    111117    #endregion
     
    134140      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."));
    135141      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     142      Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
    136143      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
    137144      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the villages."));
     
    146153      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation."));
    147154      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
     155      Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
    148156      #endregion
    149157
     
    236244      mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio";
    237245      mainOperator.ElitesParameter.ActualName = ElitesParameter.Name;
     246      mainOperator.ReevaluateElitesParameter.ActualName = ReevaluateElitesParameter.Name;
    238247      mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name;
    239248      mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     
    248257      mainOperator.SelectorParameter.ActualName = SelectorParameter.Name;
    249258      mainOperator.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
     259      mainOperator.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
    250260
    251261      villageAnalyzer2.Name = "Village Analyzer (placeholder)";
     
    424434    }
    425435
     436    [StorableHook(HookType.AfterDeserialization)]
     437    private void AfterDeserialization() {
     438      // BackwardsCompatibility3.3
     439      #region Backwards compatible code, remove with 3.4
     440      if (!Parameters.ContainsKey("ReevaluateElites")) {
     441        Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
     442      }
     443      if (!Parameters.ContainsKey("FillPopulationWithParents"))
     444        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
     445      #endregion
     446    }
     447
    426448    public override IOperation Apply() {
    427449      if (CrossoverParameter.ActualValue == null)
  • branches/HiveStatistics/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r7259 r11202  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    8181      Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created."));
    8282      Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
     83
     84      CollectedValuesParameter.Value.Add(new StringValue("SelectedCrossoverOperator"));
     85      CollectedValuesParameter.Value.Add(new StringValue("SelectedManipulationOperator"));
    8386    }
    8487
     
    110113        }
    111114
    112         //create a data table containing the collected values
    113         ResultCollection successfulOffspringAnalysis;
     115        if (counts.Count > 0) {
     116          //create a data table containing the collected values
     117          ResultCollection successfulOffspringAnalysis;
    114118
    115         if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
    116           successfulOffspringAnalysis = new ResultCollection();
    117           SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    118         } else {
    119           successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    120         }
    121 
    122         string resultKey = "SuccessfulOffspringAnalyzer Results";
    123         if (!results.ContainsKey(resultKey)) {
    124           results.Add(new Result(resultKey, successfulOffspringAnalysis));
    125         } else {
    126           results[resultKey].Value = successfulOffspringAnalysis;
    127         }
    128 
    129         DataTable successProgressAnalysis;
    130         if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
    131           successProgressAnalysis = new DataTable();
    132           successProgressAnalysis.Name = collected.Value;
    133           successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
    134         } else {
    135           successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
    136         }
    137 
    138         int successfulCount = 0;
    139         foreach (string key in counts.Keys) {
    140           successfulCount += counts[key];
    141         }
    142 
    143         foreach (String value in counts.Keys) {
    144           DataRow row;
    145           if (!successProgressAnalysis.Rows.ContainsKey(value)) {
    146             row = new DataRow(value);
    147             int iterations = GenerationsParameter.ActualValue.Value;
    148 
    149             //fill up all values seen the first time
    150             for (int i = 1; i < iterations; i++)
    151               row.Values.Add(0);
    152 
    153             successProgressAnalysis.Rows.Add(row);
     119          if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
     120            successfulOffspringAnalysis = new ResultCollection();
     121            SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    154122          } else {
    155             row = successProgressAnalysis.Rows[value];
     123            successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    156124          }
    157125
    158           row.Values.Add(counts[value] / (double)successfulCount);
    159         }
     126          string resultKey = "SuccessfulOffspringAnalyzer Results";
     127          if (!results.ContainsKey(resultKey)) {
     128            results.Add(new Result(resultKey, successfulOffspringAnalysis));
     129          } else {
     130            results[resultKey].Value = successfulOffspringAnalysis;
     131          }
    160132
    161         //fill up all values that are not present in the current generation
    162         foreach (DataRow row in successProgressAnalysis.Rows) {
    163           if (!counts.ContainsKey(row.Name))
    164             row.Values.Add(0);
     133          DataTable successProgressAnalysis;
     134          if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
     135            successProgressAnalysis = new DataTable();
     136            successProgressAnalysis.Name = collected.Value;
     137            successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
     138          } else {
     139            successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
     140          }
     141
     142          int successfulCount = 0;
     143          foreach (string key in counts.Keys) {
     144            successfulCount += counts[key];
     145          }
     146
     147          foreach (String value in counts.Keys) {
     148            DataRow row;
     149            if (!successProgressAnalysis.Rows.ContainsKey(value)) {
     150              row = new DataRow(value);
     151              int iterations = GenerationsParameter.ActualValue.Value;
     152
     153              //fill up all values seen the first time
     154              for (int i = 1; i < iterations; i++)
     155                row.Values.Add(0);
     156
     157              successProgressAnalysis.Rows.Add(row);
     158            } else {
     159              row = successProgressAnalysis.Rows[value];
     160            }
     161
     162            row.Values.Add(counts[value] / (double)successfulCount);
     163          }
     164
     165          //fill up all values that are not present in the current generation
     166          foreach (DataRow row in successProgressAnalysis.Rows) {
     167            if (!counts.ContainsKey(row.Name))
     168              row.Values.Add(0);
     169          }
    165170        }
    166171      }
Note: See TracChangeset for help on using the changeset viewer.