home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 11 Learning / 04 Mommersteeg / Predictors / ImprovedPredictor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-23  |  1.8 KB  |  46 lines

  1. //----------------------------------------------------------------------------------------------
  2. // Sequential Prediction Demo: The positioning pattern
  3. // 
  4. // Author:  Fri Mommersteeg
  5. // Date:    10-09-2001
  6. // File:    ImprovedPredictor.h
  7. //----------------------------------------------------------------------------------------------
  8.  
  9. #ifndef __IMPROVEDPREDICTOR_H
  10. #define __IMPROVEDPREDICTOR_H
  11.  
  12. //----------------------------------------------------------------------------------------------
  13. // Include files
  14. //----------------------------------------------------------------------------------------------
  15.  
  16. #include "StringMatchPredictor.h"
  17. #include "Array.h"
  18.  
  19. //----------------------------------------------------------------------------------------------
  20. // CImprovedPredictor: Enhances the standard string-matching predictor by taking all matching
  21. //                       substrings into account
  22. //
  23. // Note: The Performance Indicator is normalized. This means that when you set up the predictor,
  24. // the fMinPerformance parameter is a chance (between 0 and 1) that indicates the minimum
  25. // desired probability that the prediction is correct.
  26. //----------------------------------------------------------------------------------------------
  27.  
  28. class CImprovedPredictor : public CStringMatchPredictor {
  29. public:
  30.     void            Setup(int nWindowSize, int nAlphabetSize, float fMinPerformance);
  31.     virtual void    Update(int NextElement);
  32.     virtual bool    GetPrediction(int &Prediction);
  33.  
  34. protected:
  35.     void            CalculatePrediction();
  36.  
  37. protected:
  38.     CArray <float>    m_Alphabet;
  39.     float            m_TotalPredictionValue;
  40.     float            m_HighestPredictionValue;
  41.     float            m_fMinPerformance;
  42. };
  43.  
  44. //----------------------------------------------------------------------------------------------
  45. #endif // __IMPROVEDPREDICTOR_H
  46.