00001 00024 #ifndef _ACTIVELEZI_H 00025 #define _ACTIVELEZI_H 00026 00027 #include "../Predictor.h" 00028 #include "../../util/trie.h" 00029 00033 class ActiveLezi : public PredictorAlgorithm { 00034 private: 00036 00040 Trie<unsigned long> dictionary; 00041 list<unsigned long> phrase; 00042 list<unsigned long> window; 00043 unsigned int max_lz_length; 00044 unsigned int maxWindowModelDepth; 00045 00046 // this is the context which is used for prediction in getNextContext 00047 list<unsigned long> curContext; 00048 00049 // this is only a list of all context IDs seen so far 00050 list<unsigned long> seen_context_ids; 00052 00053 // a helper used for single- and multi-step prediction 00055 unsigned long getNextContext(const list<unsigned long>* context) const; 00056 00057 public: 00058 // the parameter maxWindowModelDepth does not restrict the deepest path in the trie, but only the depth of the context window which is used 00059 // setting it to a value <1 means to deactivate the context window completely and reducing the algorithm to a normal Lempel-Ziv parsing with prediction 00061 ActiveLezi(predictorparams ¶ms); 00063 virtual ~ActiveLezi(); 00064 00065 virtual void addContexts(const membershiplist* contexts, time_t time); 00066 virtual void addContext(unsigned long contextId, time_t time); 00067 00068 virtual unsigned long getNextContext() const; 00069 virtual membershiplist getNextContexts() const; 00070 00071 virtual contexttrajectory getContextTrajectory(unsigned int start, unsigned int end) const; 00072 00073 virtual unsigned long getContextAt(time_t time) const; 00074 virtual membershiplist getContextsAt(time_t time) const; 00075 00076 virtual string serialize() const; 00077 virtual void unserialize(string data); 00078 00079 // helper functions for evaluation 00081 unsigned int getMaxDepth() const; 00082 00083 #if _DEBUG_PREDICTORS 00084 virtual string toString() const; 00085 #endif 00086 }; 00087 00088 #endif