Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3510


Ignore:
Timestamp:
04/23/10 14:21:09 (15 years ago)
Author:
abeham
Message:

Added a parameter to set the amount of selected parents #839, #976

Location:
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
2 edited

Legend:

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

    r3479 r3510  
    9898      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
    9999    }
     100    private ValueLookupParameter<IntValue> SelectedParentsParameter {
     101      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
     102    }
    100103    #endregion
    101104
     
    137140      set { MaximumGenerationsParameter.Value = value; }
    138141    }
    139     private DoubleValue SuccessRatio {
     142    public DoubleValue SuccessRatio {
    140143      get { return SuccessRatioParameter.Value; }
    141144      set { SuccessRatioParameter.Value = value; }
    142145    }
    143     private DoubleValue ComparisonFactorLowerBound {
     146    public DoubleValue ComparisonFactorLowerBound {
    144147      get { return ComparisonFactorLowerBoundParameter.Value; }
    145148      set { ComparisonFactorLowerBoundParameter.Value = value; }
    146149    }
    147     private DoubleValue ComparisonFactorUpperBound {
     150    public DoubleValue ComparisonFactorUpperBound {
    148151      get { return ComparisonFactorUpperBoundParameter.Value; }
    149152      set { ComparisonFactorUpperBoundParameter.Value = value; }
    150153    }
    151     private IDiscreteDoubleValueModifier ComparisonFactorModifier {
     154    public IDiscreteDoubleValueModifier ComparisonFactorModifier {
    152155      get { return ComparisonFactorModifierParameter.Value; }
    153156      set { ComparisonFactorModifierParameter.Value = value; }
    154157    }
    155     private DoubleValue MaximumSelectionPressure {
     158    public DoubleValue MaximumSelectionPressure {
    156159      get { return MaximumSelectionPressureParameter.Value; }
    157160      set { MaximumSelectionPressureParameter.Value = value; }
    158161    }
    159     private BoolValue OffspringSelectionBeforeMutation {
     162    public BoolValue OffspringSelectionBeforeMutation {
    160163      get { return OffspringSelectionBeforeMutationParameter.Value; }
    161164      set { OffspringSelectionBeforeMutationParameter.Value = value; }
     165    }
     166    public IntValue SelectedParents {
     167      get { return SelectedParentsParameter.Value; }
     168      set { SelectedParentsParameter.Value = value; }
    162169    }
    163170    private RandomCreator RandomCreator {
     
    196203      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
    197204      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.", new BoolValue(false)));
     205      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "Should be about 2 * PopulationSize, for large problems use a smaller value to decrease memory footprint.", new IntValue(200)));
    198206
    199207      RandomCreator randomCreator = new RandomCreator();
     
    316324      }
    317325    }
    318 
    319326    private void ParameterizeSolutionsCreator() {
    320327      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
     
    347354      foreach (ISelector selector in Selectors) {
    348355        selector.CopySelected = new BoolValue(true);
    349         selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
     356        selector.NumberOfSelectedSubScopesParameter.Value = null;
     357        selector.NumberOfSelectedSubScopesParameter.ActualName = SelectedParentsParameter.Name;
    350358        ParameterizeStochasticOperator(selector);
    351359      }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r3490 r3510  
    109109      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
    110110    }
     111    private ValueLookupParameter<IntValue> SelectedParentsParameter {
     112      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
     113    }
    111114    #endregion
    112115
     
    183186      get { return OffspringSelectionBeforeMutationParameter.Value; }
    184187      set { OffspringSelectionBeforeMutationParameter.Value = value; }
     188    }
     189    public IntValue SelectedParents {
     190      get { return SelectedParentsParameter.Value; }
     191      set { SelectedParentsParameter.Value = value; }
    185192    }
    186193    private List<ISelector> selectors;
     
    225232      Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left.", new DoubleValue(100)));
    226233      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.", new BoolValue(false)));
     234      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "Should be about 2 * PopulationSize, for large problems use a smaller value to decrease memory footprint.", new IntValue(200)));
    227235
    228236      RandomCreator randomCreator = new RandomCreator();
     
    417425      foreach (ISelector selector in Selectors) {
    418426        selector.CopySelected = new BoolValue(true);
    419         selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize.Value - Elites.Value));
     427        selector.NumberOfSelectedSubScopesParameter.Value = null;
     428        selector.NumberOfSelectedSubScopesParameter.ActualName = SelectedParentsParameter.Name;
    420429        ParameterizeStochasticOperator(selector);
    421430      }
Note: See TracChangeset for help on using the changeset viewer.