[9154] | 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.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Encodings.ConditionActionEncoding {
|
---|
| 28 | [Item("XCSClassifier", "Represents a single XCS classifier")]
|
---|
| 29 | [StorableClass]
|
---|
| 30 | public class XCSClassifier : Item {
|
---|
| 31 |
|
---|
| 32 | #region private variables
|
---|
| 33 | [Storable]
|
---|
| 34 | private IClassifier classifier;
|
---|
| 35 | [Storable]
|
---|
| 36 | private DoubleValue prediction;
|
---|
| 37 | [Storable]
|
---|
| 38 | private DoubleValue predictionError;
|
---|
| 39 | [Storable]
|
---|
| 40 | private DoubleValue fitness;
|
---|
| 41 | [Storable]
|
---|
| 42 | private IntValue experience;
|
---|
| 43 | [Storable]
|
---|
| 44 | private IntValue timestamp;
|
---|
| 45 | [Storable]
|
---|
| 46 | private DoubleValue averageActionSetSize;
|
---|
| 47 | [Storable]
|
---|
| 48 | private IntValue numerosity;
|
---|
| 49 | #endregion
|
---|
| 50 |
|
---|
| 51 | #region properties
|
---|
| 52 | public IClassifier Classifier {
|
---|
| 53 | get { return classifier; }
|
---|
| 54 | set { classifier = value; }
|
---|
| 55 | }
|
---|
| 56 | public DoubleValue Prediction {
|
---|
| 57 | get { return prediction; }
|
---|
| 58 | set { prediction = value; }
|
---|
| 59 | }
|
---|
| 60 | public DoubleValue PredictionError {
|
---|
| 61 | get { return predictionError; }
|
---|
| 62 | set { predictionError = value; }
|
---|
| 63 | }
|
---|
| 64 | public DoubleValue Fitness {
|
---|
| 65 | get { return fitness; }
|
---|
| 66 | set { fitness = value; }
|
---|
| 67 | }
|
---|
| 68 | public IntValue Experience {
|
---|
| 69 | get { return experience; }
|
---|
| 70 | set { experience = value; }
|
---|
| 71 | }
|
---|
| 72 | public IntValue Timestamp {
|
---|
| 73 | get { return timestamp; }
|
---|
| 74 | set { timestamp = value; }
|
---|
| 75 | }
|
---|
| 76 | public DoubleValue AverageActionSetSize {
|
---|
| 77 | get { return averageActionSetSize; }
|
---|
| 78 | set { averageActionSetSize = value; }
|
---|
| 79 | }
|
---|
| 80 | public IntValue Numerosity {
|
---|
| 81 | get { return numerosity; }
|
---|
| 82 | set { numerosity = value; }
|
---|
| 83 | }
|
---|
| 84 | #endregion
|
---|
| 85 |
|
---|
| 86 | [StorableConstructor]
|
---|
| 87 | protected XCSClassifier(bool deserializing) : base(deserializing) { }
|
---|
| 88 | protected XCSClassifier(XCSClassifier original, Cloner cloner)
|
---|
| 89 | : base(original, cloner) {
|
---|
| 90 | classifier = cloner.Clone(original.classifier);
|
---|
| 91 | prediction = cloner.Clone(original.prediction);
|
---|
| 92 | predictionError = cloner.Clone(original.predictionError);
|
---|
| 93 | fitness = cloner.Clone(original.fitness);
|
---|
| 94 | experience = cloner.Clone(original.experience);
|
---|
| 95 | timestamp = cloner.Clone(original.timestamp);
|
---|
| 96 | averageActionSetSize = cloner.Clone(original.averageActionSetSize);
|
---|
| 97 | numerosity = cloner.Clone(original.numerosity);
|
---|
| 98 | }
|
---|
| 99 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 100 | return new XCSClassifier(this, cloner);
|
---|
| 101 | }
|
---|
| 102 | public XCSClassifier() : base() { }
|
---|
| 103 | public XCSClassifier(IClassifier classifier, DoubleValue prediction, DoubleValue predictionError,
|
---|
| 104 | DoubleValue fitness, IntValue experience, IntValue timestamp, DoubleValue averageActionSetSize, IntValue numerosity) {
|
---|
| 105 |
|
---|
| 106 | this.classifier = classifier;
|
---|
| 107 | this.prediction = prediction;
|
---|
| 108 | this.predictionError = predictionError;
|
---|
| 109 | this.fitness = fitness;
|
---|
| 110 | this.experience = experience;
|
---|
| 111 | this.timestamp = timestamp;
|
---|
| 112 | this.averageActionSetSize = averageActionSetSize;
|
---|
| 113 | this.numerosity = numerosity;
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | }
|
---|