Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9047 for branches


Ignore:
Timestamp:
12/13/12 10:41:22 (12 years ago)
Author:
mkommend
Message:

#1837: Committed local changes in sliding window GP branch.

Location:
branches/Sliding Window GP
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/OffspringSelectionSlidingWindowAnalyzer.cs

    r7849 r9047  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
    25 using HeuristicLab.Optimization;
    2625using HeuristicLab.Parameters;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
    2928namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    30   [Item("Generational Sliding Window GP Analyzer", "Analyzer which moves a sliding window every n-th generation over the training partition.")]
     29  [Item("Offspring Selection Sliding Window GP Analyzer", "Analyzer which moves a sliding window whenever the selection pressure exceeds a certain threshold.")]
    3130  [StorableClass]
    32   public class GenerationalSlidingWindowAnalyzer<T> : SlidingWindowAnalyzer<T>, IIterationBasedOperator
     31  public class OffspringSelectionSlidingWindowAnalyzer<T> : SlidingWindowAnalyzer<T>
    3332    where T : class, IDataAnalysisProblemData {
    34     private const string GenerationsIntervalParameterName = "Generation Interval";
    35     private const string GenerationsIntervalStartParameterName = "Generation Interval Start";
    36     private const string IterationsParameterName = "Iterations";
    37     private const string MaximumIterationsParameterName = "Maximum Iterations";
     33    private const string SelectionPressureParameterName = "SelectionPressure";
     34    private const string SelectionPressureThresholdParameterName = "SelectionPressureThreshold";
    3835
    3936    #region parameter properties
    40     public ILookupParameter<IntValue> IterationsParameter {
    41       get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; }
     37    public ILookupParameter<IntValue> SelectionPressureParameter {
     38      get { return (ILookupParameter<IntValue>)Parameters[SelectionPressureParameterName]; }
    4239    }
    43     public IValueLookupParameter<IntValue> MaximumIterationsParameter {
    44       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; }
    45     }
    46     public IFixedValueParameter<IntValue> GenerationsIntervalParameter {
    47       get { return (IFixedValueParameter<IntValue>)Parameters[GenerationsIntervalParameterName]; }
    48     }
    49     public IFixedValueParameter<IntValue> GenerationsIntervalStartParameter {
    50       get { return (IFixedValueParameter<IntValue>)Parameters[GenerationsIntervalStartParameterName]; }
     40    public IFixedValueParameter<IntValue> SelectionPressureThresholdParameter {
     41      get { return (IFixedValueParameter<IntValue>)Parameters[SelectionPressureThresholdParameterName]; }
    5142    }
    5243    #endregion
    5344
    5445    #region properties
    55     public IntValue GenerationsInterval {
    56       get { return GenerationsIntervalParameter.Value; }
    57     }
    58     public IntValue GenerationsIntervalStart {
    59       get { return GenerationsIntervalStartParameter.Value; }
     46    public IntValue SelectionPressureThreshold {
     47      get { return SelectionPressureThresholdParameter.Value; }
    6048    }
    6149    #endregion
     
    6351
    6452    [StorableConstructor]
    65     protected GenerationalSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
    66     protected GenerationalSlidingWindowAnalyzer(GenerationalSlidingWindowAnalyzer<T> original, Cloner cloner) : base(original, cloner) { }
     53    protected OffspringSelectionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     54    protected OffspringSelectionSlidingWindowAnalyzer(OffspringSelectionSlidingWindowAnalyzer<T> original, Cloner cloner) : base(original, cloner) { }
    6755    public override IDeepCloneable Clone(Cloner cloner) {
    68       return new GenerationalSlidingWindowAnalyzer<T>(this, cloner);
     56      return new OffspringSelectionSlidingWindowAnalyzer<T>(this, cloner);
    6957    }
    7058
    71     public GenerationalSlidingWindowAnalyzer() {
    72       Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, ""));
    73       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, ""));
    74       Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalParameterName, "", new IntValue(0)));
    75       Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalStartParameterName, "", new IntValue(10)));
     59    public OffspringSelectionSlidingWindowAnalyzer() {
     60      Parameters.Add(new LookupParameter<IntValue>(SelectionPressureParameterName, ""));
     61      Parameters.Add(new FixedValueParameter<IntValue>(SelectionPressureThresholdParameterName, "", new IntValue(20)));
    7662    }
    7763
    7864    protected override bool CheckForUpdate() {
    79       var iteration = IterationsParameter.ActualValue.Value;
    80       var start = GenerationsIntervalStart.Value;
    81       var step = GenerationsInterval.Value;
    82       if (iteration < start) return false;
     65      var currentSelectionPressure = SelectionPressureParameter.ActualValue.Value;
     66      var selectionPressureThreshold = SelectionPressureThresholdParameter.Value.Value;
    8367
    84       if ((iteration - start) % step == 0) return true;
    85 
    86       return false;
     68      return selectionPressureThreshold <= currentSelectionPressure;
    8769    }
    8870
Note: See TracChangeset for help on using the changeset viewer.