// TTeacher.h: interface for the TTeacher class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TTEACHER_H__20FAC095_F11B_11D6_867D_0000E87713C4__INCLUDED_)
#define AFX_TTEACHER_H__20FAC095_F11B_11D6_867D_0000E87713C4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "TNeuro.h"
#include "TEffCriteriaCounter.h"
#include "TPattern.h"

#define TEACHER_INPUTS_NUMB   3
#define TEACHER_MIDDLE_NUMB   30
#define TEACHER_OUTPUTS_NUMB  1

#define TEACHER_PATT_COEFF    7.5

struct TTeacherPatternElem
{
   // входы
   float   i[TEACHER_INPUTS_NUMB];

   // выходы
   float   o[TEACHER_OUTPUTS_NUMB];
};

class TTeacherLearnPattern
{
      int  numb;
      TTeacherPatternElem *patt;
      
   public:
      TTeacherLearnPattern() 
      { patt = NULL; };

      ~TTeacherLearnPattern()
       {
          if( patt ) 
            delete [] patt;
       }

      int getNumb( void ) { return numb; };

      void destroyPattern( void );
      int  loadPattern( const char* fileName = "teacher.pat" );

      TTeacherPatternElem* get( int i )
      {
         return patt + i;
      }
};

class TTeacher : public NetBP  
{
public:
   TTeacher();
   virtual ~TTeacher();

   void reset();
   void learn( TTeacherLearnPattern& );
   void teach( TEffCriteriaParms &ecp, TSolverLearnPattern &solverPat );

   void loadFromFile();
   void saveToFile(){ SaveToFile("teacher.img"); };

   void setStopLearning() { stopLearning = true; };
   
   virtual void NextCycle() { cycle++; }

protected:
   bool stopLearning;   
};

#endif // !defined(AFX_TTEACHER_H__20FAC095_F11B_11D6_867D_0000E87713C4__INCLUDED_)
