home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / Demos_Files / Code_Generation / NSLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  87.3 KB  |  2,814 lines

  1. // NeuroSolutions v4.13
  2.  
  3. // Copyright (c) 1994, NeuroDimension, Inc. All rights reserved.
  4. // Author: Wesley Curtis Lefebvre
  5.  
  6. #ifndef __GLOBAL_H__
  7. #define __GLOBAL_H__
  8.  
  9. #define PC
  10. #define MS_VISUAL
  11.  
  12. #include <stdio.h>
  13. #include <float.h>
  14. #include <string.h>
  15. #include <stdlib.h>
  16. #include <time.h>
  17. #include <math.h>
  18. #include <ctype.h>
  19.  
  20. #define WEIGHTFILEVERSION                225
  21. #define nil                                     NULL
  22. #define YES                                     1
  23. #define NO                                      0
  24. #define MAX(x,y)                        x>y?x:y;
  25. #define MIN(x,y)                        x<y?x:y;
  26. #define PI                                      3.1415927
  27. #define NSInt                           int
  28. #define NSUInt                          UINT
  29. #define NSLong                          long
  30. #define NSFloat                         float
  31.  
  32. #define NSSEEK_CUR                      1
  33. #define NSSEEK_END                      2
  34. #define NSSEEK_SET                      0
  35.  
  36. #ifndef PC
  37. #define SWAP
  38. #endif
  39.  
  40. #ifdef MS_VISUAL
  41. #define finite                          _finite
  42. #else
  43. #define finite(x)                       ((x>-1.0e12) && (x<1.0e12))
  44. #endif
  45.  
  46. #define DLL_PARAM_ROWS          5
  47. #define DLL_PARAM_COLS          3
  48.  
  49. #ifndef FALSE
  50. #define FALSE                           0
  51. #endif
  52. #ifndef TRUE
  53. #define TRUE                            1
  54. #endif
  55. #ifndef NULL
  56. #define NULL                            0
  57. #endif
  58.  
  59. //#ifdef _DEBUG
  60. //      #define malloc \
  61. //              NSMalloc
  62. //      #define calloc \
  63. //              NSCalloc
  64. //      #define free \
  65. //              NSFreeMemory
  66. //#endif
  67.  
  68. #ifndef NS_GUI
  69. typedef int     BOOL;
  70. #endif
  71.  
  72. typedef struct {
  73.         NSFloat *data;
  74.         int length;
  75. } DLLWeights;
  76.  
  77. typedef struct {
  78.         char parameters[DLL_PARAM_ROWS][DLL_PARAM_COLS][64];
  79.         char parameterNames[DLL_PARAM_ROWS][DLL_PARAM_COLS][64];
  80.         BOOL parameterReallocs[DLL_PARAM_ROWS][DLL_PARAM_COLS];
  81. } DLLParameters;
  82.  
  83. typedef struct {
  84.         DLLWeights *weights;
  85.         DLLParameters *parameters;
  86.         void *userData;
  87. } DLLData;
  88.  
  89. typedef struct {
  90.         void    *function,
  91.                         *constructor,
  92.                         *destructor;
  93.         DLLData *instance;
  94. } DLLStruct;
  95.  
  96. typedef DLLData         *(*DLL_Constructor)(DLLData *);
  97. typedef DLLData         *(*DLL_Constructor_CSW)(DLLData *, void *);
  98. typedef void            (*DLL_Destructor)(DLLData *);
  99. typedef void            (*DLL_Destructor_CSW)(DLLData *, void *);
  100.  
  101. //void* NSMalloc(size_t);
  102. //void* NSCalloc(size_t, size_t);
  103. //void NSFreeMemory(void*);
  104. //UINT NSBytesAllocated();
  105. unsigned short int getWeightFileVersion(FILE *file);
  106. FILE *seekComponent(FILE *, const char *, const char *);
  107. FILE *seekComponentReturnNull(FILE *, const char *, const char *);
  108. FILE *putComponent(FILE *, const char *, const char *);
  109. void writeWeightFileVersion(FILE *);
  110.  
  111. #endif __GLOBAL_H__
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. // Author: Wesley Curtis Lefebvre
  128.  
  129. #ifndef __NSDLL_H__
  130. #define __NSDLL_H__
  131.  
  132. void checkParameterIndices(int *row,int *col);
  133. DLLData *allocDLLInstance(DLLData *oldInstance);
  134. void freeDLLInstance(DLLData *instance);
  135. DLLData *setWeights(DLLData *instance, int numberOfWeights);
  136. DLLData *allocParameters(DLLData *instance);
  137. NSFloat *getWeights(DLLData *instance);
  138. void setUserData(DLLData *instance, void *userData);
  139. void *getUserData(DLLData *instance);
  140. void setParameterName(DLLData *instance, int row, int col, char *name, BOOL realloc);
  141. int getIntParameter(DLLData *instance, int row, int col);
  142. NSFloat getFloatParameter(DLLData *instance, int row, int col);
  143. char *getStringParameter(DLLData *instance, int row, int col);
  144. BOOL getBoolParameter(DLLData *instance, int row, int col);
  145. void setIntParameter(DLLData *instance, int row, int col, int intValue, BOOL force);
  146. void setFloatParameter(DLLData *instance, int row, int col, NSFloat floatValue, BOOL force);
  147. void setStringParameter(DLLData *instance, int row, int col, char *stringValue, BOOL force);
  148. void setBoolParameter(DLLData *instance, int row, int col, BOOL boolValue, BOOL force);
  149.  
  150. #endif __NSDLL_H__
  151.  
  152. // Author: Wesley Curtis Lefebvre
  153.  
  154. #ifndef __SpatialAccess_H__
  155. #define __SpatialAccess_H__
  156.  
  157.  
  158. class SpatialAccess
  159. {
  160. protected:
  161.         SpatialAccess *stackedAccess;
  162.         BOOL m_bTesting, m_bAccessTesting;
  163. public:
  164.         static BOOL    m_bRefreshAccess;
  165.         NSFloat *data;
  166.         int rowCount, colCount, spatialCount;
  167.         SpatialAccess();
  168.         BOOL accessTesting() { return m_bAccessTesting; };
  169.         void attachTo(SpatialAccess *);
  170.         int cols() { return colCount; };
  171.         virtual void reportSpatialAccess();
  172.         virtual void reportSpatialAccess(NSFloat *);
  173.         virtual void reportSpatialData();
  174.         int S() { return spatialCount; };
  175.         NSFloat &S(int i) { return *(data + i); };
  176.         NSFloat &S(int i, int j) { return *(data + j + i*cols()); };
  177.         int rows() { return rowCount; };
  178.         void setAccessTesting(BOOL aBOOL) { m_bAccessTesting = aBOOL; };
  179.         virtual void setData(NSFloat *, int, int=1);
  180.         virtual void setStackedAccess(SpatialAccess *);
  181.         void setTesting(BOOL aFlag) { m_bTesting = aFlag; };
  182.         BOOL testing() { return m_bTesting; };
  183.         virtual ~SpatialAccess();
  184. };
  185.  
  186. #endif // __SpatialAccess_H__
  187.  
  188. // Author: Wesley Curtis Lefebvre
  189.  
  190. #ifndef __SpatialData_H__
  191. #define __SpatialData_H__
  192.  
  193.  
  194. class SpatialData: public SpatialAccess
  195. {
  196. protected:
  197.         NSFloat         *allocatedData,
  198.                         randomRange;
  199. public:
  200.         BOOL            m_bAccessEnabled;
  201.  
  202. public:
  203.         SpatialData();
  204.         void assignScalar(NSFloat);
  205.         void copyDataFrom(NSFloat *);
  206.         void copyDataFromDouble(NSFloat *);
  207.         void copyDataTo(NSFloat *);
  208.         virtual void deleteData();
  209.         virtual void oversizeSpatialDimension(int);
  210.         void randomize();
  211.         virtual void setSpatialDimension(int, int=1);
  212.         void zero();
  213.         ~SpatialData();
  214. };
  215.  
  216. #endif // __SpatialData_H__
  217.  
  218.  
  219. #ifndef __InputSpatialData_h__
  220. #define __InputSpatialData_h__
  221.  
  222. class InputSpatialData: public SpatialData
  223. {
  224. protected:
  225.         BOOL    m_bPerformNormalization;
  226.         int     m_iAllocatedChannels;
  227.         NSFloat    *m_fDenormalizedData;
  228. public:
  229.         NSFloat   *m_fAmplitude,
  230.                 *m_fOffset;
  231. public:
  232.                 InputSpatialData();
  233.                 ~InputSpatialData();
  234. //        NSFloat &litude(int i) { return *(m_fAmplitude+i); };
  235.         void    denormalizeData();
  236.         void    loadWeights(FILE *file, unsigned short int version);
  237.         void    normalizeData();
  238. //        NSFloat &offset(int i) { return *(m_fOffset+i); };
  239.         void    saveWeights(FILE *file);
  240.         void    setPerformNormalization(BOOL aBool) { m_bPerformNormalization = aBool; };
  241.         void    setSpatialDimension(int rowInt, int colInt);
  242. };
  243.  
  244. #endif // __InputSpatialData_h__
  245.  
  246. // File.h
  247. // by David Scott Samson
  248.  
  249. #ifndef __File_h__
  250. #define __File_h__
  251.  
  252.  
  253. enum MODE       {ASCII = 0, BINARY, STANDARD };
  254. enum RW         {WRITE = 0, READ };
  255.  
  256. class File: public InputSpatialData
  257. {
  258. protected:
  259.         FILE    *m_pFileStream;
  260.         char    m_sFilePath[1024];
  261.         MODE    m_iMode;
  262.         RW      m_readWrite;
  263.         BOOL    m_AdvanceStream,
  264.                 m_StreamConstant,
  265.                 m_FixStream;
  266.         int     m_iDitherInput;
  267.         NSFloat   m_fDither;
  268. public:
  269.                 File();
  270.                 File(char *, RW=READ, MODE=BINARY);
  271.                 ~File();
  272.         void    advanceStream();
  273.         BOOL    closeFile();
  274.         void    ditherInput(int, NSFloat aFloat=0.1f);
  275.         char    *filePath(){return m_sFilePath;};
  276.         void    fixStream(BOOL);
  277.         int     mode() {return m_iMode;};
  278.         BOOL    openFile();
  279.         void    reportSpatialData();
  280.         void    setMode(RW, MODE);
  281.         void    setFilePath(char *);
  282. };
  283.  
  284. #endif // __File_h__
  285.  
  286. #ifndef __DLLInput_H__
  287. #define __DLLInput_H__
  288.  
  289.  
  290. typedef DLLData *(*DLLInput_Constructor)(DLLData *, int, int);
  291. typedef DLLData *(*DLLInput_Constructor_CSW)(DLLData *, int, int, void *);
  292. typedef void (*DLLInput_MAP)(DLLData *, NSFloat *, int, int);
  293. typedef void (*DLLInput_MAP_CSW)(DLLData *, NSFloat *, int, int, void *);
  294.  
  295. class DLLInput : public InputSpatialData
  296. {
  297. protected:
  298.         DLLStruct                       *dllStruct;
  299.         void                            *m_pCallingObject;
  300. public:
  301.                                                 DLLInput();
  302.         void                            reportSpatialData();
  303.         virtual void            constructDLL();
  304.         virtual void            destroyDLL(DLLData *);
  305.         virtual void            initializeDLL();
  306.         void                            setData(NSFloat *, int, int);
  307.         void                            setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  308.         void                            setSpatialDimension(int, int);
  309. };
  310.  
  311. #endif __DLLInput_H__
  312.  
  313. #ifndef __DLLPreprocessor_H__
  314. #define __DLLPreprocessor_H__
  315.  
  316.  
  317. typedef DLLData *(*DLLPreprocessor_Constructor)(DLLData *, int*, int*, BOOL);
  318. typedef DLLData *(*DLLPreprocessor_Constructor_CSW)(DLLData *, int*, int*, BOOL, void *);
  319. typedef BOOL (*DLLPreprocessor_MAP)(DLLData *, NSFloat *, NSFloat *, int, int, BOOL);
  320. typedef BOOL (*DLLPreprocessor_MAP_CSW)(DLLData *, NSFloat *, NSFloat *, int, int, BOOL, void *);
  321.  
  322. class DLLPreprocessor : public DLLInput
  323. {
  324. protected:
  325.         class   SpatialData     *m_pData;
  326.                 BOOL            m_bInputDataLocal;
  327. public:
  328.                                 DLLPreprocessor();
  329.                                 ~DLLPreprocessor();
  330.         void                    constructDLL();
  331.         virtual BOOL            isPreprocessor();
  332.         void                    reportSpatialData();
  333.         void                    setInputData(SpatialData *);
  334. };
  335.  
  336. #endif __DLLPreprocessor_H__
  337.  
  338. #ifndef __DLLPostprocessor_H__
  339. #define __DLLPostprocessor_H__
  340.  
  341.  
  342. class DLLPostprocessor : public DLLPreprocessor
  343. {
  344. public:
  345.                                                 DLLPostprocessor();
  346.         BOOL                            isPreprocessor();
  347.         void                            reportSpatialData();
  348. };
  349.  
  350. #endif __DLLPostprocessor_H__
  351.  
  352. // Author: Wesley Curtis Lefebvre
  353.  
  354. #ifndef __Soma_H__
  355. #define __Soma_H__
  356.  
  357.  
  358. class Soma {
  359.         friend class Axon;
  360.         friend class Synapse;
  361.         friend class BackAxon;
  362.         friend class BackSynapse;
  363.         int cells;
  364. protected:
  365.         NSFloat *cell, *t, *T, *link, *bufPosition;
  366.         int inputCells, outputCells, links, dllLinks;
  367.         NSFloat m_fWeightVariance, m_fWeightMean;
  368.         int somaTemporalDimension;
  369.         BOOL m_bWeightsFixed, m_bFreeCell, m_bWeightsLocallyAllocated;
  370.         void *m_pCallingObject;
  371. public:
  372.         Soma *Next;
  373.         SpatialAccess *activityAccess, *linkAccess, *dllLinkAccess;
  374.         DLLStruct *dllStruct;
  375.         Soma();
  376.         virtual ~Soma(void);
  377.         virtual void epochEnded();
  378.         virtual void loadWeights(FILE *, unsigned short int version=100);
  379.         virtual void loadStateVariables(FILE *file, unsigned short int version);
  380.         virtual void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  381.         virtual void saveStateVariables(FILE *file);
  382.         // DLL Stuff
  383.         virtual const char *dllFunctionName();
  384.         virtual void constructDLL(void);
  385.         virtual void destroyDLL(DLLData *);
  386.         virtual void initializeDLL(void);
  387.         virtual void setDLLFunction(DLLStruct *);
  388.         virtual void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  389.         //
  390.         NSFloat weightMean(void) { return m_fWeightMean;} ;
  391.         NSFloat weightVariance(void) { return m_fWeightVariance;} ;
  392.         BOOL weightsFixed(void) { return m_bWeightsFixed;} ;
  393.         void setWeightMean(NSFloat);
  394.         void setWeightVariance(NSFloat);
  395.         void setWeightsFixed(BOOL aBOOL) { m_bWeightsFixed = aBOOL; };
  396.         virtual void rangeLinks(void);
  397.         virtual void zeroState(void) {};
  398.         virtual void networkReset(void);
  399.         virtual BOOL isAnAxon(void) { return FALSE; };
  400.         virtual BOOL isASynapse(void) { return FALSE; };
  401.         virtual void storeBufPosition(void);
  402.         virtual void recallBufPosition(void);
  403.         virtual void allocateLinks(int _links, BOOL force=FALSE);
  404.         void assignLinks(NSFloat *newLink, BOOL freeLater=TRUE);
  405.         void attachTo(Soma *aSoma, int delay);
  406.         void decrement(void) { if ((t -= cells) < cell) t = T - cells; };
  407.         virtual void decrementTime(void);
  408.         void deleteLinks(void);
  409.         virtual void fire(void);
  410.         virtual void fireDummy(void);
  411.         void increment(void) { if ((t += cells) >= T) t = cell; };
  412.         virtual void incrementTime(void);
  413.         virtual void networkJog(void);
  414.         virtual void networkRandomize(void);
  415.         virtual void activityAltered(void);
  416.         virtual void linksAltered(void);
  417.         virtual void setInputCells(int numberOfCells);
  418.         void setActivityAccess(SpatialAccess *);
  419.         void setLinkAccess(SpatialAccess *);
  420.         void setDLLLinkAccess(SpatialAccess *);
  421.         virtual void removeLast(Soma *) {};
  422.         virtual void removeNext(Soma *) {};
  423.         virtual void setLast(Soma *) {};
  424.         virtual void setNext(Soma *) {};
  425.         virtual void setOutputCells(int numberOfCells);
  426.         virtual void setTemporalDimension(int T);
  427.         int temporalDimension(void) { return somaTemporalDimension; };
  428.         int U(void) {return inputCells;};
  429.         int V(void) {return outputCells;};
  430.         NSFloat &V(int i) {return *(t+i);};
  431.         NSFloat &w(int i) {return *(link+i);};
  432.         int w(void) {return links;};
  433.         int W(void) {return links+dllLinks;};
  434.         BOOL weightsLocallyAllocated() { return m_bWeightsLocallyAllocated; };
  435.         NSFloat *weightVector() { return link; };
  436. };
  437.  
  438. #endif // __Soma_H__
  439.  
  440. // Author: Wesley Curtis Lefebvre
  441. // Name:        Axon.h
  442.  
  443. #ifndef __Axon_H__
  444. #define __Axon_H__
  445.  
  446.  
  447. typedef void (*Axon_MAP)(DLLData *, NSFloat *, int, int);
  448. typedef void (*Axon_MAP_CSW)(DLLData *, NSFloat *, int, int, void *);
  449. typedef DLLData *(*Axon_Constructor)(DLLData *, int, int);
  450. typedef DLLData *(*Axon_Constructor_CSW)(DLLData *, int, int, void *);
  451.  
  452. class Axon: public Soma {
  453. protected:
  454.         int m_iRows, m_iCols;
  455.         int dummyFiredCounter, firedCounter, lastCount, m_iInputNeurons;
  456.         Soma *forcedLast;
  457.         BOOL m_bFireNext, m_bFireNextOnReset, m_bFirePending;
  458.         NSFloat *m_pIPInputBuffer;
  459. public:
  460.         int nextCount;
  461.         Soma *nextConnection[128];
  462. public:
  463.         SpatialAccess *preActivityAccess;
  464.         Axon();
  465.         void activityAltered(void);
  466.         void loadWeights(FILE *, unsigned short int version=100);
  467.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  468.         int cols() { return m_iCols; };
  469.         void constructDLL(void);
  470.         void fire(void);
  471.         void fireDummy(void);
  472.         const char *dllFunctionName();
  473.         virtual void fireDLL(void);
  474.         virtual void fireFeed(void);
  475.         virtual void fireMap(void);
  476.         BOOL fireNext(void) { return m_bFireNext; };
  477.         void incrementTime(void);
  478.         virtual void initialize(void);
  479.         BOOL isAnAxon(void) { return TRUE; };
  480.         virtual void networkReset();
  481.         void removeForcedLast(Soma *) { forcedLast=NULL; };
  482.         void removeLast(Soma *aSoma);
  483.         void removeNext(Soma *aSoma);
  484.         int rows() { return m_iRows; };
  485.         void setCols(int);
  486.         void setDLLFunction(DLLStruct *);
  487.         void setFireNext(BOOL aBOOL) { m_bFireNext = aBOOL; };
  488.         void setFireNextOnReset(BOOL aBOOL) { m_bFireNextOnReset = aBOOL; };
  489.         void setForcedLast(Soma *aSoma) { forcedLast=aSoma; };
  490.         void setInputCells(int numberOfCells);
  491.         void setIPInputBuffer(NSFloat *aBuffer) { m_pIPInputBuffer = aBuffer; };
  492.         void setLast(Soma *aSoma);
  493.         void setNext(Soma *nextSoma);
  494.         void setOutputCells(int numberOfCells);
  495.         void setPreActivityAccess(SpatialAccess *);
  496.         void setRows(int);
  497.         void setTemporalDimension(int T);
  498. //      NSFloat &V(int i, int j) { return V(j + i*m_iCols); };
  499.         ~Axon(void);
  500. };
  501.  
  502. #endif // __Axon_H__
  503. /*
  504. #ifndef __ExpanderAxon_H__
  505. #define __ExpanderAxon_H__
  506.  
  507. class ExpanderAxon: public Axon {
  508. protected:
  509.             int            m_nExpansionFactor;
  510. public:
  511.                         ExpanderAxon();
  512.             int            expansionFactor() { return m_nExpansionFactor; };
  513.             void        fireMap(void);
  514.             void        setInputCells(int anInt);
  515.             void        setExpansionFactor(int anInt) { if (m_nExpansionFactor != anInt) {m_nExpansionFactor = anInt; initialize();} };
  516. };
  517.  
  518. #endif // __ExpanderAxon_H__
  519. */
  520.  
  521. #ifndef __FuzzyAxon_H__
  522. #define __FuzzyAxon_H__
  523.  
  524. typedef void (*FuzzyAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  525. typedef void (*FuzzyAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  526. typedef DLLData *(*FuzzyAxon_Constructor)(DLLData *, int, int, int *);
  527. typedef DLLData *(*FuzzyAxon_Constructor_CSW)(DLLData *, int, int, int *, void *);
  528.  
  529. class FuzzyAxon: public Axon {
  530. public:
  531.             int            m_nMFCount;
  532. protected:
  533.             int                *m_WinningMF;
  534.             NSFloat            *m_WinningInput;
  535.             NSFloat            *m_MFOutput;
  536.             SpatialAccess   *MFOutputAccess;
  537. public:
  538.             BOOL            m_bOldFuzzyFormat;
  539. public:
  540.                         FuzzyAxon();
  541.                         ~FuzzyAxon();
  542.             void        activityAltered(void);
  543.     virtual NSFloat        applyMF(int paramIndex, NSFloat x) = 0;
  544.             void        constructDLL(void);
  545.             const char    *dllFunctionName();
  546.             void        fireDLL(void);
  547.             void        fireMap(void);
  548.             NSFloat        firingStrength(int index, BOOL callDLL = FALSE);
  549.             void        initialize();
  550.             int            MFMapping(int inputIndex, int outputIndex); //Comment for Single Connection
  551.             int            MFCount() { return m_nMFCount; };
  552.     virtual int            MFParameters() = 0;
  553.             void        setInputCells(int anInt);
  554.             void        setMFCount(int anInt) { if (m_nMFCount != anInt) {m_nMFCount = anInt; initialize();} };
  555.             void        setMFOutputAccess(SpatialAccess *aNSAccess);
  556.             void        setOldFuzzyFormat(BOOL aBool) { m_bOldFuzzyFormat = aBool; };
  557.             NSFloat        winningInput(int i) { return *(m_WinningInput + i); };
  558.             int            winningMF(int i) { return *(m_WinningMF + i); };
  559. };
  560.  
  561. #endif // __FuzzyAxon_H__
  562.  
  563. #ifndef __BellFuzzyAxon_H__
  564. #define __BellFuzzyAxon_H__
  565.  
  566. class BellFuzzyAxon: public FuzzyAxon {
  567.  
  568. public:
  569.             NSFloat        applyMF(int paramIndex, NSFloat x);
  570.             int            MFParameters() { return 3; };
  571.             void        networkRandomize();
  572. };
  573.  
  574. #endif // __BellFuzzyAxon_H__
  575.  
  576. #ifndef __GaussianFuzzyAxon_H__
  577. #define __GaussianFuzzyAxon_H__
  578.  
  579. class GaussianFuzzyAxon: public FuzzyAxon {
  580.  
  581. public:
  582.             NSFloat        applyMF(int paramIndex, NSFloat x);
  583.             int            MFParameters() { return 2; };
  584.             void        networkRandomize();
  585. };
  586.  
  587. #endif // __GaussianFuzzyAxon_H__
  588.  
  589. #ifndef __CombinerAxon_H__
  590. #define __CombinerAxon_H__
  591.  
  592. class CombinerAxon: public Axon {
  593. public:
  594.                         CombinerAxon();
  595.             void        activityAltered(void);
  596.             void        fireMap(void);
  597.             void        setInputCells(int anInt);
  598. };
  599.  
  600. #endif // __CombinerAxon_H__
  601.  
  602.  
  603. //NormalizedAxon
  604.  
  605. #ifndef __NormalizedAxon_H__
  606. #define __NormalizedAxon_H__
  607.  
  608. class NormalizedAxon: public Axon {
  609. private:
  610.     NSFloat        *m_WeightingFactorArray;
  611.     int            m_nWeightingFactorArraySize;
  612.  
  613. public:
  614.                 NormalizedAxon() { m_nWeightingFactorArraySize = 0; m_WeightingFactorArray = NULL; };
  615.                 ~NormalizedAxon() {     if (m_WeightingFactorArray) free(m_WeightingFactorArray); };
  616.     void        fireMap(void);
  617.     NSFloat        *weightingFactorArray() { return m_WeightingFactorArray; };
  618. };
  619.  
  620. #endif // __NormalizedAxon_H__
  621.  
  622.  
  623. // Author: Wesley Curtis Lefebvre
  624.  
  625. #ifndef __BiasAxon_H__
  626. #define __BiasAxon_H__
  627.  
  628.  
  629. typedef void (*BiasAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *);
  630. typedef void (*BiasAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, void *);
  631.  
  632. class BiasAxon: public Axon {
  633. protected:
  634.         void fireInline(register NSFloat &f, register NSFloat &fw) { f += fw; };
  635. public:
  636.         const char *dllFunctionName();
  637.         void fireDLL(void);
  638.         void fireMap(void);
  639.         void initialize(void);
  640. };
  641.  
  642. #endif // __BiasAxon_H__
  643.  
  644.  
  645. // Author: Wesley Curtis Lefebvre
  646.  
  647. #ifndef __LinearAxon_H__
  648. #define __LinearAxon_H__
  649.  
  650.  
  651. typedef void (*LinearAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat);
  652. typedef void (*LinearAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat, void *);
  653.  
  654. class LinearAxon: public BiasAxon {
  655. protected:
  656.         NSFloat m_fBeta;
  657. public:
  658.         LinearAxon();
  659.         NSFloat beta() { return m_fBeta; };
  660.         const char *dllFunctionName();
  661.         void fireInline(register NSFloat &f, register NSFloat &fw) { f *= m_fBeta; BiasAxon::fireInline(f,fw); };
  662.         void fireDLL(void);
  663.         void fireMap();
  664.         virtual void setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  665. };
  666.  
  667. #endif // __LinearAxon_H__
  668.  
  669. // Author: Wesley Curtis Lefebvre
  670.  
  671. #ifndef __SigmoidAxon_H__
  672. #define __SigmoidAxon_H__
  673.  
  674.  
  675. class SigmoidAxon: public LinearAxon {
  676. public:
  677.         void fireInline(register NSFloat &f, register NSFloat &fw) { LinearAxon::fireInline(f,fw); f = 1.0f/(1.0f+(NSFloat)exp(-f));};
  678.         void fireMap(void);
  679. };
  680.  
  681. #endif // __SigmoidAxon_H__
  682.  
  683.  
  684. //NormalizedSigmoidAxon
  685.  
  686. #ifndef __NormalizedSigmoidAxon_H__
  687. #define __NormalizedSigmoidAxon_H__
  688.  
  689. class NormalizedSigmoidAxon: public SigmoidAxon {
  690. private:
  691.     NSFloat        *m_WeightingFactorArray;
  692.     int            m_nWeightingFactorArraySize;
  693.  
  694. public:
  695.                 NormalizedSigmoidAxon() { m_nWeightingFactorArraySize = 0; m_WeightingFactorArray = NULL; };
  696.                 ~NormalizedSigmoidAxon() {     if (m_WeightingFactorArray) free(m_WeightingFactorArray); };
  697.     void        fireMap(void);
  698.     NSFloat        *weightingFactorArray() { return m_WeightingFactorArray; };
  699. };
  700.  
  701. #endif // __NormalizedSigmoidAxon_H__
  702.  
  703.  
  704. // Author: Wesley Curtis Lefebvre
  705.  
  706. #ifndef __TanhAxon_H__
  707. #define __TanhAxon_H__
  708.  
  709.  
  710. class TanhAxon: public LinearAxon {
  711. public:
  712.         void fireInline(register NSFloat &f, register NSFloat &fw) { LinearAxon::fireInline(f,fw); f = (NSFloat)tanh(f); };
  713.         void fireMap(void);
  714. };
  715.  
  716. #endif // __TanhAxon_H__
  717.  
  718. // Author: Wesley Curtis Lefebvre
  719.  
  720. #ifndef __LinearSigmoidAxon_H__
  721. #define __LinearSigmoidAxon_H__
  722.  
  723.  
  724. class LinearSigmoidAxon: public SigmoidAxon {
  725. public:
  726.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f *= m_fBeta; if (f<0.0f) f=0.0f; else if (f>1.0f) f=1.0f; };
  727.         void fireMap(void);
  728. };
  729.  
  730. #endif // __LinearSigmoidAxon_H__
  731.  
  732. // Author: Wesley Curtis Lefebvre
  733.  
  734. #ifndef __LinearTanhAxonAxon_H__
  735. #define __LinearTanhAxonAxon_H__
  736.  
  737.  
  738. class LinearTanhAxon: public TanhAxon {
  739. public:
  740.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f *= m_fBeta; if (f<-1.0f) f=-1.0f; else if (f>1.0f) f=1.0f; };
  741.         void fireMap(void);
  742. };
  743.  
  744. #endif // __LinearTanhAxonAxon_H__
  745.  
  746. // Author: Wesley Curtis Lefebvre
  747.  
  748. #ifndef __SoftMaxAxon_H__
  749. #define __SoftMaxAxon_H__
  750.  
  751.  
  752. class SoftMaxAxon: public LinearAxon {
  753. public:
  754.         SoftMaxAxon();
  755.         void fireInline(register NSFloat &f, register NSFloat &fw) { f = 1.0f; };
  756.         void fireMap(void);
  757. };
  758.  
  759. #endif // __SoftMaxAxon_H__
  760.  
  761. // Author: Wesley Curtis Lefebvre
  762.  
  763. #ifndef __WinnerTakeAllAxon_H__
  764. #define __WinnerTakeAllAxon_H__
  765.  
  766.  
  767. class WinnerTakeAllAxon: public Axon {
  768. protected:
  769.         BOOL    m_bMaxWinner;
  770.         SpatialAccess    *winningPEAccess;
  771.         NSFloat            m_fWinningPE;
  772.  
  773. public:
  774.         WinnerTakeAllAxon();
  775.         ~WinnerTakeAllAxon();
  776.         void fireMap(void);
  777.         BOOL maxWinner() { return m_bMaxWinner; };
  778.         void setMaxWinner(BOOL aBOOL) { m_bMaxWinner = aBOOL; };
  779.         void setWinningPEAccess(SpatialAccess *anId);
  780. };
  781.  
  782. #endif // __WinnerTakeAllAxon_H__
  783.  
  784. // Author: Wesley Curtis Lefebvre
  785.  
  786. #ifndef __ThresholdAxon_H__
  787. #define __ThresholdAxon_H__
  788.  
  789.  
  790. class ThresholdAxon: public BiasAxon {
  791. public:
  792.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f = f>0? 1.0f: -1.0f; };
  793.         void fireMap(void);
  794. };
  795.  
  796. #endif // __ThresholdAxon_H__
  797.  
  798. // Author: Wesley Curtis Lefebvre
  799.  
  800. #ifndef __GaussianAxon_H__
  801. #define __GaussianAxon_H__
  802.  
  803.  
  804. class GaussianAxon: public LinearAxon {
  805. protected:
  806.         class FullSynapse *m_pFullSynapse;
  807.         int     m_iNeighbors, m_iMetric;
  808.         BOOL    m_bBetaDataLocal, m_bNormalize;
  809. public:
  810.         class SpatialData *variance;
  811.         GaussianAxon();
  812.         ~GaussianAxon();
  813.         void assignCenters();
  814.         void assignVariance();
  815.         void fireInline(NSFloat &f, NSFloat &fw, NSFloat &fv) { BiasAxon::fireInline(f,fw); f = (NSFloat)exp(-fv*f*f); };
  816.         void fireMap(void);
  817.         void initialize();
  818.         void loadWeights(FILE *, unsigned short int version=100);
  819.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  820.         int neighbors() { return m_iNeighbors; };
  821.         int metric() { return m_iMetric; };
  822.         void setBeta(NSFloat);
  823.         void setBetaData(SpatialData *);
  824.         void setMetric(int anInt) { m_iMetric = anInt; };
  825.         void setNeighbors(int);
  826.         void setFullSynapse(FullSynapse *anId) { m_pFullSynapse = anId; };
  827.         void setNormalize(BOOL aBool) { m_bNormalize = aBool; };
  828.         BOOL normalize() { return m_bNormalize; };
  829. };
  830.  
  831. #endif // __GaussianAxon_H__
  832.  
  833. // Author: Wesley Curtis Lefebvre
  834.  
  835. #ifndef __TDNNAxon_H__
  836. #define __TDNNAxon_H__
  837.  
  838.  
  839. typedef void (*TDNNAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int);
  840. typedef void (*TDNNAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, void *);
  841. typedef DLLData *(*TDNNAxon_Constructor)(DLLData *, int, int, int);
  842. typedef DLLData *(*TDNNAxon_Constructor_CSW)(DLLData *, int, int, int, void *);
  843.  
  844. class TDNNAxon: public Axon {
  845.         Soma *delayedReference;
  846. protected:
  847.         int memoryTaps, delay;
  848. public:
  849.         TDNNAxon();
  850.         void activityAltered(void);
  851.         void setTemporalDimension(int T);
  852.         void loadWeights(FILE *, unsigned short int version=100);
  853.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  854.         const char *dllFunctionName();
  855.         void fireDLL(void);
  856.         void fireMap(void);
  857.         void initialize(void);
  858.         void constructDLL(void);
  859.         void incrementTime(void);
  860.         void decrementTime(void);
  861.         void loadStateVariables(FILE *file, unsigned short int version);
  862.         void saveStateVariables(FILE *file);
  863.         void recallBufPosition(void);
  864.         void setDelay(int anInt);
  865.         void setInputCells(int anInt);
  866.         void setOutputCells(int anInt);
  867.         void setMemoryTaps(int anInt);
  868.         void setTapDelay(int anInt);
  869.         void setTaps(int anInt);
  870.         void storeBufPosition(void);
  871.         int tapDelay(void) { return delay; };
  872.         int taps(void) { return memoryTaps; };
  873.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  874.         void zeroState(void);
  875.         ~TDNNAxon(void);
  876. };
  877.  
  878. #endif // __TDNNAxon_H__
  879.  
  880. // Author: Wesley Curtis Lefebvre
  881.  
  882. #ifndef __GammaAxon_H__
  883. #define __GammaAxon_H__
  884.  
  885.  
  886. typedef void (*GammaAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *);
  887. typedef void (*GammaAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, void *);
  888.  
  889. class GammaAxon: public TDNNAxon {
  890. public:
  891.         const char *dllFunctionName();
  892.         void fireDLL(void);
  893.         void fireMap(void);
  894.         void initialize(void);
  895.         void networkRandomize(void);
  896.         void rangeLinks(void);
  897. };
  898.  
  899. #endif // __GammaAxon_H__
  900.  
  901. // Author: Wesley Curtis Lefebvre
  902.  
  903. #ifndef __LaguarreAxon_H__
  904. #define __LaguarreAxon_H__
  905.  
  906.  
  907. class LaguarreAxon: public GammaAxon {
  908. public:
  909.         void initialize(void);
  910.         void fireMap(void);
  911.         void networkRandomize(void);
  912.         void rangeLinks(void);
  913. };
  914.  
  915. #endif // __LaguarreAxon_H__
  916.  
  917. // Author: Wesley Curtis Lefebvre
  918.  
  919. #ifndef __ContextAxon_H__
  920. #define __ContextAxon_H__
  921.  
  922.  
  923. typedef void (*ContextAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat);
  924. typedef void (*ContextAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat, void *);
  925.  
  926. class ContextAxon: public LinearAxon {
  927.         Soma *delayedReference;
  928. protected:
  929.         int delay;
  930. public:
  931.         ContextAxon();
  932.         const char *dllFunctionName();
  933.         void fireDLL(void);
  934.         void fireMap(void);
  935.         void incrementTime(void);
  936.         void decrementTime(void);
  937.         void initialize(void);
  938.         void rangeLinks();
  939.         void recallBufPosition(void);
  940.         void loadStateVariables(FILE *file, unsigned short int version);
  941.         void saveStateVariables(FILE *file);
  942.         void storeBufPosition(void);
  943.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  944.         void zeroState(void);
  945.         ~ContextAxon(void);
  946. };
  947.  
  948. #endif // __ContextAxon_H__
  949.  
  950. // Author: Wesley Curtis Lefebvre
  951.  
  952. #ifndef __SigmoidContextAxon_H__
  953. #define __SigmoidContextAxon_H__
  954.  
  955.  
  956. class SigmoidContextAxon: public ContextAxon {
  957. public:
  958.         void fireMap();
  959. };
  960.  
  961. #endif // __SigmoidContextAxon_H__
  962.  
  963. // Author: Wesley Curtis Lefebvre
  964.  
  965. #ifndef __TanhContextAxon_H__
  966. #define __TanhContextAxon_H__
  967.  
  968.  
  969. class TanhContextAxon: public ContextAxon {
  970. public:
  971.         void fireMap();
  972. };
  973.  
  974. #endif // __TanhContextAxon_H__
  975.  
  976. // Author: Wesley Curtis Lefebvre
  977.  
  978. #ifndef __IntegratorAxon_H__
  979. #define __IntegratorAxon_H__
  980.  
  981.  
  982. class IntegratorAxon: public ContextAxon {
  983. public:
  984.         void fireMap(void);
  985. };
  986.  
  987. #endif // __IntegratorAxon_H__
  988.  
  989. // Author: Wesley Curtis Lefebvre
  990.  
  991. #ifndef __SigmoidIntegratorAxon_H__
  992. #define __SigmoidIntegratorAxon_H__
  993.  
  994.  
  995. class SigmoidIntegratorAxon: public IntegratorAxon {
  996. public:
  997.         void fireMap();
  998. };
  999.  
  1000. #endif // __SigmoidIntegratorAxon_H__
  1001.  
  1002. // Author: Wesley Curtis Lefebvre
  1003.  
  1004. #ifndef __TanhIntegratorAxon_H__
  1005. #define __TanhIntegratorAxon_H__
  1006.  
  1007.  
  1008. class TanhIntegratorAxon: public IntegratorAxon {
  1009. public:
  1010.         void fireMap();
  1011. };
  1012.  
  1013. #endif // __TanhIntegratorAxon_H__
  1014.  
  1015. // Author: Wesley Curtis Lefebvre
  1016.  
  1017. #ifndef __Synapse_H__
  1018. #define __Synapse_H__
  1019.  
  1020.  
  1021. typedef void (*Synapse_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int);
  1022. typedef void (*Synapse_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, void *);
  1023. typedef DLLData *(*Synapse_Constructor)(DLLData *, int, int, int, int);
  1024. typedef DLLData *(*Synapse_Constructor_CSW)(DLLData *, int, int, int, int, void *);
  1025.  
  1026. class Synapse: public Soma {
  1027. //      class NAccess *initializationAccess;
  1028. public:
  1029.         Axon *Last, *Feed;
  1030.         Synapse();
  1031.         ~Synapse();
  1032.         virtual void allocateSynapticLinks(void);
  1033.         void detachYourself(void);
  1034. //      void exemplarStarting(void) { initializationAccess->dataAt(&V(0)); };
  1035.         void constructDLL(void);
  1036.         const char *dllFunctionName();
  1037.         virtual void fireDLL();
  1038.         void fire(void);
  1039.         virtual void fireFeed(void);
  1040.         BOOL isASynapse(void) { return TRUE; };
  1041.         void loadStateVariables(FILE *file, unsigned short int version);
  1042.         void saveStateVariables(FILE *file);
  1043.         void removeLast(Soma *aSoma);
  1044.         void removeNext(Soma *aSoma);
  1045.         void retryConnections();
  1046.         void setDLLFunction(DLLStruct *);
  1047. //      void setInitializationAccess(NAccess *);
  1048.         void setInputCells(int numberOfCells) { Soma::setInputCells(U()); };
  1049.         void setLast(Soma *aSoma);
  1050.         void setOutputCells(int numberOfCells) { Soma::setOutputCells(V()); };
  1051.         void setNext(Soma *aSoma);
  1052.         void setTemporalDimension(int T);
  1053.         void zeroState();
  1054. };
  1055.  
  1056. #endif __Synapse_H__
  1057.  
  1058. // Author: Wesley Curtis Lefebvre
  1059.  
  1060. #ifndef __FullSynapse_H__
  1061. #define __FullSynapse_H__
  1062.  
  1063.  
  1064. typedef void (*FullSynapse_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  1065. typedef void (*FullSynapse_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  1066.  
  1067. class FullSynapse: public Synapse {
  1068. public:
  1069.         NSFloat &W(int i, int j) {return w(j+i*V());};
  1070.         void allocateSynapticLinks(void);
  1071.         const char *dllFunctionName();
  1072.         void linksAltered(void);
  1073.         void fireDLL();
  1074.         void fireFeed(void);
  1075. };
  1076.  
  1077. #endif // __FullSynapse_H__
  1078.  
  1079. // SVMOutputSynapse
  1080.  
  1081. #ifndef __SVMOutputSynapse_H__
  1082. #define __SVMOutputSynapse_H__
  1083.  
  1084.  
  1085. class SVMOutputSynapse: public FullSynapse {
  1086.  
  1087. protected:
  1088.     NSFloat            *m_fpDesiredMatrix;
  1089.     NSFloat            *m_fSVMBiasVector;
  1090.     BOOL            m_bRunningFirstEpoch;
  1091.  
  1092. public:
  1093.                     SVMOutputSynapse();
  1094.     NSFloat            biasElement(int outIndex) { return m_fSVMBiasVector ? *(m_fSVMBiasVector+outIndex) : 0.0f; };
  1095.     NSFloat            desiredElement(int outIndex, int exemplar) { return m_fpDesiredMatrix ? *(m_fpDesiredMatrix+outIndex*V()+exemplar) : 0.0f; };
  1096.     void            epochEnded();
  1097.     void            fireFeed(void);
  1098.     void            linksAltered(void);
  1099.     void            loadStateVariables(FILE *file, unsigned short int version);
  1100.     void            networkReset();
  1101.     void            saveStateVariables(FILE *file);
  1102.     void            setBiasElement(int outIndex, NSFloat aFloat) { if (m_fSVMBiasVector) *(m_fSVMBiasVector+outIndex) = aFloat; };
  1103.     void            setDesiredElement(int outIndex, int exemplar, NSFloat aFloat);
  1104.     void            setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  1105.     BOOL            runningFirstEpoch() { return m_bRunningFirstEpoch; };
  1106.     void            updateSVMBiasElement(int outIndex, int exemplar, NSFloat dAlpha) { if (m_fSVMBiasVector && m_fpDesiredMatrix) *(m_fSVMBiasVector+outIndex) += *(m_fpDesiredMatrix+outIndex*V()+exemplar) * dAlpha; };
  1107. };
  1108.  
  1109. #endif // __SVMOutputSynapse_H__
  1110.  
  1111.  
  1112. // Author: Wesley Curtis Lefebvre
  1113.  
  1114. #ifndef __ArbitrarySynapse_H__
  1115. #define __ArbitrarySynapse_H__
  1116.  
  1117.  
  1118. class ArbitrarySynapse: public Synapse {
  1119.         class ConnectionList *connections;
  1120. public:
  1121.         ArbitrarySynapse();
  1122.         void loadWeights(FILE *, unsigned short int version=100);
  1123.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  1124.         ConnectionList *connectionList(void) { return connections;};
  1125.         const char *dllFunctionName();
  1126.         void fireFeed();
  1127.         void useConnectionList(ConnectionList *aList) { connections = aList; };
  1128. };
  1129.  
  1130. #endif // __ArbitrarySynapse_H__
  1131.  
  1132. // Author: Wesley Curtis Lefebvre
  1133. // Name: FunctionIO.h
  1134.  
  1135. #ifndef __FunctionIO_h__
  1136. #define __FunctionIO_h__
  1137.  
  1138.  
  1139. typedef void (*FunctionIO_MAP)(NSFloat *, int, int);
  1140. typedef void (*FunctionIO_MAP_CSW)(NSFloat *, int, int, void *);
  1141.  
  1142. class FunctionIO: public InputSpatialData
  1143. {
  1144. protected:
  1145.         void    *m_pFunction;
  1146.         void    *m_pCallingObject;
  1147.         RW      m_readWrite;
  1148. public:
  1149.                         FunctionIO();
  1150.         void    reportSpatialData();
  1151.         void    setFunction(void *aFunction, void *callingObject=NULL);
  1152.         void    setMode(RW readWrite);
  1153. };
  1154.  
  1155. #endif // __FunctionIO_h__
  1156.  
  1157. // Author: Wesley Curtis Lefebvre
  1158.  
  1159. #ifndef __BackAxon_H__
  1160. #define __BackAxon_H__
  1161.  
  1162.  
  1163. typedef void (*BackAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *);
  1164. typedef void (*BackAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, void *);
  1165. typedef DLLData *(*BackAxon_Constructor)(DLLData *, DLLData *, int, int);
  1166. typedef DLLData *(*BackAxon_Constructor_CSW)(DLLData *, DLLData *, int, int, void *);
  1167.  
  1168. class BackAxon: public Axon {
  1169. protected:
  1170.         BOOL gradientsEnabled;
  1171.         NSFloat *m_fWeightingVector;
  1172.         int m_nWeightingVectorSize;
  1173.         int m_nCurrentExemplar;
  1174. public:
  1175.         Axon *Dual;
  1176. public:
  1177.         BackAxon();
  1178.         void activityAltered();
  1179.         void linksAltered();
  1180.         virtual void backpropComplete();
  1181.         void backpropStarting();
  1182.         void constructDLL();
  1183.         void networkRandomize();
  1184.         void setBackpropOffset(int);
  1185.         void setCurrentExemplar(int exemplar);
  1186.         virtual void setDual(Soma *);
  1187.         void setGradientsEnabled(BOOL);
  1188.         void setWeightingVector(NSFloat *aVector, int vectorSize);
  1189.         void updateExemplarCounter();
  1190.         // Overridden virtual functions
  1191.         const char *dllFunctionName();
  1192.         void fireDLL();
  1193.         void fire();
  1194.         void incrementTime();
  1195.         void setInputCells(int) { Soma::setInputCells(U()); };
  1196.         void setOutputCells(int) { Soma::setOutputCells(V()); };
  1197. };
  1198.  
  1199. #endif // __BackAxon_H__
  1200.  
  1201. //BackFuzzyAxon
  1202.  
  1203. #ifndef __BackFuzzyAxon_H__
  1204. #define __BackFuzzyAxon_H__
  1205.  
  1206. typedef void (*BackFuzzyAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, int, int, NSFloat, NSFloat *);
  1207. typedef void (*BackFuzzyAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, int, int, NSFloat, NSFloat *, void *);
  1208.  
  1209. class BackFuzzyAxon: public BackAxon {
  1210. public:
  1211.     // DLL Code Here
  1212.             void        activityAltered(void);
  1213.             NSFloat        computeDerivative(int weightIndex, int outputIndex, BOOL dllActive);
  1214.             const char *dllFunctionName();
  1215.     virtual    NSFloat        derivative(int weightIndex, int outputIndex) = 0;
  1216.             void        fireDLL(void);
  1217.             void        fireMap();
  1218.             void        initialize();
  1219. };
  1220.  
  1221. #endif // __BackFuzzyAxon_H__
  1222.  
  1223. //BackBellFuzzyAxon
  1224.  
  1225. #ifndef __BackBellFuzzyAxon_H__
  1226. #define __BackBellFuzzyAxon_H__
  1227.  
  1228. class BackBellFuzzyAxon: public BackFuzzyAxon {
  1229. public:
  1230.     // DLL Code Here
  1231.     NSFloat        derivative(int weightIndex, int outputIndex);
  1232. };
  1233.  
  1234. #endif // __BackBellFuzzyAxon_H__
  1235.  
  1236. //BackGaussianFuzzyAxon
  1237.  
  1238. #ifndef __BackGaussianFuzzyAxon_H__
  1239. #define __BackGaussianFuzzyAxon_H__
  1240.  
  1241. class BackGaussianFuzzyAxon: public BackFuzzyAxon {
  1242. public:
  1243.     // DLL Code Here
  1244.     NSFloat        derivative(int weightIndex, int outputIndex);
  1245. };
  1246.  
  1247. #endif // __BackGaussianFuzzyAxon_H__
  1248.  
  1249. //BackCombinerAxon
  1250.  
  1251. #ifndef __BackCombinerAxon_H__
  1252. #define __BackCombinerAxon_H__
  1253.  
  1254. class BackCombinerAxon: public BackAxon {
  1255. public:
  1256.     void        fireMap(void);
  1257. };
  1258.  
  1259. #endif // __BackCombinerAxon_H__
  1260.  
  1261.  
  1262. //BackNormalizedAxon
  1263.  
  1264. #ifndef __BackNormalizedAxon_H__
  1265. #define __BackNormalizedAxon_H__
  1266.  
  1267. class BackNormalizedAxon: public BackAxon {
  1268. public:
  1269.     void fireMap(void);
  1270. };
  1271.  
  1272. #endif // __BackNormalizedAxon_H__
  1273.  
  1274.  
  1275. // Author: Wesley Curtis Lefebvre
  1276.  
  1277. #ifndef __BackBiasAxon_H__
  1278. #define __BackBiasAxon_H__
  1279.  
  1280.  
  1281. typedef void (*BackBiasAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *);
  1282. typedef void (*BackBiasAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, void *);
  1283.  
  1284. class BackBiasAxon: public BackAxon {
  1285. public:
  1286.         const char *dllFunctionName();
  1287.         void fireDLL();
  1288.         void fireMap();
  1289.         void initialize();
  1290. };
  1291.  
  1292. #endif // __BackBiasAxon_H__
  1293.  
  1294. // Author: Wesley Curtis Lefebvre
  1295.  
  1296. #ifndef __BackLinearAxon_H__
  1297. #define __BackLinearAxon_H__
  1298.  
  1299.  
  1300. typedef void (*BackLinearAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *,NSFloat);
  1301. typedef void (*BackLinearAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *,NSFloat,void *);
  1302.  
  1303. class BackLinearAxon: public BackBiasAxon {
  1304. protected:
  1305.         NSFloat m_fOffset;
  1306.         class LinearAxon *linearAxon() { return (LinearAxon*)Dual; };
  1307. public:
  1308.         BackLinearAxon();
  1309.         const char *dllFunctionName();
  1310.         void fireDLL();
  1311.         void fireMap();
  1312.         NSFloat offset() { return m_fOffset; };
  1313.         void setOffset(NSFloat aFloat) { m_fOffset = aFloat; };
  1314. };
  1315.  
  1316. #endif // __BackLinearAxon_H__
  1317.  
  1318. // Author: Wesley Curtis Lefebvre
  1319.  
  1320. #ifndef __BackSigmoidAxon_H__
  1321. #define __BackSigmoidAxon_H__
  1322.  
  1323.  
  1324. class BackSigmoidAxon: public BackLinearAxon {
  1325. public:
  1326.         void fireMap();
  1327. };
  1328.  
  1329. #endif // __BackSigmoidAxon_H__
  1330.  
  1331. //BackNormalizedSigmoidAxon
  1332.  
  1333. #ifndef __BackNormalizedSigmoidAxon_H__
  1334. #define __BackNormalizedSigmoidAxon_H__
  1335.  
  1336. class BackNormalizedSigmoidAxon: public BackSigmoidAxon {
  1337. public:
  1338.     void fireMap(void);
  1339. };
  1340.  
  1341. #endif // __BackNormalizedSigmoidAxon_H__
  1342.  
  1343. // Author: Wesley Curtis Lefebvre
  1344.  
  1345. #ifndef __BackTanhAxon_H__
  1346. #define __BackTanhAxon_H__
  1347.  
  1348.  
  1349. class BackTanhAxon: public BackLinearAxon {
  1350. public:
  1351.         void fireMap();
  1352. };
  1353.  
  1354. #endif // __BackTanhAxon_H__
  1355.  
  1356. // Author: Wesley Curtis Lefebvre
  1357.  
  1358. #ifndef __BackTDNNAxon_H__
  1359. #define __BackTDNNAxon_H__
  1360.  
  1361.  
  1362. typedef void (*BackTDNNAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *);
  1363. typedef void (*BackTDNNAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, void *);
  1364. typedef DLLData *(*BackTDNNAxon_Constructor)(DLLData *, DLLData *, int, int, int);
  1365. typedef DLLData *(*BackTDNNAxon_Constructor_CSW)(DLLData *, DLLData *, int, int, int, void *);
  1366.  
  1367. class BackTDNNAxon: public BackAxon {
  1368.         Soma *delayedReference;
  1369. protected:
  1370.         int memoryTaps;
  1371. public:
  1372.         BackTDNNAxon();
  1373.         void activityAltered(void);
  1374.         void backpropComplete();
  1375.         void constructDLL(void);
  1376.         const char *dllFunctionName();
  1377.         void fireDLL();
  1378.         void fireMap(void);
  1379.         void incrementTime(void);
  1380.         void initialize(void);
  1381.         void loadStateVariables(FILE *file, unsigned short int version);
  1382.         void saveStateVariables(FILE *file);
  1383.         void setMemoryTaps(int anInt);
  1384.         int taps(void) { return memoryTaps; };
  1385.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  1386.         void zeroState(void);
  1387.         ~BackTDNNAxon(void);
  1388. };
  1389.  
  1390. #endif // __BackTDNNAxon_H__
  1391.  
  1392. // Author: Wesley Curtis Lefebvre
  1393.  
  1394. #ifndef __BackGammaAxon_H__
  1395. #define __BackGammaAxon_H__
  1396.  
  1397.  
  1398. typedef void (*BackGammaAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, NSFloat *, NSFloat *);
  1399. typedef void (*BackGammaAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, NSFloat *, NSFloat *, void *);
  1400.  
  1401. class BackGammaAxon: public BackTDNNAxon {
  1402. public:
  1403.         const char *dllFunctionName();
  1404.         void fireDLL();
  1405.         void fireMap(void);
  1406.         void initialize(void);
  1407. };
  1408.  
  1409. #endif // __BackGammaAxon_H__
  1410.  
  1411. // Author: Wesley Curtis Lefebvre
  1412. // Name:        Connection.h
  1413.  
  1414. #ifndef __Connection_h__
  1415. #define __Connection_h__
  1416.  
  1417.  
  1418. class Connection {
  1419.         int fromIndex, *toIndices, toCount, toAllocated;
  1420. public:
  1421.         Connection();
  1422.         ~Connection();
  1423.         void addConnection(int index);
  1424.         void allocateConnections(int number);
  1425.         int *connections(void) { return toIndices; };
  1426.         int count(void) { return toCount; };
  1427.         void empty(void);
  1428.         int feedingIndex(void) { return fromIndex; };
  1429.         void insertConnectionAt(int toIndex, int index);
  1430.         void removeConnection(int index);
  1431.         void setIndex(int index) {fromIndex = index; };
  1432.         Connection &operator=(Connection &aConnection);
  1433. };
  1434.  
  1435. #endif // __Connection_h__
  1436.  
  1437. // Author: Wesley Curtis Lefebvre
  1438.  
  1439. #ifndef __ConnectionList_h__
  1440. #define __ConnectionList_h__
  1441.  
  1442.  
  1443. class ConnectionList {
  1444.         class Connection **synapse;
  1445.         int synapseCount, synapseAllocated;
  1446. public:
  1447.         ConnectionList();
  1448.         ~ConnectionList(void);
  1449.         void addConnection(int fromIndex, int toIndex);
  1450.         void allocateSynapse(int number);
  1451.         Connection *connectionAt(int index) { return synapse[index]; };
  1452.         int count(void) { return synapseCount; };
  1453.         void empty(void);
  1454.         void insertConnectionAt(int fromIndex, int toIndex, int index);
  1455.         void removeConnection(int fromIndex, int toIndex);
  1456.         int weights(void);
  1457. };
  1458.  
  1459. #endif // __ConnectionList_h__
  1460.  
  1461. // Author: Wesley Curtis Lefebvre
  1462.  
  1463. #ifndef __BackLaguarreAxon_H__
  1464. #define __BackLaguarreAxon_H__
  1465.  
  1466.  
  1467. class BackLaguarreAxon: public BackGammaAxon {
  1468. public:
  1469.         void fireMap(void);
  1470.         void initialize(void);
  1471. };
  1472.  
  1473. #endif // __BackLaguarreAxon_H__
  1474.  
  1475. // Author: Wesley Curtis Lefebvre
  1476.  
  1477. #ifndef __BackContextAxon_H__
  1478. #define __BackContextAxon_H__
  1479.  
  1480.  
  1481. typedef void (*BackContextAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat *);
  1482. typedef void (*BackContextAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat *, void *);
  1483.  
  1484. class BackContextAxon: public BackLinearAxon {
  1485. protected:
  1486.         Soma *delayedReference;
  1487.         NSFloat m_fOffset;
  1488. public:
  1489.         BackContextAxon();
  1490.         const char *dllFunctionName();
  1491.         void fireDLL(void);
  1492.         void fireMap(void);
  1493.         void incrementTime(void);
  1494.         void initialize(void);
  1495.         void loadStateVariables(FILE *file, unsigned short int version);
  1496.         void saveStateVariables(FILE *file);
  1497.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  1498.         void zeroState(void);
  1499.         ~BackContextAxon(void);
  1500. };
  1501.  
  1502. #endif // __BackContextAxon_H__
  1503.  
  1504. // Author: Wesley Curtis Lefebvre
  1505.  
  1506. #ifndef __BackSigmoidContextAxon_H__
  1507. #define __BackSigmoidContextAxon_H__
  1508.  
  1509.  
  1510. class BackSigmoidContextAxon: public BackContextAxon {
  1511. public:
  1512.         void fireMap(void);
  1513. };
  1514.  
  1515. #endif // __BackSigmoidContextAxon_H__
  1516.  
  1517. // Author: Wesley Curtis Lefebvre
  1518.  
  1519. #ifndef __BackTanhContextAxon_H__
  1520. #define __BackTanhContextAxon_H__
  1521.  
  1522.  
  1523. class BackTanhContextAxon: public BackContextAxon {
  1524. public:
  1525.         void fireMap(void);
  1526. };
  1527.  
  1528. #endif // __BackTanhContextAxon_H__
  1529.  
  1530. // Author: Wesley Curtis Lefebvre
  1531.  
  1532. #ifndef __BackIntegratorAxon_H__
  1533. #define __BackIntegratorAxon_H__
  1534.  
  1535.  
  1536. class BackIntegratorAxon: public BackContextAxon {
  1537. public:
  1538.         void fireMap(void);
  1539. };
  1540.  
  1541. #endif // __BackIntegratorAxon_H__
  1542.  
  1543. // Author: Wesley Curtis Lefebvre
  1544.  
  1545. #ifndef __BackSigmoidIntegratorAxon_H__
  1546. #define __BackSigmoidIntegratorAxon_H__
  1547.  
  1548.  
  1549. class BackSigmoidIntegratorAxon: public BackIntegratorAxon {
  1550. public:
  1551.         void fireMap(void);
  1552. };
  1553.  
  1554. #endif // __BackSigmoidIntegratorAxon_H__
  1555.  
  1556. // Author: Wesley Curtis Lefebvre
  1557.  
  1558. #ifndef __BackTanhIntegratorAxon_H__
  1559. #define __BackTanhIntegratorAxon_H__
  1560.  
  1561.  
  1562. class BackTanhIntegratorAxon: public BackIntegratorAxon {
  1563. public:
  1564.         void fireMap(void);
  1565. };
  1566.  
  1567. #endif // __BackTanhIntegratorAxon_H__
  1568.  
  1569. // Author: Wesley Curtis Lefebvre
  1570.  
  1571. #ifndef __BackSynapse_H__
  1572. #define __BackSynapse_H__
  1573.  
  1574.  
  1575. typedef void (*BackSynapse_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  1576. typedef void (*BackSynapse_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  1577. typedef DLLData *(*BackSynapse_Constructor)(DLLData *, DLLData *, int, int, int, int);
  1578. typedef DLLData *(*BackSynapse_Constructor_CSW)(DLLData *, DLLData *, int, int, int, int, void *);
  1579.  
  1580. class BackSynapse: public Synapse {
  1581. protected:
  1582.         BOOL gradientsEnabled;
  1583.         NSFloat *m_fWeightingVector;
  1584.         int m_nWeightingVectorSize;
  1585.         int m_nCurrentExemplar;
  1586. public:
  1587.         Synapse *Dual;
  1588. public:
  1589.         BackSynapse();
  1590.         void activityAltered();
  1591.         const char *dllFunctionName();
  1592.         void fireDLL();
  1593.         void linksAltered();
  1594.         void backpropComplete();
  1595.         void backpropStarting();
  1596.         void constructDLL();
  1597.         void networkRandomize();
  1598.         virtual void setDual(Soma *);
  1599.         void setCurrentExemplar(int exemplar);
  1600.         void setGradientsEnabled(BOOL);
  1601.         void setWeightingVector(NSFloat *aVector, int vectorSize);
  1602.         void updateExemplarCounter();
  1603.         // Overridden virtual functions
  1604.         void fire();
  1605.         void incrementTime();
  1606. };
  1607.  
  1608. #endif // __BackSynapse_H__
  1609.  
  1610. // Author: Wesley Curtis Lefebvre
  1611.  
  1612. #ifndef __BackFullSynapse_H__
  1613. #define __BackFullSynapse_H__
  1614.  
  1615.  
  1616. typedef void (*BackFullSynapse_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *);
  1617. typedef void (*BackFullSynapse_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, void *);
  1618.  
  1619. class BackFullSynapse: public BackSynapse {
  1620. protected:
  1621.         NSFloat &W(int i, int j) { return Dual->w(i+j*U()); };
  1622. public:
  1623.         void allocateSynapticLinks();
  1624.         const char *dllFunctionName();
  1625.         void fireDLL();
  1626.         void fireFeed();
  1627.         void linksAltered();
  1628. };
  1629.  
  1630. #endif // __BackFullSynapse_H__
  1631.  
  1632. // Author: Wesley Curtis Lefebvre
  1633.  
  1634. #ifndef __BackArbitrarySynapse_H__
  1635. #define __BackArbitrarySynapse_H__
  1636.  
  1637.  
  1638. class BackArbitrarySynapse: public BackSynapse {
  1639.         class ConnectionList *connections;
  1640. public:
  1641.         void allocateSynapticLinks(void);
  1642.         const char *dllFunctionName();
  1643.         void fireFeed(void);
  1644.         void setDual(Soma *aSoma);
  1645. };
  1646.  
  1647. #endif // __BackArbitrarySynapse_H__
  1648.  
  1649. // Author: Wesley Curtis Lefebvre
  1650.  
  1651. #ifndef __BackCriteriaControl_H__
  1652. #define __BackCriteriaControl_H__
  1653.  
  1654.  
  1655. class BackCriteriaControl: public BackAxon {
  1656. protected:
  1657.         BOOL streamFixed;
  1658. protected:
  1659.         void fireMap();
  1660. public:
  1661.         BackCriteriaControl();
  1662.         const char *dllFunctionName();
  1663.         void fixStream(BOOL aFlag) { streamFixed = aFlag; };
  1664.         void incrementTime();
  1665. };
  1666.  
  1667. #endif // __BackCriteriaControl_H__
  1668.  
  1669. // Author: Wesley Curtis Lefebvre
  1670.  
  1671. #ifndef __Criterion_H__
  1672. #define __Criterion_H__
  1673.  
  1674.  
  1675. typedef NSFloat (*Criterion_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, BOOL);
  1676. typedef NSFloat (*Criterion_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, BOOL, void *);
  1677.  
  1678. class Criterion: public Axon {
  1679.         int                                m_iSaveCounter,
  1680.                                         tempCounter,
  1681.                                         m_iCheckCostEvery,
  1682.                                         m_iSensitivityCounter;
  1683.         NSFloat                         *m_fWeightingVector;
  1684.         int                             m_nWeightingVectorSize;
  1685.         int                             m_nCurrentExemplar,
  1686.                                         m_nTotalNetworkWeights,
  1687.                                         m_nConfusionRows;
  1688. public:
  1689.         int                             costCounter;
  1690.         BOOL                            m_bIgnoreNextError;
  1691.         NSFloat                            *m_fOffsetVector;
  1692.  
  1693. protected:
  1694.         BOOL                            testing,
  1695.                                         m_bAutoSave,
  1696.                                         m_bOnIncrease,
  1697.                                         m_bTrainBestCostUpdated,
  1698.                                         m_bSensitivity;
  1699.         double                            *m_dfSumYY,
  1700.                                         *m_dfSumY,
  1701.                                         *m_dfTempSumY,
  1702.                                         *m_dfSumXY,
  1703.                                         *m_dfSumX,
  1704.                                         *m_dfSumXX,
  1705.                                         *m_dfTempSumXY,
  1706.                                         *m_dfTempSumX,
  1707.                                         *m_dfTempSumXX,
  1708.                                         *m_dfTempSumYY;
  1709.         NSFloat                         E,
  1710.                                         m_fRunningMSE,
  1711.                                         m_fTempRunningMSE,
  1712.                                         m_fTempPercentError,
  1713.                                         runningE,
  1714.                                         m_fPercentError,
  1715.                                         m_fConfusionThreshold,
  1716.                                         m_fCorrelationAverage,
  1717.                                         m_fNMSE,
  1718.                                         m_fAIC,
  1719.                                         m_fMDL,
  1720.                                         *m_fROC,
  1721.                                         *m_fTempConfusion,
  1722.                                         *m_fConfusion,
  1723.                                         *m_fPerformanceMeasures,
  1724.                                         *m_fConfusionAsPercent,
  1725.                                         *m_fCorrelation,
  1726.                                         m_fLastReportedTrainBestCost,
  1727.                                         m_fLastReportedTestBestCost,
  1728.                                         m_fLastReportedTestCost,
  1729.                                         m_fLastReportedTrainCost,
  1730.                                         m_fLastUncheckedCost,
  1731.                                         m_fBestCost,
  1732.                                         m_fLastCost,
  1733.                                         m_nROCMinValue,
  1734.                                         m_nROCMaxValue,
  1735.                                         tempE,
  1736.                                         *desired;
  1737.         SpatialAccess                   *costAccess,
  1738.                                         *runningCostAccess,
  1739.                                         *performanceMeasuresAccess,
  1740.                                         *confusionAccess,
  1741.                                         *rOCAccess,
  1742.                                         *confusionAsPercentAccess,
  1743.                                         *correlationAccess,
  1744.                                         *desiredAccess;
  1745.         SpatialData                     *m_pFixedOutput,
  1746.                                         *m_pSensitivity,
  1747.                                         *m_pRawSensitivity,
  1748.                                         *m_pSensitivityTotals;
  1749.         BOOL                            m_bSensitivityDataLocal,
  1750.                                         m_bRawSensitivityDataLocal,
  1751.                                         m_bSensitivityTotalsDataLocal;
  1752.         int                                m_nROCThresholds,
  1753.                                         m_nROCChannel,
  1754.                                         *m_nTempROCCounters,
  1755.                                         *m_nROCCounters;
  1756. public:
  1757.                                         Criterion();
  1758.                                         ~Criterion();
  1759.         BOOL                    autoSave() { return m_bAutoSave; };
  1760.         NSFloat                    bestCost() { return m_fBestCost; };
  1761.         BOOL                    checkForSaveBest(BOOL, NSFloat, BOOL);
  1762.         BOOL                    checkForSaveBest(NSFloat, BOOL);
  1763.         void                    computePerformanceStats();
  1764.         virtual void            determineCost();
  1765.         virtual void            determineCostDerivative()=0;
  1766.         const char              *dllFunctionName();
  1767.         void                    epochEnded();
  1768.         void                    fireDLL();
  1769.         virtual void            fireGetReady();
  1770.         void                    fireMap();
  1771.         void                    fireSensitivity();
  1772.         void                    incrementTime();
  1773.         void                    ignoreNextError();
  1774.         void                    initialize();
  1775.         NSFloat                    lastReportedTestCost() { return m_fLastReportedTestCost; };
  1776.         NSFloat                    lastReportedTrainCost() { return m_fLastReportedTrainCost; };
  1777.         NSFloat                    lastUncheckedCost() { return m_fLastUncheckedCost; };
  1778.         void                    networkRandomize();
  1779.         void                    networkReset();
  1780.         void                    phaseEnded(int counter);
  1781.         NSFloat                 reportCost(BOOL reportSpatial = TRUE, BOOL resetCounter = TRUE);
  1782.         void                    reportPerformanceAccess();
  1783.         int                        saveCounter() { return m_iSaveCounter; };
  1784.         BOOL                    sensitivity() { return m_bSensitivity; };
  1785.         void                    setAutoSave(BOOL aBool) { m_bAutoSave = aBool; };
  1786.         void                    setBestCost(NSFloat aFloat) { m_fBestCost = aFloat; };
  1787.         void                    setCheckCostEvery(int anInt) { m_iCheckCostEvery = anInt; };
  1788.         void                    setConfusionAccess(SpatialAccess* anId);
  1789.         void                    setConfusionAsPercentAccess(SpatialAccess* anId);
  1790.         void                    setConfusionThreshold(NSFloat aFloat) { m_fConfusionThreshold = aFloat; };
  1791.         void                    setCorrelationAccess(SpatialAccess* anId);
  1792.         void                    setCostAccess(SpatialAccess *);
  1793.         void                    setCurrentExemplar(int exemplar);
  1794.         void                    setDesiredAccess(SpatialAccess *);
  1795.         void                    setOnIncrease(BOOL aBool) { m_bOnIncrease = aBool; };
  1796.         void                    setOffsetVector(NSFloat *aFloatPointer) { m_fOffsetVector = aFloatPointer; }
  1797.         void                    setPerformanceMeasuresAccess(SpatialAccess *anId);
  1798.         void                    setRunningCostAccess(SpatialAccess *);
  1799.         void                    setRawSensitivityData(SpatialData *anId);
  1800.         void                    setROCAccess(SpatialAccess* anId);
  1801.         void                    setROCThresholds(int anInt) { m_nROCThresholds = anInt; initialize(); };
  1802.         void                    setROCChannel(int anInt) { m_nROCChannel = anInt; };
  1803.         void                    setROCMinValue(NSFloat aFloat) { m_nROCMinValue = aFloat; };
  1804.         void                    setROCMaxValue(NSFloat aFloat) { m_nROCMaxValue = aFloat; };
  1805.         void                    setSaveCounter(int anInt) { m_iSaveCounter = anInt; };
  1806.         void                    setSensitivityData(SpatialData *);
  1807.         void                    setSensitivityTotalsData(SpatialData *);
  1808.         void                    setSensitivity(BOOL);
  1809.         virtual NSFloat         setTesting(BOOL);
  1810.         void                    setTotalNetworkWeights(int anInt) { m_nTotalNetworkWeights = anInt; };
  1811.         void                    setSensitivityInputs(int);
  1812.         void                    setWeightingVector(NSFloat *aVector, int vectorSize);
  1813.         void                    updateWeightedCost();
  1814.         BOOL                    isTesting() { return testing; };
  1815. };
  1816.  
  1817. #endif // __Criterion_H__
  1818.  
  1819. // Author: Wesley Curtis Lefebvre
  1820.  
  1821. #ifndef __L1Criterion_H__
  1822. #define __L1Criterion_H__
  1823.  
  1824.  
  1825. class L1Criterion: public Criterion {
  1826. protected:
  1827.         void determineCost();
  1828.         void determineCostDerivative();
  1829. };
  1830.  
  1831. #endif // __L1Criterion_H__
  1832.  
  1833. // Author: Wesley Curtis Lefebvre
  1834.  
  1835. #ifndef __L2Criterion_H__
  1836. #define __L2Criterion_H__
  1837.  
  1838.  
  1839. class L2Criterion: public Criterion {
  1840. protected:
  1841.         void determineCost();
  1842.         void determineCostDerivative();
  1843. };
  1844.  
  1845. #endif // __L2Criterion_H__
  1846.  
  1847. // SVML2Criterion
  1848.  
  1849. #ifndef __SVML2Criterion_H__
  1850. #define __SVML2Criterion_H__
  1851.  
  1852.  
  1853. class SVML2Criterion: public L2Criterion {
  1854. private:
  1855.     SVMOutputSynapse        *m_pOutputSynapse;
  1856.     BOOL                    m_bRunningFirstEpoch;
  1857.     int                        m_nExemplarCount;
  1858.  
  1859. public:
  1860.             SVML2Criterion();
  1861.     void    determineCost();
  1862.     void    determineCostDerivative();
  1863.     void    epochEnded();
  1864.     int        exemplarCount() { return m_nExemplarCount; };
  1865.     void    loadStateVariables(FILE *file, unsigned short int version);
  1866.     void    networkReset();
  1867.     BOOL    runningFirstEpoch() { return m_bRunningFirstEpoch; };
  1868.     void    saveStateVariables(FILE *file);
  1869.     void    setSVMOutputSynapse(SVMOutputSynapse *aSynapse) { m_pOutputSynapse = aSynapse; };
  1870.     void    setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  1871.     void    setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  1872.  
  1873. };
  1874.  
  1875. #endif // __SVML2Criterion_H__
  1876.  
  1877. // L2TemporalCriterion
  1878.  
  1879. #ifndef __L2TemporalCriterion_H__
  1880. #define __L2TemporalCriterion_H__
  1881.  
  1882.  
  1883. class L2TemporalCriterion: public Criterion {
  1884. protected:
  1885.     NSFloat                m_fLargeChangeRightDirectionScale,
  1886.                         m_fLargeChangeWrongDirectionScale,
  1887.                         m_fSmallChangeRightDirectionScale,
  1888.                         m_fSmallChangeWrongDirectionScale,
  1889.                         m_fRightDirectionScale,
  1890.                         m_fWrongDirectionScale,
  1891.                         m_fLargeChangeScale,
  1892.                         m_fSmallChangeScale,
  1893.                         *m_fLastActivity,
  1894.                         *m_fLastDesired,
  1895.                         m_fDiscountRate,
  1896.                         *m_fOverallScale;
  1897.     BOOL                m_bMagnitudeOfChange,
  1898.                         m_bDirectionOfChange,
  1899.                         m_bMemoryNeedsReallocating,
  1900.                         m_bDataPreDifferenced,
  1901.                         m_bRecencyOfObservation;
  1902.     int                    m_nActiveNumberOfExemplars,
  1903.                         m_nCVNumberOfExemplars,
  1904.                         m_nNumberOfExemplars,
  1905.                         m_nExemplarNumber,
  1906.                         m_nMode;
  1907.  
  1908.     void determineCost();
  1909.     void determineCostDerivative();
  1910.     NSFloat determineDirectionalProfitScale(NSFloat desired, NSFloat lastDesired, NSFloat activity, NSFloat lastActivity, NSFloat standardDeviation, NSFloat normalizationOffset);
  1911.     NSFloat determineDirectionScale(NSFloat desired, NSFloat lastDesired, NSFloat activity, NSFloat lastActivity, NSFloat normalizationOffset);
  1912.     NSFloat determineMagnitudeScale(NSFloat desired, NSFloat lastDesired, NSFloat standardDeviation);
  1913.     NSFloat determineRecencyScale();
  1914.     void initialize(void);
  1915.     void linksAltered(void);
  1916.  
  1917. public:
  1918.             L2TemporalCriterion();
  1919.             ~L2TemporalCriterion();
  1920.     void    epochEnded();
  1921.     void    fireGetReady();
  1922.     void    networkReset();
  1923.     NSFloat setTesting(BOOL);
  1924.     NSFloat    largeChangeRightDirectionScale() { return m_fLargeChangeRightDirectionScale; };
  1925.     NSFloat    largeChangeWrongDirectionScale() { return m_fLargeChangeWrongDirectionScale; };
  1926.     NSFloat    smallChangeRightDirectionScale() { return m_fSmallChangeRightDirectionScale; };
  1927.     NSFloat    smallChangeWrongDirectionScale() { return m_fSmallChangeWrongDirectionScale; };
  1928.     NSFloat    rightDirectionScale() { return m_fRightDirectionScale; };
  1929.     NSFloat    wrongDirectionScale() { return m_fWrongDirectionScale; };
  1930.     NSFloat    largeChangeScale() { return m_fLargeChangeScale; };
  1931.     NSFloat    smallChangeScale() { return m_fSmallChangeScale; };
  1932.     NSFloat    discountRate() { return m_fDiscountRate; };
  1933.     BOOL    magnitudeOfChange() { return m_bMagnitudeOfChange; };
  1934.     BOOL    directionOfChange() { return m_bDirectionOfChange; };
  1935.     BOOL    recencyOfObservation() { return m_bRecencyOfObservation; };
  1936.     BOOL    dataPreDifferenced() { return m_bDataPreDifferenced; };
  1937.     void    setActiveNumberOfExemplars(int anInt) { m_nActiveNumberOfExemplars = anInt; };
  1938.     void    setCVNumberOfExemplars(int anInt) { m_nCVNumberOfExemplars = anInt; };
  1939.     void    setLargeChangeRightDirectionScale(NSFloat aFloat) { m_fLargeChangeRightDirectionScale = aFloat; };
  1940.     void    setLargeChangeWrongDirectionScale(NSFloat aFloat) { m_fLargeChangeWrongDirectionScale = aFloat; };
  1941.     void    setSmallChangeRightDirectionScale(NSFloat aFloat) { m_fSmallChangeRightDirectionScale = aFloat; };
  1942.     void    setSmallChangeWrongDirectionScale(NSFloat aFloat) { m_fSmallChangeWrongDirectionScale = aFloat; };
  1943.     void    setRightDirectionScale(NSFloat aFloat) { m_fRightDirectionScale = aFloat; };
  1944.     void    setWrongDirectionScale(NSFloat aFloat) { m_fWrongDirectionScale = aFloat; };
  1945.     void    setLargeChangeScale(NSFloat aFloat) { m_fLargeChangeScale = aFloat; };
  1946.     void    setSmallChangeScale(NSFloat aFloat) { m_fSmallChangeScale = aFloat; };
  1947.     void    setDiscountRate(NSFloat aFloat) { m_fDiscountRate = aFloat; };
  1948.     void    setMagnitudeOfChange(BOOL aBool) { m_bMagnitudeOfChange = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1949.     void    setDirectionOfChange(BOOL aBool) { m_bDirectionOfChange = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1950.     void    setRecencyOfObservation(BOOL aBool) { m_bRecencyOfObservation = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1951.     void    setDataPreDifferenced(BOOL aBool) { m_bDataPreDifferenced = aBool; m_bMemoryNeedsReallocating = TRUE; };
  1952.     void    setExemplarNumber(int anInt) { m_nExemplarNumber = anInt; };
  1953. };
  1954.  
  1955. #endif // __L2TemporalCriterion_H__
  1956.  
  1957. // Author: Wesley Curtis Lefebvre
  1958.  
  1959. #ifndef __LpCriterion_H__
  1960. #define __LpCriterion_H__
  1961.  
  1962.  
  1963. class LpCriterion: public Criterion {
  1964.         int m_nP;
  1965. protected:
  1966.         void determineCost();
  1967.         void determineCostDerivative();
  1968. public:
  1969.         void setP(int anInt);
  1970.         int  p() { return m_nP; };
  1971.         LpCriterion();
  1972. };
  1973.  
  1974. #endif // __LpCriterion_H__
  1975.  
  1976. // Author: Wesley Curtis Lefebvre
  1977.  
  1978. #ifndef __LinfinityCriterion_H__
  1979. #define __LinfinityCriterion_H__
  1980.  
  1981.  
  1982. class LinfinityCriterion: public Criterion {
  1983. protected:
  1984.         void determineCost();
  1985.         void determineCostDerivative();
  1986. };
  1987.  
  1988. #endif // __LinfinityCriterion_H__
  1989.  
  1990. // Author: Wesley Curtis Lefebvre
  1991.  
  1992. #ifndef __Gradient_H__
  1993. #define __Gradient_H__
  1994.  
  1995.  
  1996. class Gradient {
  1997.         NSFloat maxWeight;
  1998. public:
  1999.         class Soma *errorSoma;
  2000.         class Soma *forwardSoma;
  2001. protected:
  2002.         DLLStruct *dllStruct;
  2003.         void *m_pCallingObject;
  2004.         Gradient **m_Gradient;
  2005.         Criterion *m_Criterion;
  2006.         int m_nGradientCount;
  2007. public:
  2008.         int linksAllocated;
  2009.         Gradient();
  2010.         virtual ~Gradient();
  2011.         virtual void allocateGradientPointers(int anInt);
  2012.         virtual void allocateLinks(int anInt);
  2013.         virtual void constructDLL();
  2014.         virtual void destroyDLL(DLLData *);
  2015.         virtual void fireGetReady();
  2016.         virtual void initializeDLL();
  2017.         virtual const char *dllFunctionName();
  2018.         virtual void loadWeights(FILE *, unsigned short int version=100);
  2019.         virtual void loadStateVariables(FILE *file, unsigned short int version);
  2020.         virtual void saveWeights(FILE *);
  2021.         virtual void saveStateVariables(FILE *file);
  2022.         virtual void networkRandomize(void);
  2023.         void setCriterion(Criterion *aCriterion);
  2024.         virtual void setDLLFunction(DLLStruct *aDLL);
  2025.         void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2026.         void setErrorSoma(Soma *aSoma);
  2027.         void setGradient(Gradient *aGradient, int index);
  2028.         virtual void setWeightLimit(NSFloat aFloat);
  2029.         virtual void update(Soma *aSoma);
  2030.         virtual void updateDLL(Soma *aSoma);
  2031.         void updateWeights(Soma *aSoma);
  2032.         NSFloat weightLimit(void) {return maxWeight;};
  2033.         virtual void networkReset(void);
  2034. };
  2035.  
  2036. #endif // __Gradient_H__
  2037.  
  2038. // Author: Wesley Curtis Lefebvre
  2039.  
  2040. #ifndef __Step_H__
  2041. #define __Step_H__
  2042.  
  2043.  
  2044. typedef DLLData *(*Step_Constructor)(DLLData *, int, BOOL);
  2045. typedef DLLData *(*Step_Constructor_CSW)(DLLData *, int, BOOL, void *);
  2046. typedef void (*Step_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat);
  2047. typedef void (*Step_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, void *);
  2048.  
  2049. class Step: public Gradient {
  2050.         int stepCount;
  2051. protected:
  2052.     NSFloat m_fDefaultStepSize, *stepSize;
  2053.     SpatialAccess *stepAccess;
  2054.     BOOL individualSteps;
  2055.     BOOL m_bDecayWeights;
  2056.     NSFloat m_fDecayRate;
  2057.     int m_nStepDivisor;
  2058.  
  2059. public:
  2060.     Step();
  2061.     void addToStepSize(NSFloat aFloat);
  2062.     void constructDLL();
  2063.     const char *dllFunctionName();
  2064.     NSFloat defaultStepSize(void) { return m_fDefaultStepSize; };
  2065.     void multByStepSize(NSFloat aFloat);
  2066.     virtual void setIndividualSteps(BOOL aFlag);
  2067.     void setDefaultStepSize(NSFloat aFloat);
  2068.     void setDecayRate(NSFloat aFloat) { m_fDecayRate = aFloat; };
  2069.     void setDecayWeights(BOOL aBool) { m_bDecayWeights = aBool; };
  2070.     void setStepAccess(SpatialAccess *anNSAccess);
  2071.     void setStepDivisor(int anInt) { m_nStepDivisor = anInt; };
  2072.     NSFloat &step(int i) { return (individualSteps && (i<stepCount))? *(stepSize+i): *stepSize; };
  2073.     int step(void) { return stepCount; };
  2074.     // Overwritten virtual functions
  2075.     void allocateLinks(int anInt);
  2076.     void networkReset(void);
  2077.     void update(Soma *aSoma);
  2078.     void updateDLL(Soma *aSoma);
  2079.     virtual ~Step(void);
  2080. };
  2081.  
  2082. #endif  // __Step_H__
  2083.  
  2084. #ifndef __SVMStep_H__
  2085. #define __SVMStep_H__
  2086.  
  2087. class SVMStep: public Step {
  2088. protected:
  2089.     int            m_nExemplarCount;
  2090.     BOOL        m_bRunningFirstEpoch;
  2091.  
  2092. public:
  2093.                 SVMStep();
  2094.     void        epochEnded();
  2095.     int            exemplarCount() { return m_nExemplarCount; };
  2096.     void        loadStateVariables(FILE *file, unsigned short int version);
  2097.     void        networkReset();
  2098.     BOOL        runningFirstEpoch() { return m_bRunningFirstEpoch; };
  2099.     void        saveStateVariables(FILE *file);
  2100.     void        setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  2101.     void        setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  2102.     void        update(Soma *aSoma);
  2103. };
  2104.  
  2105. #endif // __SVMStep_H__
  2106.  
  2107. //ConjugateGradient
  2108.  
  2109. #ifndef __ConjugateGradient_H__
  2110. #define __ConjugateGradient_H__
  2111.  
  2112.  
  2113. //typedef DLLData *(*ConjugateGradient_Constructor)(DLLData *, int, BOOL);
  2114. //typedef DLLData *(*ConjugateGradient_Constructor_CSW)(DLLData *, int, BOOL, void *);
  2115. //typedef void (*ConjugateGradient_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL);
  2116. //typedef void (*ConjugateGradient_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, void *);
  2117. class CGVars {
  2118. public:
  2119.     int linksAllocated;
  2120.     NSFloat *gradient;
  2121.     NSFloat *StoredWeightOnFireConclude;
  2122.     NSFloat *StoredWeight;
  2123. /*
  2124.     NSFloat *Pvec;
  2125.     NSFloat *Gvec;
  2126.     NSFloat *SKvec;
  2127. */
  2128.     double *Pvec;
  2129.     double *Gvec;
  2130.     double *SKvec;
  2131.  
  2132.     NSFloat *weight;
  2133.  
  2134.     CGVars();
  2135. //    void operator=(CGVars var1);
  2136.     void operator++(void);
  2137.     void store_weight(void);
  2138.     void reload_weight(void);
  2139.     void store_weight_conclude(void);
  2140.     void reload_weight_conclude(void);
  2141.     void store_info(Gradient *);
  2142.  
  2143. };
  2144.  
  2145. class CGGlobals {
  2146. public:
  2147. //    NSFloat Lambda, LambdaBar, MSE, MSEOld, Sigma, SigmaK, AlphaK, MuK, DeltaK;
  2148.     double Lambda, LambdaBar, MSE, MSEOld, Sigma, SigmaK, AlphaK, MuK, DeltaK;
  2149.     BOOL Success,Initialized,checkMSE,WeightsRandomized, weightsStoredOnFireConclude;
  2150.     int NumWeights, EpochNumber;
  2151.     void initializeGlobals(void);
  2152. };
  2153.  
  2154. class ConjugateGradient: public Gradient {
  2155.  
  2156. public:
  2157.         NSFloat *StoredWeightsOnFireConclude;
  2158.         NSFloat *StoredWeights;
  2159. /*
  2160.         NSFloat *Pvec;
  2161.         NSFloat *Gvec;
  2162.         NSFloat *SKvec;
  2163. */
  2164.         double *Pvec;
  2165.         double *Gvec;
  2166.         double *SKvec;
  2167.  
  2168. protected:
  2169.         BOOL m_bMasterGradient;
  2170.         int grad_comp_num;
  2171.         int    m_nActiveNumberOfExemplars;
  2172.  
  2173.         CGVars    m_firstvar_cgvars,
  2174.                 m_firstweight_cgvars;
  2175.  
  2176. public:
  2177.         CGGlobals *cgg;
  2178.         ConjugateGradient();
  2179.         virtual ~ConjugateGradient(void);
  2180. //        void constructDLL();
  2181. //        const char *dllFunctionName();
  2182.         // Overwritten virtual functions
  2183.         void allocateLinks(int anInt);
  2184.         void epochEnded(int counter);
  2185.         void fireGetReady();
  2186.         BOOL masterGradient() { return m_bMasterGradient; };
  2187.         void networkReset(void);
  2188.         void phaseEnded(int counter);
  2189.         void loadStateVariables(FILE *file, unsigned short int version);
  2190.         void saveStateVariables(FILE *file);
  2191.         void setMasterGradient(BOOL aBool);
  2192.         void update(Soma *aSoma);
  2193.         void storeOldWeights(void);
  2194.         void storeOldWeightsOnFireConclude(void);    // I don't think this is needed
  2195.         void reloadOldWeights(void);
  2196.         void reloadOldWeightsOnFireConclude(void);
  2197.         void resetGradients(void);
  2198.         void initializeVariables(void);
  2199.         void setActiveNumberOfExemplars(int anInt) { m_nActiveNumberOfExemplars = anInt; };
  2200.         void networkRandomize(void);
  2201.         void fireConclude(void);
  2202.         CGVars *first_weight(void);
  2203.         CGVars *next_weight(CGVars *);
  2204.         CGVars *first_var(Gradient *);
  2205.         void resetCG(void);
  2206.         friend void CGVars::store_info(Gradient *);
  2207. //        void updateDLL(Soma *aSoma);
  2208. };
  2209.  
  2210. #endif  // __ConjugateGradient_H__
  2211.  
  2212. // Author: Wesley Curtis Lefebvre
  2213.  
  2214. #ifndef __Momentum_H__
  2215. #define __Momentum_H__
  2216.  
  2217.  
  2218. typedef void (*Momentum_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat, NSFloat *);
  2219. typedef void (*Momentum_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat, NSFloat *, void *);
  2220.  
  2221. class Momentum: public Step {
  2222. protected:
  2223.         int momentumCount;
  2224.         NSFloat defaultMomentum, *momentumSize, *delta;
  2225.         SpatialAccess *deltaWAccess, *momentumAccess;
  2226.         BOOL individualMomentums;
  2227. public:
  2228.         Momentum();
  2229.         void addToMomentum(NSFloat aFloat);
  2230.         NSFloat &dW(int i) { return *(delta+i); };
  2231.         NSFloat getDefaultMomentum(void) { return defaultMomentum; };
  2232.         NSFloat &momentum(int i) { return individualMomentums? *(momentumSize+i): *momentumSize; };
  2233.         int momentum(void) { return momentumCount; };
  2234.         void multByMomentum(NSFloat aFloat);
  2235.         void loadStateVariables(FILE *file, unsigned short int version);
  2236.         void saveStateVariables(FILE *file);
  2237.         void setDeltaWAccess(SpatialAccess* anNSAccess);
  2238.         virtual void setDefaultMomentum(NSFloat aFloat);
  2239.         virtual void setIndividualMomentums(BOOL aFlag);
  2240.         virtual void setMomentumAccess(SpatialAccess* anNSAccess);
  2241.         // Overwritten virtual functions
  2242.         void allocateLinks(int anInt);
  2243.         const char *dllFunctionName();
  2244.         void networkReset(void);
  2245.         void update(Soma *aSoma);
  2246.         void updateDLL(Soma *aSoma);
  2247.         ~Momentum(void);
  2248. };
  2249.  
  2250. #endif // __Momentum_H__
  2251.  
  2252. // Author: Wesley Curtis Lefebvre
  2253.  
  2254. #ifndef __Quickprop_H__
  2255. #define __Quickprop_H__
  2256.  
  2257.  
  2258. typedef void (*Quickprop_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat *, NSFloat *, NSFloat, NSFloat *);
  2259. typedef void (*Quickprop_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat *, NSFloat *, NSFloat, NSFloat *, void *);
  2260.  
  2261. class Quickprop: public Momentum {
  2262.         NSFloat *deltaE;
  2263. protected:
  2264.         SpatialAccess *deltaEAccess;
  2265. public:
  2266.         Quickprop();
  2267.         void setDeltaEAccess(SpatialAccess *);
  2268.         // Overwritten virtual functions
  2269.         void allocateLinks(int anInt);
  2270.         NSFloat &dE(int i) { return *(deltaE+i); };
  2271.         const char *dllFunctionName();
  2272.         void loadStateVariables(FILE *file, unsigned short int version);
  2273.         void saveStateVariables(FILE *file);
  2274.         void setDefaultMomentum(NSFloat aFloat);
  2275.         void update(Soma *aSoma);
  2276.         void updateDLL(Soma *aSoma);
  2277.         void networkReset(void);
  2278.         ~Quickprop(void);
  2279. };
  2280.  
  2281. #endif //__Quickprop_H__
  2282.  
  2283. // Author: Wesley Curtis Lefebvre
  2284.  
  2285. #ifndef __DeltaBarDelta_H__
  2286. #define __DeltaBarDelta_H__
  2287.  
  2288.  
  2289. typedef void (*DeltaBarDelta_MAP)(DLLData *, NSFloat *, int, NSFloat, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat, NSFloat);
  2290. typedef void (*DeltaBarDelta_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat, NSFloat, void *);
  2291.  
  2292. class DeltaBarDelta: public Quickprop {
  2293.         NSFloat kappaValue, betaValue, zetaValue;
  2294. protected:
  2295.         NSFloat &D(int i) { return errorSoma->w(i); };
  2296.         NSFloat &S(int i) { return dE(i); };
  2297.         // Overwritten virtual functions
  2298. public:
  2299.         DeltaBarDelta();
  2300.         const char *dllFunctionName();
  2301.         NSFloat beta() { return betaValue; };
  2302.         NSFloat kappa() { return kappaValue; };
  2303.         NSFloat zeta() { return zetaValue; };
  2304.         void networkReset(void);
  2305.         void setDefaultMomentum(NSFloat);
  2306.         void setIndividualSteps(BOOL aFlag);
  2307.         void setKappa(NSFloat aFloat);
  2308.         void setBeta(NSFloat aFloat);
  2309.         void setZeta(NSFloat aFloat);
  2310.         void update(Soma *aSoma);
  2311.         void updateDLL(Soma *aSoma);
  2312. };
  2313.  
  2314. #endif // __DeltaBarDelta_H__
  2315.  
  2316. // Author: Wesley Curtis Lefebvre
  2317.  
  2318. #ifndef __UnsupervisedFull_H__
  2319. #define __UnsupervisedFull_H__
  2320.  
  2321.  
  2322. typedef void (*Unsupervised_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat);
  2323. typedef void (*Unsupervised_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, void *);
  2324.  
  2325. class UnsupervisedFull: public FullSynapse {
  2326. protected:
  2327.         SpatialAccess *stepAccess;
  2328.         BOOL m_bLearning, m_bTempLearning;
  2329.         NSFloat step, m_fStep;
  2330.         void fireDLL();
  2331.         void fireFeed();
  2332.         virtual void fireRule();
  2333.         virtual void fireRuleDLL();
  2334.         SpatialAccess *forcingAccess;
  2335.         NSFloat *forcingFeed, *feed;
  2336.         BOOL m_bForcing;
  2337.         BOOL m_bWeightNormalize;
  2338.         BOOL m_bLearningOnReset;
  2339. public:
  2340.         UnsupervisedFull();
  2341.         const char *dllFunctionName();
  2342.         BOOL learning() { return m_bLearning; };
  2343.         void networkReset();
  2344.         void setLearningOnReset(BOOL aBOOL) { m_bLearningOnReset = aBOOL; };
  2345.         void setLearning(BOOL aBOOL) { m_bLearning = aBOOL; };
  2346.         void setLearningNO() { m_bTempLearning = m_bLearning; m_bLearning = NO; };
  2347.         void setLearningYES() { m_bLearning = m_bTempLearning;  m_bTempLearning = NO; };
  2348.         void setStepAccess(SpatialAccess *);
  2349.         void setStepSize(NSFloat);
  2350.         NSFloat stepSize() { return step; };
  2351.         void allocateForce(void);
  2352.         void allocateSynapticLinks(void);
  2353.         void fire(void);
  2354.         void setForcing(BOOL);
  2355.         void setForcingAccess(SpatialAccess *);
  2356.         void setWeightNormalize(BOOL aBOOL) { m_bWeightNormalize = aBOOL; };
  2357. };
  2358.  
  2359. #endif // __UnsupervisedFull_H__
  2360.  
  2361. // SVMInputSynapse
  2362.  
  2363. #ifndef __SVMInputSynapse_H__
  2364. #define __SVMInputSynapse_H__
  2365.  
  2366.  
  2367. class SVMInputSynapse: public UnsupervisedFull {
  2368. protected:
  2369.     BOOL    m_bRunningFirstEpoch,
  2370.             m_bDotProductMetric;
  2371.     int        m_nExemplarCount;
  2372.  
  2373. public:
  2374.                 SVMInputSynapse();
  2375.     void        epochEnded();
  2376.     int            exemplarCount() { return m_nExemplarCount; };
  2377.     void        fireFeed(void);
  2378.     void        fireRule(void);
  2379.     void        loadStateVariables(FILE *file, unsigned short int version);
  2380.     void        networkReset();
  2381.     BOOL        runningFirstEpoch() { return m_bRunningFirstEpoch; };
  2382.     void        saveStateVariables(FILE *file);
  2383.     void        setDotProductMetric(BOOL aBool) { m_bDotProductMetric = aBool; };
  2384.     void        setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  2385.     void        setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  2386. };
  2387.  
  2388. #endif // __SVMInputSynapse_H__
  2389.  
  2390. // Author: Wesley Curtis Lefebvre
  2391.  
  2392. #ifndef __HebbianFull_H__
  2393. #define __HebbianFull_H__
  2394.  
  2395.  
  2396. class HebbianFull: public UnsupervisedFull {
  2397. protected:
  2398. //        SpatialAccess *forcingAccess;
  2399. //        NSFloat *forcingFeed, *feed;
  2400. //        BOOL m_bForcing;
  2401. public:
  2402.         HebbianFull();
  2403. //        void allocateForce(void);
  2404. //        void allocateSynapticLinks(void);
  2405. //        void fire(void);
  2406.         void fireRule(void);
  2407.         void fireRuleDLL();
  2408. //        void HebbianFull::setForcing(BOOL);
  2409. //        void setForcingAccess(SpatialAccess *);
  2410.         void storeHopfield(int);
  2411. };
  2412.  
  2413. #endif // __HebbianFull_H__
  2414.  
  2415. // Author: Wesley Curtis Lefebvre
  2416.  
  2417. #ifndef __OjasFull_H__
  2418. #define __OjasFull_H__
  2419.  
  2420.  
  2421. class OjasFull: public UnsupervisedFull {
  2422. protected:
  2423.         void fireRule(void);
  2424. };
  2425.  
  2426. #endif // __OjasFull_H__
  2427.  
  2428. // Author: Wesley Curtis Lefebvre
  2429.  
  2430. #ifndef __SangersFull_H__
  2431. #define __SangersFull_H__
  2432.  
  2433.  
  2434. class SangersFull: public UnsupervisedFull {
  2435. protected:
  2436.         void fireRule(void);
  2437. };
  2438.  
  2439. #endif // __SangersFull_H__
  2440.  
  2441. // Author: Wesley Curtis Lefebvre
  2442.  
  2443. #ifndef __CompetitiveFull_H__
  2444. #define __CompetitiveFull_H__
  2445.  
  2446.  
  2447. typedef enum {DotProduct=0, Euclidean=1, BoxCar=2} NMetricType;
  2448. typedef void (*Competitive_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int);
  2449. typedef void (*Competitive_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, void *);
  2450.  
  2451. class CompetitiveFull: public UnsupervisedFull {
  2452. protected:
  2453.         NMetricType                    m_eMetricType;
  2454.         int                            winningIndex,
  2455.                                     m_nNumSamples;
  2456.         SpatialAccess                *unifiedDistanceAccess,
  2457.                                     *quantizationMetricAccess;
  2458.         NSFloat                        *m_fpDistanceMatrix;
  2459.         NSFloat                        m_fQuantizationMetric,
  2460.                                     m_fSumError;
  2461.  
  2462. public:
  2463.         CompetitiveFull();
  2464.         NSFloat distance(int r1, int c1, int r2, int c2, NSFloat *input, int koh_cols, int orig_cols);
  2465.         const char *dllFunctionName();
  2466.         void epochEnded();
  2467.         void fireDLL();
  2468.         void fireFeed();
  2469.         void fireRule();
  2470.         virtual void fireWinner();
  2471.         virtual void fireWinnerDLL();
  2472.         void linksAltered(void);
  2473.         void networkReset();
  2474.         NMetricType metric() { return m_eMetricType; };
  2475.         void setMetric(NMetricType anEnum) { m_eMetricType = anEnum; };
  2476.         void setQuantizationMetricAccess(SpatialAccess *anId);
  2477.         void setUnifiedDistanceAccess(SpatialAccess *anId);
  2478. };
  2479.  
  2480. #endif // __CompetitiveFull_H__
  2481.  
  2482. // Author: Wesley Curtis Lefebvre
  2483.  
  2484. #ifndef __StandardFull_H__
  2485. #define __StandardFull_H__
  2486.  
  2487.  
  2488. class StandardFull: public CompetitiveFull {
  2489. protected:
  2490.         void standardUpdate(int i, int j) { W(i, j) += step * (V(j) - W(i, j)); };
  2491.         void fireWinner(void);
  2492. };
  2493.  
  2494. #endif // __StandardFull_H__
  2495.  
  2496. // Author: Wesley Curtis Lefebvre
  2497.  
  2498. #ifndef __ConscienceFull_H__
  2499. #define __ConscienceFull_H__
  2500.  
  2501.  
  2502. class ConscienceFull: public StandardFull {
  2503. protected:
  2504.         class SpatialData       *frequency, *bias;
  2505.         NSFloat                         m_fBeta, m_fGamma;
  2506.         BOOL                    m_bBiasDataLocal, m_bFrequencyDataLocal;
  2507. public:
  2508.         ConscienceFull();
  2509.         ~ConscienceFull();
  2510.         void allocateSynapticLinks();
  2511.         NSFloat beta() { return m_fBeta; };
  2512.         void fireRule(void);
  2513.         NSFloat gamma() { return m_fGamma; };
  2514.         void networkReset();
  2515.         void setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2516.         void setBiasData(SpatialData *);
  2517.         void setFrequencyData(SpatialData *);
  2518.         void setGamma(NSFloat aFloat) { m_fGamma = aFloat; };
  2519. };
  2520.  
  2521. #endif // __ConscienceFull_H__
  2522.  
  2523. // Author: Wesley Curtis Lefebvre
  2524.  
  2525. #ifndef __KohonenFull_H__
  2526. #define __KohonenFull_H__
  2527.  
  2528.  
  2529. typedef void (*Kohonen_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, int, int);
  2530. typedef void (*Kohonen_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, int, int, void *);
  2531.  
  2532. class KohonenFull: public ConscienceFull {
  2533. protected:
  2534.         SpatialAccess           *neighborhoodAccess,
  2535.                                 *componentPlaneAccess;
  2536.         NSFloat                 m_fNeighborhood;
  2537.         NSFloat                 *m_fpComponentPlaneMatrix;
  2538.         int                        m_iNeighborhood;
  2539.         int                     startRow, stopRow, m_nComponentPlane,
  2540.                                 startCol, stopCol,
  2541.                                 winningRow, winningCol;
  2542. public:
  2543.         KohonenFull();
  2544.         int componentPlane();
  2545.         const char *dllFunctionName();
  2546.         void epochEnded();
  2547.         void linksAltered(void);
  2548.         int neighborhood() { return (int)m_fNeighborhood; };
  2549.         void networkReset();
  2550.         void setNeighborhood(int);
  2551.         void setNeighborhoodAccess(SpatialAccess *);
  2552.         void fireWinner();
  2553.         void fireWinnerDLL();
  2554.         virtual void fireWinningShape();
  2555.         void setComponentPlane(int anInt);
  2556.         void setComponentPlaneAccess(SpatialAccess *anId);
  2557. };
  2558.  
  2559. #endif // __KohonenFull_H__
  2560.  
  2561. // Author: Wesley Curtis Lefebvre
  2562.  
  2563. #ifndef __LineKohonenFull_H__
  2564. #define __LineKohonenFull_H__
  2565.  
  2566.  
  2567. class LineKohonenFull: public KohonenFull {
  2568. protected:
  2569.         void fireWinner();
  2570. };
  2571.  
  2572. #endif // __LineKohonenFull_H__
  2573.  
  2574. // Author: Wesley Curtis Lefebvre
  2575.  
  2576. #ifndef __SquareKohonenFull_H__
  2577. #define __SquareKohonenFull_H__
  2578.  
  2579.  
  2580. class SquareKohonenFull: public KohonenFull {
  2581. protected:
  2582.         void fireWinningShape();
  2583. };
  2584.  
  2585. #endif  __SquareKohonenFull_H__
  2586.  
  2587. // Author: Wesley Curtis Lefebvre
  2588.  
  2589. #ifndef __DiamondKohonenFull_H__
  2590. #define __DiamondKohonenFull_H__
  2591.  
  2592.  
  2593. class DiamondKohonenFull: public KohonenFull {
  2594. protected:
  2595.         void fireWinningShape();
  2596. };
  2597.  
  2598. #endif  __DiamondKohonenFull_H__
  2599.  
  2600. // Author: Wesley Curtis Lefebvre
  2601. // Name: Transmitter.h
  2602.  
  2603. #ifndef __Transmitter_H__
  2604. #define __Transmitter_H__
  2605.  
  2606.  
  2607. typedef BOOL (*Transmitter_MAP)(DLLData *, NSFloat *, int);
  2608. typedef BOOL (*Transmitter_MAP_CSW)(DLLData *, NSFloat *, int, void *);
  2609. typedef void (*TransmitterSend_FUNCTION)(void *, const char *);
  2610.  
  2611. class Transmitter: public SpatialData
  2612. {
  2613. protected:
  2614.         DLLStruct *dllStruct;
  2615.         void *m_pSendFunction;
  2616.         void *m_pCallingObject;
  2617.         unsigned int receiverCount;
  2618.         char *receiverName[128];
  2619.         void *receiverID[128];
  2620. public:
  2621.         Transmitter();
  2622.         ~Transmitter();
  2623.         void addReceiver(void *anId, const char *);
  2624.         virtual void constructDLL(void);
  2625.         virtual void destroyDLL(DLLData *);
  2626.         virtual void initializeDLL(void);
  2627.         void reportSpatialData();
  2628.         virtual void sendTransmitterActions();
  2629.         virtual void setDLLFunction(DLLStruct *);
  2630.         virtual void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2631.         void setSendFunction(void *aFunction);
  2632.         virtual BOOL shouldTransmit(NSFloat *someData);
  2633.         virtual BOOL shouldTransmitDLL(NSFloat *someData);
  2634. };
  2635.  
  2636. #endif __Transmitter_H__
  2637.  
  2638. // Author: Wesley Curtis Lefebvre
  2639. // Name: ThresholdTransmitter.h
  2640.  
  2641. #ifndef __ThresholdTransmitter_H__
  2642. #define __ThresholdTransmitter_H__
  2643.  
  2644.  
  2645. typedef DLLData *(*ThresholdTransmitter_Constructor)(DLLData *, int, int);
  2646. typedef DLLData *(*ThresholdTransmitter_Constructor_CSW)(DLLData *, int, int, void *);
  2647. typedef BOOL (*ThresholdTransmitter_MAP)(DLLData *, NSFloat *, int, int, NSFloat, BOOL, int, int);
  2648. typedef BOOL (*ThresholdTransmitter_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat, BOOL, int, int, void *);
  2649.  
  2650. class ThresholdTransmitter: public Transmitter
  2651. {
  2652. protected:
  2653.         class   SpatialAccess    *m_thresholdAccess;
  2654.         class   SpatialData        *m_pSmooth;
  2655.         NSFloat                    m_threshold,
  2656.                                 m_thresholdDecay,
  2657.                                 m_fBeta,
  2658.                                 m_fInitialValue,
  2659.                                 m_startingThreshold;
  2660.         int                        m_sendAfter, m_sendAfterCounter, m_thresholdType, m_nChannelNumber;
  2661.         BOOL                    m_bSmoothingDataLocal, m_lessThan, m_bMultBy, m_bAbs;
  2662. public:
  2663.                                 ThresholdTransmitter();
  2664.                                 ~ThresholdTransmitter();
  2665.         NSFloat                    absolute(NSFloat &aFloat) { return m_bAbs? (NSFloat)fabs(aFloat): aFloat; };
  2666.         BOOL                    absoluteValue() { return m_bAbs; };
  2667.         BOOL                    allLessThan(NSFloat *data,int length);
  2668.         BOOL                    averageLessThan(NSFloat *data,int length);
  2669.         NSFloat                    beta(){return m_fBeta;};
  2670.         void                    constructDLL();
  2671.         NSFloat                    initialValue(){return m_fInitialValue;};
  2672.         BOOL                    lessThan(){return m_lessThan;};
  2673.         BOOL                    multBy(){return m_bMultBy;};
  2674.         void                    networkReset();
  2675.         BOOL                    oneLessThan(NSFloat *data,int length);
  2676.         BOOL                    overThreshold(NSFloat *someData);
  2677.         int                        sendAfter(){return m_sendAfter;};
  2678.         void                    sendTransmitterActions();
  2679.         void                    setAbsoluteValue(BOOL aBOOL) { m_bAbs = aBOOL; };
  2680.         void                    setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2681.         void                    setChannelNumber(int anInt);
  2682.         void                    setInitialValue(NSFloat aFloat);
  2683.         void                    setData(NSFloat *aFloat, int rows, int cols=1);
  2684.         void                    setSpatialDimension(int, int);
  2685.         void                    setLessThan(BOOL aFlag);
  2686.         void                    setMultBy(BOOL aFlag);
  2687.         void                    setSendAfter(int anInt);
  2688.         void                    setSmoothingData(SpatialData *);
  2689.         void                    setThreshold(NSFloat aFloat);
  2690.         void                    setThresholdDecay(NSFloat aFloat);
  2691.         void                    setThresholdType(int anInt);
  2692.         void                    setThresholdAccess(SpatialAccess *);
  2693.         BOOL                    shouldTransmit(NSFloat *);
  2694.         BOOL                    shouldTransmitDLL(NSFloat *);
  2695.         NSFloat                    threshold(){return m_startingThreshold;};
  2696.         NSFloat                    thresholdDecay(){return m_thresholdDecay;};
  2697.         int                        thresholdType(){return m_thresholdType;};
  2698.         virtual NSFloat            *weightedAverage(NSFloat *);
  2699. };
  2700. #endif
  2701.  
  2702. // Author: Wesley Curtis Lefebvre
  2703. // Name: DeltaTransmitter.h
  2704.  
  2705. #ifndef __DeltaTransmitter_H__
  2706. #define __DeltaTransmitter_H__
  2707.  
  2708.  
  2709. class DeltaTransmitter: public ThresholdTransmitter
  2710. {
  2711. protected:
  2712.                 NSFloat                 *m_lastData, *m_deltaData;
  2713. public:
  2714.  
  2715.                                         DeltaTransmitter();
  2716.                                         ~DeltaTransmitter();
  2717.                 DeltaTransmitter        *allocateLastData();
  2718.                 NSFloat                 *weightedAverage(NSFloat *);
  2719.                 void                    setData(NSFloat *, int, int cols=1);
  2720.                 void                    setSpatialDimension(int, int);
  2721.  
  2722. };
  2723.  
  2724. #endif __DeltaTransmitter_H__
  2725.  
  2726. #ifndef __Scheduler_H__
  2727. #define __Scheduler_H__
  2728.  
  2729.  
  2730. typedef DLLData *(*Scheduler_Constructor)(DLLData *, int);
  2731. typedef DLLData *(*Scheduler_Constructor_CSW)(DLLData *, int, void *);
  2732. typedef void (*Scheduler_MAP)(DLLData *, NSFloat *, int, NSFloat);
  2733. typedef void (*Scheduler_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat, void *);
  2734.  
  2735. class Scheduler : public SpatialData
  2736. {
  2737. protected:
  2738.         NSFloat                         m_fBeta, m_fMin, m_fMax;
  2739.         int                             m_iStart, m_iStop;
  2740.         DLLStruct                       *dllStruct;
  2741.         void                            *m_pCallingObject;
  2742. public:
  2743.                                                 Scheduler();
  2744.         virtual void            applyDLL();
  2745.         virtual void            applySchedule(){};
  2746.         void                            attachTo(SpatialAccess *);
  2747.         NSFloat                         beta() { return m_fBeta; };
  2748.         void                            constrain(NSFloat &f) { if (f>m_fMax) f=m_fMax; else if (f<m_fMin) f=m_fMin; };
  2749.         const char                      *dllFunctionName();
  2750.         void                            epochEnded(int);
  2751.         void                            constructDLL();
  2752.         void                            destroyDLL(DLLData *);
  2753.         void                            initializeDLL();
  2754.         NSFloat                         maximum() { return m_fMax; };
  2755.         NSFloat                         minimum() { return m_fMin; };
  2756.         void                            setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2757.         void                            setData(NSFloat *, int, int);
  2758.         void                            setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2759.         void                            setMaximum(NSFloat aFloat) { m_fMax = aFloat; };
  2760.         void                            setMinimum(NSFloat aFloat) { m_fMin = aFloat; };
  2761.         void                            setSpatialDimension(int, int);
  2762.         void                            setStart(int anInt) { m_iStart = anInt; };
  2763.         void                            setStop(int anInt) { m_iStop = anInt; };
  2764.         int                                     start() { return m_iStart; };
  2765.         int                                     stop() { return m_iStop; };
  2766. };
  2767.  
  2768. #endif __Scheduler_H__
  2769.  
  2770. // Author: Wesley Curtis Lefebvre
  2771.  
  2772. #ifndef __ExpScheduler_H__
  2773. #define __ExpScheduler_H__
  2774.  
  2775.  
  2776. class ExpScheduler : public Scheduler
  2777. {
  2778. public:
  2779.                                 ExpScheduler();
  2780.         void            applySchedule();
  2781. };
  2782.  
  2783. #endif __ExpScheduler_H__
  2784.  
  2785. // Author: Wesley Curtis Lefebvre
  2786.  
  2787. #ifndef __LogScheduler_H__
  2788. #define __LogScheduler_H__
  2789.  
  2790.  
  2791. class LogScheduler : public Scheduler
  2792. {
  2793. public:
  2794.                                 LogScheduler();
  2795.         void            applySchedule();
  2796. };
  2797.  
  2798. #endif __LogScheduler_H__
  2799.  
  2800. // Author: Wesley Curtis Lefebvre
  2801.  
  2802. #ifndef __LinearScheduler_H__
  2803. #define __LinearScheduler_H__
  2804.  
  2805.  
  2806. class LinearScheduler : public Scheduler
  2807. {
  2808. public:
  2809.                                 LinearScheduler();
  2810.         void            applySchedule();
  2811. };
  2812.  
  2813. #endif __LinearScheduler_H__
  2814.