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