Free cookie consent management tool by TermsFeed Policy Generator

source: branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionListCreator.cs @ 9334

Last change on this file since 9334 was 9334, checked in by sforsten, 11 years ago

#1980:

  • added Algorithms.GAssist
  • adapted Problems.DecisionListClassification and Encodings.DecisionList
File size: 3.8 KB
Line 
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
22using HeuristicLab.Algorithms.GAssist;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Operators;
27using HeuristicLab.Parameters;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Encodings.DecisionList {
31  [Item("DecisionListCreator", "Description missing")]
32  [StorableClass]
33  public abstract class DecisionListCreator : SingleSuccessorOperator, IDecisionListCreator {
34
35    #region Parameter Properties
36    public IValueLookupParameter<IDecisionListClassificationProblemData> ProblemDataParameter {
37      get { return (IValueLookupParameter<IDecisionListClassificationProblemData>)Parameters["ProblemData"]; }
38    }
39    public IValueLookupParameter<IntValue> InitialNumberOfRulesParameter {
40      get { return (IValueLookupParameter<IntValue>)Parameters["InitialNumberOfRules"]; }
41    }
42    public IValueLookupParameter<PercentValue> OneProbabilityParameter {
43      get { return (IValueLookupParameter<PercentValue>)Parameters["OneProbability"]; }
44    }
45    public IValueLookupParameter<ItemCollection<IDiscretizer>> DiscretizersParameter {
46      get { return (IValueLookupParameter<ItemCollection<IDiscretizer>>)Parameters["Discretizers"]; }
47    }
48    public ILookupParameter<DecisionList> DecisionListParameter {
49      get { return (ILookupParameter<DecisionList>)Parameters["DecisionList"]; }
50    }
51    public ILookupParameter<IRandom> RandomParameter {
52      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
53    }
54    #endregion
55
56    [StorableConstructor]
57    protected DecisionListCreator(bool deserializing) : base(deserializing) { }
58    protected DecisionListCreator(DecisionListCreator original, Cloner cloner)
59      : base(original, cloner) {
60    }
61    public DecisionListCreator()
62      : base() {
63      Parameters.Add(new ValueLookupParameter<IDecisionListClassificationProblemData>("ProblemData", ""));
64      Parameters.Add(new ValueLookupParameter<IntValue>("InitialNumberOfRules", ""));
65      Parameters.Add(new ValueLookupParameter<PercentValue>("OneProbability", ""));
66      Parameters.Add(new ValueLookupParameter<ItemCollection<IDiscretizer>>("Discretizers", ""));
67      Parameters.Add(new LookupParameter<DecisionList>("DecisionList", ""));
68      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
69
70    }
71
72    public override IOperation Apply() {
73      DecisionListParameter.ActualValue = Create(RandomParameter.ActualValue, ProblemDataParameter.ActualValue.SampleRuleParameter.Value, InitialNumberOfRulesParameter.ActualValue.Value, OneProbabilityParameter.ActualValue.Value, DiscretizersParameter.ActualValue);
74      return base.Apply();
75    }
76
77    protected abstract DecisionList Create(IRandom random, Rule sampleRule, int initialNumberOfRules, double oneProbability, ItemCollection<IDiscretizer> discretizers);
78  }
79}
Note: See TracBrowser for help on using the repository browser.