GNGAlgorithm.hpp

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // Author: Jim Holmström
00003 // Date:   2002-02-13
00004 //-----------------------------------------------------------------------------
00005 
00006 #ifndef __GNGALGORITHM_H
00007 #define __GNGALGORITHM_H
00008 
00009 #include <Vector.hpp>
00010 
00011 #include "IGNGContainer.hpp"
00012 #include "NodeContainer.hpp"
00013 #include "EdgeContainer.hpp"
00014 
00015 class GNGEdge;
00016 class GNGNode;
00017 class IGNGNodeInserter;
00018 class IGNGStopCriteria;
00019 class IGNGNodeMovement;
00020 class IInputGenerator;
00021 
00030 class GNGAlgorithm
00031 {
00032 public:
00036   GNGAlgorithm(unsigned int MSEBackLog);
00037   virtual ~GNGAlgorithm() 
00038   {
00039     m_initDone = true;
00040   }
00041   
00046   virtual void Initialize(unsigned int dim, IInputGenerator * g = 0);
00047 
00053   virtual void SetMSEOutputStream(std::ostream * f) { m_mseStream = f; }
00054   
00060   virtual void UpdateMSE(double minDistance);
00061 
00066   virtual void Iterate(Vector const & input);
00067   
00072   void SetComponentGNGContainer(IGNGContainer * i);
00073 
00078   void SetComponentNodeInserter(IGNGNodeInserter * i);
00079 
00080   /* *
00081    * Registers an IGNGStopCriteria with the GNGAlgorithm object.
00082    * @param i the IGNGStopCriteria to register.
00083    */
00084   //void SetComponentStopCriteria(IGNGStopCriteria * i);
00085   
00086   
00093   void SetComponentWinnerMovement(IGNGNodeMovement * i);
00094 
00101   void SetComponentNeighborMovement(IGNGNodeMovement * i);
00102 
00107   void SetParamAgeMax(double d);
00108 
00113   void SetParamMoveWinner(double d);
00114 
00119   void SetParamMoveNeighbor(double d);
00120 
00125   void SetParamErrorDecay(double d);
00126 
00127 protected:
00132   virtual void GetClosestNodes(/*OUT*/GNGNode * & s, 
00133                                /*OUT*/GNGNode * & t);
00138   virtual void UpdateError(GNGNode & s);
00139 
00144   virtual void IncreaseEdgeAges(GNGNode & s);
00145 
00151   virtual void MoveWinner(GNGNode & s);
00152   
00158   virtual void MoveNeighbor(GNGNode & s);
00159 
00165   virtual void MoveNeighbors(GNGNode const & s);
00166 
00170   virtual void PurgeEdges();
00171 
00175   virtual void PurgeNodes();
00176 
00180   virtual void DecreaseNodeErrors();
00181   
00182 
00183 
00184 protected:
00185   // components
00186   IGNGNodeInserter *    m_nodeInserter;
00187   IGNGStopCriteria *    m_stopCritera;
00188   IGNGNodeMovement *    m_winnerMovement;
00189   IGNGNodeMovement *    m_neighborMovement;
00190 
00191   IGNGContainer *       m_gngContainer;
00192 
00193   bool                  m_initDone;  
00194   unsigned int          m_dimension; 
00195   Vector                m_input;
00196 
00197   std::ostream * m_mseStream;  // the stream which to output the mean squared error.
00198   unsigned int   m_MSEBackLog; // the number of samples to use for the mean sq. error
00199   double         m_mse;        // keep track of mean squared error m_MSEBackLog number of steps
00200 
00201   // GNG parameters
00202   double m_paramAgeIncrement;
00203   double m_paramAgeMax;
00204   double m_paramMoveWinner;
00205   double m_paramMoveNeighbor;
00206   double m_paramErrorDecay;
00207 };
00208 
00209 
00210 #endif
00211 

Generated on Mon Mar 22 16:40:47 2004 for GNG_GL by doxygen 1.3.6