1/*****************************************************************************
2  FILE           : $Source: /projects/higgs1/SNNS/CVS/SNNS/kernel/sources/cc_glob.ph,v $
3  SHORTNAME      : cc_glob.ph
4  SNNS VERSION   : 4.2
5
6  PURPOSE        : Header file of correspondent '.c' file
7  NOTES          : This file was put together from the earlier files cc_rcc
8                   and cc_rcc_topo
9
10  AUTHOR         : Michael Schmalzl
11  DATE           : 5.2.92
12
13  CHANGED BY     : Guenter Mamier
14  RCS VERSION    : $Revision: 2.5 $
15  LAST CHANGE    : $Date: 1998/02/25 15:25:53 $
16
17    Copyright (c) 1990-1995  SNNS Group, IPVR, Univ. Stuttgart, FRG
18    Copyright (c) 1996-1998  SNNS Group, WSI, Univ. Tuebingen, FRG
19
20******************************************************************************/
21#ifndef _CC_GLOB_DEFINED_
22#define  _CC_GLOB_DEFINED_
23
24/* begin global definition section */
25void      cc_printHeadline(char* s,int Length);
26float     cc_getErr (int StartPattern, int EndPattern);
27void      cc_LayerCorrectnessTest(float* ParameterInArray,
28				  int StartPattern, int EndPattern);
29krui_err  cc_freeStorage(int StartPattern, int EndPattern, int flag);
30krui_err  cc_deleteAllSpecialAndAllHiddenUnits(void);
31krui_err  cc_allocateStorage(int StartPattern, int EndPattern,
32			     int NoOfSpecialUnits);
33FlintType cc_generateRandomNo(float maxValue);
34void      cc_initActivationArrays(void);
35void      cc_getActivationsForActualPattern(int SubPatterNo,int First,int* pat,
36					    int* sub);
37void      cc_initOutputUnits(void);
38krui_err  cc_getPatternParameter(int StartPattern, int Endpattern,
39				 int* start, int* end,int* n);
40void      cc_initInputUnitsWithPattern(int PatternNo);
41krui_err  cc_setPointers(void);
42krui_err  cc_initSpecialUnitLinks(void);
43krui_err  cc_deleteAllSpecialUnits(void);
44
45krui_err  cc_topoSort(int topoSortId);
46void      cc_setCycletestFlag(struct Unit* UnitPtr);
47
48float QuickPropOfflinePart(float oldValue, float* previousSlope,
49			   float* currentSlope,float* LastChange,
50			   float epsilon, float mu, float decay);
51float BackPropOfflinePart(float oldValue, float* previousSlope,
52			  float* currentSlope, float* LastChange,
53			  float dummy1, float dummy2, float dummy3);
54float OfflineBackPropOfflinePart(float oldValue, float* previousSlope,
55				 float* currentSlope, float* LastChange,
56				 float epsilon, float mu, float dummy);
57float RPropOfflinePart(float oldValue, float* previousSlope,
58		       float* currentSlope, float* LastChange,
59		       float epsilonMinus, float epsilonPlus, float dummy);
60float OnlineBackPropOfflinePart(float oldValue, float* previousSlope,
61				float* currentSlope, float* LastChange,
62				float eta, float mu, float dummy);
63
64struct CC_DATA  cc_data ={
65  { MAX_PIXEL_ERROR,
66    LEARNING_FUNC, MODIFICATION,
67    ON_OFF, 0, 0, 150, SBC,
68    { 0.0, 0.0, 0.0, 0.0, 0.0 },
69    OFF},
70  { MIN_COVARIANCE_CHANGE,
71    SPECIAL_PATIENCE,
72    MAX_NO_OF_COVARIANCE_UPDATE_CYCLES,
73    MAX_SPECIAL_UNIT_NO,
74    SPECIAL_FUNC_TYPE },
75  { MIN_ERROR_CHANGE,
76    OUT_PATIENCE,
77    MAX_NO_OF_ERROR_UPDATE_CYCLES}
78};
79
80char *cc_actFuncArray[]     ={"Act_Logistic","Act_LogSym","Act_TanH",
81                              "Act_CC_Thresh","Act_Sinus","Act_Exponential",
82			      "Act_Random"};
83char *cc_actFuncArray2[]     ={"Logistic"," LogSym ",
84			      "  TanH  ","dummy"," Sinus  ",
85			      "  Gauss "," Random "};
86char *cc_learningFuncArray[]={" Batch-BP  "," Backprop  ",
87			      " Quickprop ","   Rprop   "};
88char *cc_ModificationArray[]={"   none ","   SDCC ","   LFCC ","   RLCC ",
89			      "   ECC  ","   GCC  ","  Static"};
90char *cc_pruningFuncArray[] ={" SBC "," AIC ","CMSEP"};
91
92int cc_end                = 0;
93int cc_storageFree        = 1;
94int cc_allButtonIsPressed = 1;
95
96
97struct Unit  **FirstInputUnitPtr,**FirstHiddenUnitPtr,
98             **FirstOutputUnitPtr,**FirstSpecialUnitPtr,
99              *bestSpecialUnitPtr;
100
101float **OutputUnitError=NULL;
102float **SpecialUnitAct=NULL;
103float **CorBetweenSpecialActAndOutError=NULL;
104float *MeanOutputUnitError=NULL;
105float *SpecialUnitSumAct=NULL;
106int   LastInsertedHiddenUnit;
107
108float SumSqError;
109
110int cc_printOnOff;
111int cc_backfittingOnOff;
112int cc_MaxSpecialUnitNo;
113int cc_modification = -1;
114int cc_fastmode;
115float cc_Parameter[5];
116
117
118int *reset=0;
119int cc_cascade=0;
120int NoOfLayers = 0;             /* number hidden layers */
121Layer_Type* ListOfLayers=NULL;  /* data of layers */
122int SizeOfLayerlist;
123
124
125int cc_outputXMax;
126
127int     cc_actualNetSaved = FALSE;
128float** ActOfUnit = NULL;
129int     NetLearnAlgorithm = NO_INC_ALGORITHM;
130
131float cc_fse = 0.1;
132int cc_learningFunction;
133
134int prot_fd = -1;
135FILE* prot_stream;
136char DumpText[1024];
137bool cc_NetErgProtocolled;
138int CountSpecTrains,CountOutTrains,CountLinks;
139
140void Prot();
141void prot(char* s);
142void Prot_Parameters(float* Params,int NetIsCC);
143int filedesc = -1;
144
145/* the following functions are dummy declarations without implemented body!!
146   They are realized by directing their pointers to other functions */
147krui_err (*cc_propagateSpecialUnitsBackward)(int start, int end, int n,
148					     int counter, float param1,
149					     float param2, float param3);
150float (*cc_propagateOutputUnitsBackward)(int PatternNo, int sub_pat_no,
151					 float param1, float param2,
152					 float param3);
153float (*cc_SpecialUnitUpdate)(float oldValue, float* previousSlope,
154			      float* currentSlope, float* LastChange,
155			      float param1, float param2, float param3);
156float (*cc_OutputUnitUpdate)(float oldValue, float* previousSlope,
157			     float* currentSlope, float* LastChange,
158			     float param1, float param2, float param3);
159
160/* end global definition section */
161
162
163
164/* begin privat definition section */
165
166static int OldNoOfSpecialUnitStorage = 0;
167
168#define LINKS_LEAVING(unitPtr)   unitPtr->value_a
169#define LINKS_ARRIVEING(unitPtr) unitPtr->value_b
170#define INPUT_LINKS(unitPtr)     unitPtr->value_c
171
172static void  cc_clearFlags(void);
173static void  DepthFirst4(struct Unit *unitPtr, int depth);
174static void  DepthFirst5(struct Unit *unitPtr, int depth);
175krui_err     cc_topoSortMain(int topoSortID);
176
177static TopoPtrArray	global_topo_ptr;
178
179/* end  privat definition section */
180
181#endif /* _CC_GLOB_DEFINED_ */
182
183
184
185
186
187
188
189