[7845] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using HeuristicLab.Common;
|
---|
| 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Data;
|
---|
| 25 | using HeuristicLab.Parameters;
|
---|
| 26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[17687] | 27 | using HEAL.Attic;
|
---|
[7845] | 28 |
|
---|
| 29 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
|
---|
[9047] | 30 | [Item("Offspring Selection Sliding Window GP Analyzer", "Analyzer which moves a sliding window whenever the selection pressure exceeds a certain threshold.")]
|
---|
[17687] | 31 | [StorableType("A6424928-C98C-4166-9ABD-29934B2A0853")]
|
---|
[9162] | 32 | public class OffspringSelectionSlidingWindowAnalyzer : SlidingWindowAnalyzer {
|
---|
[9047] | 33 | private const string SelectionPressureParameterName = "SelectionPressure";
|
---|
| 34 | private const string SelectionPressureThresholdParameterName = "SelectionPressureThreshold";
|
---|
[7845] | 35 |
|
---|
| 36 | #region parameter properties
|
---|
[9165] | 37 | public ILookupParameter<DoubleValue> SelectionPressureParameter {
|
---|
| 38 | get { return (ILookupParameter<DoubleValue>)Parameters[SelectionPressureParameterName]; }
|
---|
[7845] | 39 | }
|
---|
[9165] | 40 | public IFixedValueParameter<DoubleValue> SelectionPressureThresholdParameter {
|
---|
| 41 | get { return (IFixedValueParameter<DoubleValue>)Parameters[SelectionPressureThresholdParameterName]; }
|
---|
[7845] | 42 | }
|
---|
| 43 | #endregion
|
---|
| 44 |
|
---|
| 45 | #region properties
|
---|
[9165] | 46 | public DoubleValue SelectionPressureThreshold {
|
---|
[9047] | 47 | get { return SelectionPressureThresholdParameter.Value; }
|
---|
[7845] | 48 | }
|
---|
| 49 | #endregion
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | [StorableConstructor]
|
---|
[17687] | 53 | protected OffspringSelectionSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
|
---|
[9162] | 54 | protected OffspringSelectionSlidingWindowAnalyzer(OffspringSelectionSlidingWindowAnalyzer original, Cloner cloner) : base(original, cloner) { }
|
---|
[7845] | 55 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[9162] | 56 | return new OffspringSelectionSlidingWindowAnalyzer(this, cloner);
|
---|
[7845] | 57 | }
|
---|
| 58 |
|
---|
[9047] | 59 | public OffspringSelectionSlidingWindowAnalyzer() {
|
---|
[9165] | 60 | Parameters.Add(new LookupParameter<DoubleValue>(SelectionPressureParameterName, ""));
|
---|
| 61 | Parameters.Add(new FixedValueParameter<DoubleValue>(SelectionPressureThresholdParameterName, "", new DoubleValue(20)));
|
---|
[7845] | 62 | }
|
---|
| 63 |
|
---|
| 64 | protected override bool CheckForUpdate() {
|
---|
[9047] | 65 | var currentSelectionPressure = SelectionPressureParameter.ActualValue.Value;
|
---|
| 66 | var selectionPressureThreshold = SelectionPressureThresholdParameter.Value.Value;
|
---|
[7845] | 67 |
|
---|
[9047] | 68 | return selectionPressureThreshold <= currentSelectionPressure;
|
---|
[7845] | 69 | }
|
---|
| 70 |
|
---|
| 71 | }
|
---|
| 72 | }
|
---|