00001 #ifndef CLASSIFIER_H
00002 #define CLASSIFIER_H
00003
00004 #include "../Algorithm.h"
00005 #include "../bitstring/BitString.h"
00006
00007 #include "XCSParams.h"
00008 #include "ClassifierParams.h"
00009
00010 #include <set>
00011
00012 class Classifier;
00013 typedef boost::shared_ptr<Classifier> ClassifierP;
00014
00020 class Classifier {
00021
00022 public:
00023
00024 IndividualP ind;
00025 ClassifierParamsP params;
00026 XCSParamsP xcsParams;
00027
00028 Classifier(XCSParamsP xcsParams, unsigned long long int time, IndividualP ind, StateP state);
00029 Classifier (ClassifierP cl);
00030 static bool checkState(const StateP state);
00031
00032 void cover (std::set<int> actions, const GenotypeP input,StateP state);
00033 bool doesMatch(const GenotypeP input);
00034 int getActionId();
00035 GenotypeP getAction();
00036 void setAction(GenotypeP action);
00037
00038 void mutateRule(GenotypeP input, StateP state);
00039 void mutateAction(StateP state);
00040
00041 bool valid;
00042
00043 void print();
00044
00045
00046 #pragma region BitString specific
00047 static void printBitString (const BitStringP bString);
00048 BitStringP getRuleBitString();
00049 BitStringP getDontCareBitString();
00050 #pragma endregion
00051
00052 public:
00053 double getDeletionVote(double avFit);
00054 bool couldSubsume();
00055 int numOfDCBits();
00056 bool isMoreGeneral(ClassifierP cl);
00057 bool doesSubsume(ClassifierP cl);
00058
00059 double getPrediction();
00060 double getError();
00061 double getFitness();
00062
00063 unsigned long long int getTimeStamp();
00064 int getNumerosity();
00065 double getActSetSize();
00066 double getExperience();
00067
00068 void setPrediction(double p);
00069 void setError(double eps);
00070 void setFitness(double F);
00071
00072 void setTimeStamp(unsigned long long int ts);
00073 void setNumerosity(int num);
00074 void setActSetSize(double as);
00075 void setExperience(double exp);
00076
00077 private:
00078 void printRuleString (const BitStringP bString, const BitStringP hashString);
00079 };
00080
00081
00082 #endif